我正在尝试在一个基于Flex4的项目中使用Youtube Chromeless Player (新的AS3版本)。我正在使用谷歌的examples provided,但我没有任何运气。播放器加载,但无法与其交互。鼠标停留在播放器上时,我收到了重复的安全错误:
*** Security Sandbox Violation ***
SecurityDomain 'http://www.youtube.com/apiplayer?version=3' tried to access
incompatible context 'file:///Users/jbuhler/Sites/YoutubeTests/bin-debug/YoutubeTest.html'在加载播放器之前,我尝试将Security.allowDomain("www.youtube.com");添加到我的creationComplete处理程序中,但仍然收到相同的错误。
我也尝试过像这样使用SWFLoader:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
initialize="onInit()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private function onInit ():void
{
Security.allowDomain("www.youtube.com");
}
]]>
</fx:Script>
<mx:SWFLoader source="http://www.youtube.com/apiplayer?version=3" />
</s:Application>我已经这样做了几个小时了,但没有任何成功。我似乎也在网上找不到任何可用的例子。这个新播放器是不是和Flex4不兼容?
发布于 2010-09-24 17:08:53
我认为错误来自YouTube,请看我的答案:How to avoid Security Errors when using the Youtube AS3 Player API
发布于 2010-07-08 05:19:43
您是否可以尝试从某个web服务器通过HTTP访问您的SWF?在本地运行一次可能会成功,当然也可以在远程运行一次。当通过YouTube :// URI方案访问SWF时,可能会出现安全上下文问题(对于file Player API和许多其他外部SWF也是如此)。
https://stackoverflow.com/questions/3189659
复制相似问题