[AS3] 解決BitmapData.draw()在fms流的跨域問題
因為flash的跨域問題, 會導致BitmapData.draw() 方法在對有跨域加載的視頻流, 圖片等資源時拋出SecurityError異常導致無法正常抓圖
解決方式在幫助文檔也有說, 總結一下:
1.圖片跨域
在被加載圖片域放置crossdomain.xml
load(new URLRequest(path), new LoaderContext(true));
2.點播流(http視頻流)
在被加載視頻域放置crossdomain.xml
設置netStream.checkPolicyFile = true;
3.實時流跨域
這個要在FlashPlayer 9.0.115.0才有效
方法來源于:
http://www.ekameleon.net/blog/index.php?2008/02/20/93--fmis3-bitmapdatadraw-and-flash-player-901150-security-sandbox-violation
我只做了fms3下的測試通過.
簡單點說就是在fms應用的main.asc 中加上
application.onConnect = function( client )
{
// fix Security sandbox violation : BitmapData.draw on RTMP source
client.videoSampleAccess = "/";
this.acceptConnection(client) ;
}
解決方式在幫助文檔也有說, 總結一下:
1.圖片跨域
在被加載圖片域放置crossdomain.xml
load(new URLRequest(path), new LoaderContext(true));
2.點播流(http視頻流)
在被加載視頻域放置crossdomain.xml
設置netStream.checkPolicyFile = true;
3.實時流跨域
這個要在FlashPlayer 9.0.115.0才有效
方法來源于:
http://www.ekameleon.net/blog/index.php?2008/02/20/93--fmis3-bitmapdatadraw-and-flash-player-901150-security-sandbox-violation
我只做了fms3下的測試通過.
簡單點說就是在fms應用的main.asc 中加上
application.onConnect = function( client )
{
// fix Security sandbox violation : BitmapData.draw on RTMP source
client.videoSampleAccess = "/";
this.acceptConnection(client) ;
}