Frontend and problem with Internet Explorer 9

Boy-o-boy, I hate the frontend. I have a video player that uses an external interface to control a flash object and allows the Flash object to send messages to the same javascript. For a while, it worked well in all browsers. Then a few days ago I went to check it in all browsers before I took the project out of development and found that the application worked in Internet Explorer 9. The following error appeared in the console:

SCRIPT16389: Could not complete the operation due to error 8070000c. jquery.min.js, line 16 character 29366 

My javascript file is really long, but here are the important parts. All my actions are contained in the object that I created. Inside one of my methods, I have the following lines:

 var that = this; that.stop(); 

Here are all the methods that are called as a result of this method:

 this.stop = function(){ var that = this; console.log('stop called'); that.pause(); that.seek(0); that.isPlaying = false; console.log('stop finished'); }; this.pause = function(){ var that = this; console.log('pause called'); if(that.player == 'undefined' || that.player == null){ that.player = that.GetMediaObject(that.playerID); } that.player.pauseMedia(); //external interface call that.isPlaying = false; console.log('pause finished'); }; this.seek = function(seek){ var that = this; console.log('seek called'); if(that.player == 'undefined' || that.player ==null){ console.log("player="+that.player+". resetting player object"); that.player = that.GetMediaObject(that.playerID); console.log("player="+that.player); } that.player.scrubMedia(seek); //external interface call console.log('seek finished'); }; //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 this.GetMediaObject = function(playerID){ var mediaObj = swfobject.getObjectById(playerID); console.log('fetching media object: ' +mediaObj ); //if swfobject.getObjectById fails if(typeof mediaObj == 'undefined' || mediaObj == null){ console.log('secondary fetch required'); var isIE = navigator.userAgent.match(/MSIE/i); mediaObj = isIE ? window[playerID] : document[playerID]; } return mediaObj; }; 

Here is the output from my console.log entries:

 LOG: fetching media object: [object HTMLObjectElement] LOG: video-obj-1: ready LOG: stop called LOG: pause called LOG: pause finished LOG: seek called LOG: player=[object HTMLObjectElement] SCRIPT16389: Could not complete the operation due to error 8070000c. jquery.min.js, line 16 character 29366 

Interestingly, the first call to the external interface that.player.pauseMedia () does not have a problem, but the subsequent call to that.player.scrubMedia (0) fails. Another feature is that it points to jquery as the source of the error, but there is no jquery call in these functions.

That's what I don’t know. This is not a problem when my time is off. The last line of my ActionScript sends a message in javascript when the Flash object is fully loaded. In addition, I set the parameter "allowScriptAccess" to "always" so that it is not. The actionscript file that we use was used in previous projects, so I'm 90% sure that this is not a problem.

here is my actioncript. I did not write actioncript, and I am not too familiar with this language, but I tried to include those parts that seem to be most appropriate for my application:

 flash.system.Security.allowDomain("*.mydomain.com"); import flash.external.ExternalInterface; // variables to store local information about the current media var mediaEmbedServer:String = "www"; var mediaPlayerID:String; var mediaFile:String; var mediaDuration:Number; // variables to be watched by actionscript and message javascript on changes var mediaPositions:String = "0,0"; // buffer position, scrub position var mediaStatus:String; var netStreamClient:Object = new Object(); netStreamClient.onMetaData = metaDataHandler; netStreamClient.onCuePoint = cuePointHandler; var connection:NetConnection; var stream:NetStream; var media:Video = new Video(); // grab the media duration when it becomes available function metaDataHandler(info:Object):void { mediaDuration = info.duration; } function cuePointHandler(info:Object):void { } connection = new NetConnection(); connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); try { var paramName:String; var paramValue:String; var paramObject:Object = LoaderInfo(this.root.loaderInfo).parameters; for (paramName in paramObject) { paramValue = String(paramObject[paramName]); switch (paramName){ case "server": mediaEmbedServer = paramValue; break case "playerID": mediaPlayerID = paramValue; break } } } catch (error:Error) { } if (mediaEmbedServer == "dev" || mediaEmbedServer == "dev2"){ connection.connect("rtmp://media.developmentMediaServer.com/myApp"); } else { connection.connect("rtmp://media.myMediaServer.com/myApp"); } function securityErrorHandler(event:SecurityErrorEvent):void { trace("securityErrorHandler: " + event); } function connectStream():void { stream = new NetStream(connection); stream.soundTransform = new SoundTransform(1); stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); stream.client = netStreamClient; media.attachNetStream(stream); media.width = 720; media.height = 405; addChild(media); } function netStatusHandler(stats:NetStatusEvent){ switch (stats.info.code){ case "NetConnection.Connect.Success": connectStream(); break; case "NetConnection.Call.BadVersion": case "NetConnection.Call.Failed": case "NetConnection.Call.Prohibited": case "NetConnection.Connect.AppShutdown": case "NetConnection.Connect.Failed": case "NetConnection.Connect.InvalidApp": case "NetConnection.Connect.Rejected": case "NetGroup.Connect.Failed": case "NetGroup.Connect.Rejected": case "NetStream.Connect.Failed": case "NetStream.Connect.Rejected": case "NetStream.Failed": case "NetStream.Play.Failed": case "NetStream.Play.FileStructureInvalid": case "NetStream.Play.NoSupportedTrackFound": case "NetStream.Play.StreamNotFound": case "NetStream.Seek.Failed": case "NetStream.Seek.InvalidTime": // report error status and reset javascriptPlay clearInterval(progressInterval); messageStatus("error"); break; default: // check time through file to determine if media is over if (stream.time > 0 && stream.time >= (mediaDuration - .25)){ // reset media if it has ended clearInterval(progressInterval); stream.play(mediaFile, 0, 0); messageStatus("finished"); } } }; var progressInterval:Number; // respond to a play/pause request by playing/pausing the current stream function pauseMedia(){ clearInterval(progressInterval); if (mediaStatus == 'playing'){ stream.pause(); messageStatus("paused"); } }; ExternalInterface.addCallback( "pauseMedia", pauseMedia ); // respond to a scrub request by seeking to a position in the media function scrubMedia(newPosition){ clearInterval(progressInterval); if (mediaStatus == "playing"){ stream.pause(); messageStatus("paused"); } stream.seek(newPosition * mediaDuration); var positionSeconds = newPosition * mediaDuration; messagePositions(positionSeconds+","+positionSeconds); }; ExternalInterface.addCallback( "scrubMedia", scrubMedia ); ExternalInterface.call("MediaPlayerReady", mediaPlayerID); 
+3
source share
2 answers

Sounds like an undefined expando property that could be caused by jQuery IE9 error . The best way to debug it is to remove the userAgent test and replace it with checking on an object element, for example:

 document.getElementsByTagName("object")[0].outerHTML 

to find out if the identifier attribute changes after the first jQuery click.

0
source

I'm having a problem using JPEGCam, which also uses the external Flash interface. My control over the webcam dynamically loaded in the div and then threw this error in IE (not firefox or chrome). After moving the initialization of my flash control to document.ready on the parent page, then hiding / showing / moving the control if necessary, I was able to get around this exception.

Hope this helps.

0
source

Source: https://habr.com/ru/post/1435857/


All Articles