2

我正在尝试在视频对象上使用 BitmapData.draw(),但使用的是 OSMF 框架。

我的托管服务设置了以下内容,以便我可以访问我的 rtmp 视频:

<VideoSampleAccess enabled="true">/</VideoSampleAccess>  

简化代码如下:

_videoURL = "my-url-here"       
resource = new StreamingURLResource(_videoURL);
videoElement = new VideoElement(resource);          
_player.media = videoElement; 
container.addMediaElement(videoElement);
_player.autoPlay = true;
_player.play();

// later on, pause the player at the end
_player.pause();
// get the Video object
videoObj = _player.displayObject as Video;
// detach the netstream
videoObj.attachNetStream(null);

// get the bitmap from the Video object and draw on it..
bmpdata:BitmapData = new BitmapData(videoObj);

 bmpdata.draw()

但是,我收到以下错误消息:

SecurityError: Error #2135: Security sandbox violation: BitmapData.draw: ...
4

2 回答 2

2

If you are streaming from Adobe Media Server the parameter needs to be set server side http://www.shell-tips.com/2009/08/30/flash-how-to-fix-the-security-sandbox-violation-bitmapdata-draw/ I came across this when I attempted to create a reflection of the video stream under the video player. Most CDN's will allow you to customize your media server application code... If not you need to change CDN's or switch to progressive playback

于 2010-11-05T23:04:16.470 回答
0

您可以尝试绘制容器而不是视频对象本身。draw 方法的源可以是 Bitmap 或 DisplayObject 类型,因此添加视频的任何 MovieClip 或 Sprite 都应该是可绘制的。

编辑:你是对的,并没有真正考虑,如果存在安全问题,绘制容器不会有太大变化......

你可以试试这个:

导入 flash.system.Security;

Security.loadPolicyFile('policyfileURL');
于 2010-09-14T17:20:05.960 回答