我试图在我的IOS AIR应用中加载电影预告片。当我尝试使用计算机但视频无法在Apple设备上播放时,它可以正常工作。
在我的计算机上,视频正在播放,但此消息显示在输出中:
*** Security Sandbox Violation ***
SecurityDomain 'https://s.ytimg.com/yts/swfbin/player-vflm0X9AB/watch_as3.swf' tried to access incompatible context 'app:/Iphone3.swf'
Warning: Domain i.ytimg.com does not explicitly specify a meta-policy, but Content-Type of policy file https://i.ytimg.com/crossdomain.xml is 'text/x-cross-domain-policy'. Applying meta-policy 'by-content-type'.
这是我的代码:
urlTrailer = "https://www.youtube.com/v/"+item.trailer+"?gl=BE&version=3";
// item.trailer is the videoID of the YoutubeVideo
function showTrailer():void {
var loader:Loader = new Loader();
var player:Object;
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest(urlTrailer));
function onLoaderInit(event:Event):void {
addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
loader.content.addEventListener("onError", onPlayerError);
loader.content.addEventListener("onStateChange", onPlayerStateChange);
loader.content.addEventListener("onPlaybackQualityChange",
onVideoPlaybackQualityChange);
}
function onPlayerReady(event:Event):void {
// Event.data contains the event parameter, which is the Player API ID
trace("player ready:", Object(event).data);
player = loader.content;
player.y=200;
player.setSize(480, 360);
}
我已尝试添加我的xml文件:
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
但我仍然有错误Security Sandbox Violation
您认为可能是什么问题,我该如何解决?
答案 0 :(得分:0)
尝试以下内容:(如果它不起作用,请尝试我的其他 Answer code link )
function onLoaderInit(event:Event):void
{
//addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
loader.content.addEventListener("onError", onPlayerError);
loader.content.addEventListener("onStateChange", onPlayerStateChange);
loader.content.addEventListener("onPlaybackQualityChange",
onVideoPlaybackQualityChange);
}
function onPlayerReady(event:Event):void
{
// Event.data contains the event parameter, which is the Player API ID
trace("player ready:", Object(event).data);
player = loader.content;
player.y=200;
player.setSize(480, 360);
//# Alt method for adding to stage...
//loader.width = 320; loader.height = 240;
//loader.x = 30; loader.y = 100;
addChild(loader);
}