0 Replies Latest reply: Jan 16, 2012 10:17 AM by DeveloperNamedAri RSS

    External interface and Internet Explorer Issue

    DeveloperNamedAri Community Member

      Hello,

       

      I am working on a video player that uses Flash for playback and html/javascript for the controls.   I use external interface to facilitate the communication between the flash and javascript.  The player works fine in Firefox, Safari and Chrome,  but (surprise, surprise) it fails in Internet Explorer 9.  Here is the basic idea.  There is an element on the page, which is supposed to stop the current video.  In my logic, a stop can be reduced to 2 external interface callbacks:  the video pauses, and the video seeks to the begining of the video.  The first step (the pause), works without a hitch.  The second step fails.  The error that pops into the IE Developer Console is, "SCRIPT16389: Could Not Complete the Operation Due To Error 8070000c." 

       

       

      Here are the important parts of my code:

       

      /////////////////////////////////////JAVASCRIPT/////////////////////////////////////////// /

       

      this.stop = function(){

           var that = this;

       

           console.log('stop called');

           that.pause();

           that.seek(0);

       

           console.log("stop called");
      }

       

      this.pause = function(){

           var that this;

       

           console.log('pause called');

           if(that.player == 'undefined' || that.player == null){

                that.player = MPX.GetMediaObject('that.playerID');    

           }

       

           that.player.pauseMedia();

           consol.log('pause finished');

      }

       

      this.seek = function(seek){

           var that = this;

       

           console.log("seek called");

           if(that.player == 'undefined' || that.player ==null){

                that.player = MPX.GetMediaObject('that.playerID');

           }

       

           that.player.scrubMedia(seek);

           console.log('seek finished');

      }

       

       

      MPX.GetMediaObject = function (playerID){

           var mediaObj = swfobject.getObjectByid(playerID);

           console.log('fetching media obect: '+mediaObj);

           if(typeof mediaObj == 'undefined' || mediaObj == null){

                console.log('first fet failed.  secondary fetch required');

                var isIE = navigator.userAgent.match(/MSIE/i);

                mediaObj = isIE ? window[playerID] : document[playerID];

           }

       

           return mediaObj;

      }

       

       

      ////////////////////////////////////////////////////////////////////////////////////////// //

       

      The interesting thing about this is that the first call to External Interface works fine, but the second call is what fails.  I don't know if this is because in the second call i am passing a variable or if something is breaking between my first and second call.  Here is the declaration of the external callbacks in the .fla file:

       

      ///////////////////////////////////////ACTIONSCRIPT 3///////////////////////////////////

       

      import flash.external.ExternalInterface;

       

      function pauseVideo(){

           clearInterval(progressInterval);

           if (videoStatus == 'playing'){

                stream.pause();

                messageStatus("paused");

           }

      };

       

      ExternalInterface.addCallback( "pauseVideo", pauseVideo );

       

      function scrubVideo(newPosition){

           clearInterval(progressInterval);

           if (videoStatus == "playing"){

                stream.pause();

                messageStatus("paused");

           }

           stream.seek(newPosition * videoDuration);

           var positionSeconds = newPosition * videoDuration;

           videoPositions = positionSeconds+","+positionSeconds;

      };

      ExternalInterface.addCallback( "scrubVideo", scrubVideo );

       

      ////////////////////////////////////////////////////////////////////////////////////////// ////

       

      I would love a solution to this, but will settle for a way to debug the issue.

       

      Thanks In Advanced,

       

      Ari Amiri