我的问题是:
SecurityError: Error #2060: Naruszenie obszaru izolowanego: element wywołujący ExternalInterface http://www.jplayer.org/latest/js/Jplayer.swf nie może uzyskać dostępu do null.
at flash.external::ExternalInterface$/_evalJS()
at flash.external::ExternalInterface$/call()
at Jplayer/init()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
为什么相同的代码在远程服务器上运行(如jsfiddle),但本地文件会抛出错误?
如何在本地计算机上运行此代码?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Play a Shoutcast stream - jsFiddle demo</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript' src="http://www.jplayer.org/latest/js/jquery.jplayer.min.js"></script>
<script type='text/javascript'>//<![CDATA[
$(function(){
$("#jquery_jplayer_1").jPlayer({
swfPath: "Jplayer.swf",
ready: function () {
$(this).jPlayer("setMedia", { mp3: "http://94.23.108.1:8018/;stream/1" });
},
supplied: "mp3"
});
});//]]>
</script>
</head>
<body>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
</ul>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar">
</div>
</div>
</div>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value">
</div>
</div>
<div class="jp-current-time">
</div>
<div class="jp-duration">
</div>
<ul class="jp-toggles">
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
</ul>
</div>
<div class="jp-title">
<ul>
<li>Testing</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span> To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
阅读this post后,我发现解决方案是:
预览
http://localhost而不是file://您可以在localhost而不是文件系统上查看这些文件,方法是更改以下,