使用 OSMF 在流媒体 (RTMP) .f4v 上使用 BitmapData.draw()

发布于 2024-09-18 23:27:47 字数 906 浏览 3 评论 0原文

我正在尝试在视频对象上使用 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: ...

I am trying to use BitmapData.draw() on a video object, but using the OSMF framework.

My hosting service has set up the following so that I can access my rtmp video:

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

Simplified code is as follows:

_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()

However, I am getting the following error message:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

庆幸我还是我 2024-09-25 23:27:47

如果您从 Adob​​e Media Server 进行流式传输,则需要在服务器端设置参数
http://www.shell-tips.com/2009/08/30/flash-how-to-fix-the-security-sandbox-violation-bitmapdata-draw/
当我尝试在视频播放器下创建视频流的反射时,我遇到了这个问题。大多数 CDN 允许您自定义媒体服务器应用程序代码...如果不允许,您需要更改 CDN 或切换到渐进式播放

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

徒留西风 2024-09-25 23:27:47

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

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

你可以尝试这个:

import flash.system.Security;

Security.loadPolicyFile('policyfileURL');

You could try drawing the container instead of the video object itself. The source for the draw method can be either of type Bitmap or DisplayObject , so any MovieClip or Sprite that adds your video should be drawable.

Edit:
You're right, wasn't really thinking ,if there's a security issue, drawing the container won't change much...

You could try this:

import flash.system.Security;

Security.loadPolicyFile('policyfileURL');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文