English 中文(简体)
外部接口和因特网探索者 9 问题
原标题:External interface and Internet Explorer 9 issue

Boy-oh-boy确实是我仇视外部界面的。 我有录像机,利用外部接口控制闪点,使闪点能够把电灯传递给同一个javascript。 一段时间以来,它在所有浏览器中运作良好。 几天前,我开始对所有浏览器进行测试,然后才把该项目转移到发展之外,发现互联网探索者的申请已经中断。 9.9 以下错误出现在哥尔:

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

我的javascript案卷确实很长,但这里是重要的部分。 我的所有行动都载于我制造的物体。 在我的方法中,我有以下几条:

var that = this;
that.stop();

这里是采用这种方法而采用的所有方法:

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;
};

这里是我奥列的产物。 标识:

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

有趣的是,第一种外部接口似乎称,play商.pauseMedia(Media)没有问题,但随后对该点发出的呼吁失败了。 另一个奇怪之处是,它把que为错误的源头,但没有人要求 j忙履行这些职能。

这里我知道的是什么。 这不是我时机已经结束的问题。 我行动说明的最后一条线在闪点完全装满时向 j发送了信息。 并且,如果确定参数,便能够永远做到,而不是这样。 我们在以前的项目中使用的行动文件,即90%肯定不是问题。

我在此阐述我的行动路线。 我写了行动说明,我不熟悉语言,但我试图把与我的申请似乎最相关的部分列入:

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 s 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);   
问题回答

http://msdn.microsoft.com http://bugs.jquery.com/ticket/8485“rel=“nofollow” Query IE9 bug。 进行欺骗的最佳办法是取消用户剂测试,代之以对物体成分的检查,例如:

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

查看ID属性是否在被j Query第一次点击后发生变化。

我在使用JPEGCam时有这一问题,后者也使用闪电线的外部接口。 我的网络运动控制正在四分五花八门地装上,然后将这一错误扔到IE(而不是燃烧或hr)。 在把我的闪电控制的最初化变成文件之后。 在母体网页上准备好,然后根据需要躲藏/how弃控制,即能够围绕这一例外开展工作。

希望会有所帮助。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签