rtmp 视频流在截图时出现沙箱问题 “Security sandbox violation: BitmapData.draw”
来源:互联网 发布:淘宝标题组合公式 编辑:程序博客网 时间:2024/04/30 01:30
原文:http://www.shell-tips.com/2009/08/30/flash-how-to-fix-the-security-sandbox-violation-bitmapdata-draw/
这个只在自己架设 rtmp 服务器的情况下可以改服务器配置文件...但 P2P 情况下的截图还是会出现沙箱问题. rtmfp://p2p.rtmfp.net/ 是adobe的.貌似没有开放这个权限.估计也不太可能开放.看以后有没有可能自己架设 Cirrus service 了地址http://labs.adobe.com/technologies/cirrus/
The “Security sandbox violation” message is a common problem for any Flash developer who try to do a Snapshot of an RTMP Stream. There was a couple of workaround but they stopped working since Flash Player 9.0.115 as it was considered as a possible bug. So, now how to do a proper snapshot of an RTMP stream ? The answer is simple but you’ll need to have the control on the streaming server, whatever it is FMS or Red5.
Flash use a non documented part of the RTMP protocol. When the client connect to an RTMP stream, the server send a packet that will indicate to the client if it can allow access to the bitmap data (pixels) or/and the raw audio data.
Fix with FMS
I think what is working here for FMS is also working for Wowza servers but I never tried. To fix your problem with Flash Media Server, you can add this two simple line of code inside the application.onConnect function :
appClient.audioSampleAccess =
"/"
;
appClient.videoSampleAccess =
"/"
;
It seem that you can also just edit your application.xml file to add the following inside the Application node :
<
AudioSampleAccess
enabled=”true”>/</
AudioSampleAccess
>
<
VideoSampleAccess
enabled=”true”>/</
VideoSampleAccess
>
Beaware that using “/” will allow snapshot on all your streams, you can restrict it accordingly to your needs.
Fix with Red5
On last April I posted a patch to Red5 community that let you handle the problem in the same way that FMS does (Ticket#APPSERVER-315#498). So, to let your client access the stream, you will need to edit the red5-web.xml of your application :
<
bean
id
=
"rtmpSampleAccess"
class
=
"org.red5.server.stream.RtmpSampleAccess"
>
<
property
name
=
"audioAllowed"
value
=
"true"
/>
<
property
name
=
"videoAllowed"
value
=
"true"
/>
</
bean
>
All the Red5 project is designed to use beans which make this application quite flexible. So, in the same way, you can implement your own class and add every security check you want before allowing the access to your RTMP streams. All you need to do is implementing a new class with the IRtmpSampleAccess interface and create a bean using your class.
Even with those changes, you could still get the error message if the stream buffer is empty. So be sure to use a proper try/catch in your client application and also to listen for the “NetStatusEvent.NET_STATUS” event. You can start capturing data when the NET_STATUS event return an event.info.code as “NetStream.Buffer.Full” and stop capturing data on “NetStream.Buffer.Empty”.
- rtmp 视频流在截图时出现沙箱问题 “Security sandbox violation: BitmapData.draw”
- SecurityError: Error #2135: Security sandbox violation: BitmapData.draw: _ cannot access _. RTMP content cannot be accessed usin
- Cumulus RTMFP实现P2P视频流如何调用BitMapData.draw()进行截图?
- [AS3] 解决BitmapData.draw()安全沙箱问题!
- SecurityError: Error #2123: 安全沙箱冲突,对NetStream使用BitmapData.draw()时出现的
- 对rtmp、NetStream.appendBytes() 使用BitmapData.draw()提示跨域问题的解决办法
- Fixing security sandbox violation in Flash AS3
- 解决SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller的异常问题
- BitmapData.draw
- bitmapdata,draw
- bitmapdata.draw方法与负坐标部分截图
- swfloader 的 SecurityError: Error #2122: Security sandbox violation
- videojs rtmp 视频显示在左上角问题
- bitmapData.draw()遇到的小问题以及解决方法
- BitmapData draw函数使用
- 出现security ioError 安全沙箱问题
- bitmapdata.draw bug 一枚
- bitmapdata.draw bug 一枚
- SVM台湾林智仁教授开发libSVM
- flashplayer 10 的 p2p 基础
- mysql1364
- memcached全面剖析–2.理解memcached的内存存储
- ubuntu ftp服务 开启
- rtmp 视频流在截图时出现沙箱问题 “Security sandbox violation: BitmapData.draw”
- View编程(6): 自定义View_02_ApiDemo源码研究
- 为了避免无法确定该调用的构造函数而需将main函数设为先于类的构造而执行,故将其声明为static
- Ogre 的基于Texture的阴影有时会不正常的原因
- android 客户端访问服务器端
- memcached全面剖析–3.memcached的删除机制和发展方向
- 【原创】从游戏1秒/XX帧说起
- php开发时web服务器Apache Service Monitor Start按鈕变灰的解决方法
- GridView 与Label DropDownList 控件 相结合