首页 > 代码库 > FLEX 截图crtmpserver服务器的rtmp流视频报 SecurityError: Error #2123
FLEX 截图crtmpserver服务器的rtmp流视频报 SecurityError: Error #2123
去年11月份开始来到这家新公司,做视频监控的
而我负责做WEB观看端,之前是说视频播放用flash来做,然后界面的话直接用原生的HTML
后来就温习了CSS js jq ajax...... 还有dwr
也做了一个类似的小Demo出来,当然没什么功能,只能播放rtmp视频流而已
后来今年回来说都用Flex做,到现在3 、4个月了,功能差不多实现了
还差一个视频截图加一个视频录像的功能,昨天开始做截图,网上找方法,还挺简单的
但是应用到视频截图就报错了:
SecurityError: Error #2123: 安全沙箱冲突:BitmapData.draw: XXX 不能访问 rtmp://XXXXX。未被授权访问任何策略文件。
网上也很多人遇到这个问题,说的方法但是都没有解决我的问题
由于我们的视频服务器是用Crtmpserver,网上的解决办法大多是FMS的
就在今天中午,无意间再次谷歌了下错误,找到一个人跟我的一模一样的实现方式,和同样的错误
https://groups.google.com/forum/#!msg/c-rtmp-server/aACuxdF0Azw/mzkphlQHYeoJ
我把解决办法摘抄上来
That worked beautifully, though I had to do a little more work then
that.
in void BaseOutNetRTMPStream::
following code after stream begin to allow Video samples:
+ //XXX. notify |RtmpSampleAccess
+ /*
+ message = StreamMessageFactory::
+ _
true);
+ TRACK_MESSAGE("
+ if (!_pRTMPProtocol->SendMessage(
+ FATAL("Unable to send message");
+ _
+ return false;
+ }
+ */
+
Also in the same method, changed the same call for the audio channel:
//10. notify |RtmpSampleAccess
message = StreamMessageFactory::
_pChannelAudio->id, _rtmpStreamId, 0, true, true, true);
TRACK_MESSAGE("Message:\n%s", STR(message.ToString()));
if (!_pRTMPProtocol->SendMessage(
FATAL("Unable to send message");
_pRTMPProtocol->
return;
}
This works perfectly to get Flash BitmapData.draw() to work on the
RTMP stream. I suggest this be integrated as a configuration option to
each application so it would be possible to do something like from the
app configuration:
{
description="FLV Playback Sample",
name="flvplayback",
protocol="dynamiclinklibrary",
aliases=
{
"simpleLive",
"vod",
"live",
"WeeklyQuest",
"SOSample",
"oflaDemo",
},
acceptors =
{
{
ip="0.0.0.0",
port=1935,
protocol="inboundRtmfp"
},
{
ip="0.0.0.0",
port=6666,
protocol="inboundLiveFlv",
waitForMetadata=http://www.mamicode.com/true,
},
{
ip="0.0.0.0",
port=9999,
protocol="inboundTcpTs"
},
--[[{
ip="0.0.0.0",
port=554,
protocol="inboundRtsp"
},]]--
},
externalStreams =
{
validateHandshake=true,
keyframeSeek=true,
seekGranularity=1.5, --in seconds, between 0.1 and 600
clientSideBuffer=12, --in seconds, between 5 and 30
allowVideoSampleAccess=true,
allowAudioSampleAccess=true,
},
A big thanks for pointing me in the right direction!
上面是那位外国仁兄解决办法:特此记录下(就是把上面加粗的代码放到你的视频服务器代码中,具体我不清楚,我不会C++)
剩下最后一个 视频录像的功能了,唉不知道怎么实现