Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 5.92 KB  |  hits: 62  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. External interface and Internet Explorer 9 issue
  2. SCRIPT16389: Could not complete the operation due to error 8070000c.
  3. jquery.min.js, line 16 character 29366
  4.        
  5. var that = this;
  6. that.stop();
  7.        
  8. this.stop = function(){
  9.     var that = this;
  10.     console.log('stop called');
  11.     that.pause();
  12.     that.seek(0);
  13.     that.isPlaying = false;
  14.     console.log('stop finished');
  15. };
  16.  
  17. this.pause = function(){  
  18.     var that = this;
  19.         console.log('pause called');
  20.     if(that.player == 'undefined' || that.player == null){
  21.         that.player = that.GetMediaObject(that.playerID);
  22.     }
  23.     that.player.pauseMedia(); //external interface call
  24.     that.isPlaying = false;
  25.     console.log('pause finished');
  26. };
  27.  
  28. this.seek = function(seek){                
  29.     var that = this;
  30.     console.log('seek called');
  31.     if(that.player == 'undefined' || that.player ==null){
  32.         console.log("player="+that.player+".  resetting player object");
  33.         that.player = that.GetMediaObject(that.playerID);
  34.         console.log("player="+that.player);
  35.     }
  36.     that.player.scrubMedia(seek); //external interface call
  37.  
  38.     console.log('seek finished');            
  39. };
  40.  
  41. //this method returns a reference to my player.  This method is call once when the page loads and then again as necessary by all methods that make external interface calls
  42. this.GetMediaObject = function(playerID){
  43.     var mediaObj = swfobject.getObjectById(playerID);
  44.         console.log('fetching media object: ' +mediaObj );
  45.  
  46.         //if swfobject.getObjectById fails  
  47.         if(typeof mediaObj == 'undefined' || mediaObj == null){
  48.                 console.log('secondary fetch required');
  49.         var isIE = navigator.userAgent.match(/MSIE/i);
  50.         mediaObj = isIE ? window[playerID] : document[playerID];
  51.     }
  52.  
  53.     return mediaObj;
  54. };
  55.        
  56. LOG: fetching media object: [object HTMLObjectElement]
  57. LOG: video-obj-1: ready
  58. LOG: stop called
  59. LOG: pause called
  60. LOG: pause finished
  61. LOG: seek called
  62. LOG: player=[object HTMLObjectElement]
  63. SCRIPT16389: Could not complete the operation due to error 8070000c.
  64. jquery.min.js, line 16 character 29366
  65.        
  66. flash.system.Security.allowDomain("*.mydomain.com");
  67.  
  68. import flash.external.ExternalInterface;
  69.  
  70. // variables to store local information about the current media
  71. var mediaEmbedServer:String = "www";
  72. var mediaPlayerID:String;
  73. var mediaFile:String;
  74. var mediaDuration:Number;
  75.  
  76. // variables to be watched by actionscript and message javascript on changes
  77. var mediaPositions:String = "0,0"; // buffer position, scrub position
  78. var mediaStatus:String;
  79.  
  80. var netStreamClient:Object = new Object();
  81. netStreamClient.onMetaData = metaDataHandler;
  82. netStreamClient.onCuePoint = cuePointHandler;
  83.  
  84. var connection:NetConnection;
  85. var stream:NetStream;
  86. var media:Video = new Video();
  87.  
  88. // grab the media's duration when it becomes available
  89. function metaDataHandler(info:Object):void {
  90. mediaDuration = info.duration;
  91. }
  92.  
  93. function cuePointHandler(info:Object):void {
  94. }
  95.  
  96. connection = new NetConnection();
  97. connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
  98. connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
  99.  
  100. try {
  101. var paramName:String;
  102. var paramValue:String;
  103. var paramObject:Object = LoaderInfo(this.root.loaderInfo).parameters;
  104. for (paramName in paramObject) {
  105. paramValue = String(paramObject[paramName]);
  106. switch (paramName){
  107. case "server":
  108. mediaEmbedServer = paramValue;
  109. break
  110. case "playerID":
  111. mediaPlayerID = paramValue;
  112. break
  113. }
  114. }
  115. } catch (error:Error) {
  116. }
  117.  
  118. if (mediaEmbedServer == "dev" || mediaEmbedServer == "dev2"){
  119. connection.connect("rtmp://media.developmentMediaServer.com/myApp");
  120. } else {
  121. connection.connect("rtmp://media.myMediaServer.com/myApp");
  122. }
  123.  
  124. function securityErrorHandler(event:SecurityErrorEvent):void {
  125. trace("securityErrorHandler: " + event);
  126. }  
  127.  
  128. function connectStream():void {
  129. stream = new NetStream(connection);
  130. stream.soundTransform = new SoundTransform(1);
  131. stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
  132. stream.client = netStreamClient;
  133. media.attachNetStream(stream);
  134. media.width = 720;
  135. media.height = 405;
  136. addChild(media);
  137. }
  138.  
  139. function netStatusHandler(stats:NetStatusEvent){
  140. switch (stats.info.code){
  141. case "NetConnection.Connect.Success":
  142. connectStream();
  143. break;
  144. case "NetConnection.Call.BadVersion":
  145. case "NetConnection.Call.Failed":
  146. case "NetConnection.Call.Prohibited":
  147. case "NetConnection.Connect.AppShutdown":
  148. case "NetConnection.Connect.Failed":
  149. case "NetConnection.Connect.InvalidApp":
  150. case "NetConnection.Connect.Rejected":
  151. case "NetGroup.Connect.Failed":
  152. case "NetGroup.Connect.Rejected":
  153. case "NetStream.Connect.Failed":
  154. case "NetStream.Connect.Rejected":
  155. case "NetStream.Failed":
  156. case "NetStream.Play.Failed":
  157. case "NetStream.Play.FileStructureInvalid":
  158. case "NetStream.Play.NoSupportedTrackFound":
  159. case "NetStream.Play.StreamNotFound":
  160. case "NetStream.Seek.Failed":
  161. case "NetStream.Seek.InvalidTime":
  162. // report error status and reset javascriptPlay
  163. clearInterval(progressInterval);
  164. messageStatus("error");
  165. break;
  166. default:
  167. // check time through file to determine if media is over
  168. if (stream.time > 0 && stream.time >= (mediaDuration - .25)){
  169. // reset media if it has ended
  170. clearInterval(progressInterval);
  171. stream.play(mediaFile, 0, 0);
  172. messageStatus("finished");
  173. }
  174. }
  175. };
  176.  
  177. var progressInterval:Number;
  178.  
  179. // respond to a play/pause request by playing/pausing the current stream
  180. function pauseMedia(){
  181. clearInterval(progressInterval);
  182. if (mediaStatus == 'playing'){
  183. stream.pause();
  184. messageStatus("paused");
  185. }
  186. };
  187. ExternalInterface.addCallback( "pauseMedia", pauseMedia );
  188.  
  189. // respond to a scrub request by seeking to a position in the media
  190. function scrubMedia(newPosition){
  191. clearInterval(progressInterval);
  192. if (mediaStatus == "playing"){
  193. stream.pause();
  194. messageStatus("paused");
  195. }
  196. stream.seek(newPosition * mediaDuration);
  197. var positionSeconds = newPosition * mediaDuration;
  198. messagePositions(positionSeconds+","+positionSeconds);
  199. };
  200. ExternalInterface.addCallback( "scrubMedia", scrubMedia );
  201.  
  202.  
  203. ExternalInterface.call("MediaPlayerReady", mediaPlayerID);