去年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::SignalAttachedToInStream(),I added the?
following code after stream begin to allow Video samples:?
+????????//XXX. notify |RtmpSampleAccess?
+ ? ?/*?
+????????message = StreamMessageFactory::GetNotifyRtmpSampleAccess(?
+????????????????????????_pChannelVideo->id,_rtmpStreamId,absoluteTimestamp,false,true,?
true);?
+????????TRACK_MESSAGE("Message:n%s",STR(message.ToString()));?
+????????if (!_pRTMPProtocol->SendMessage(message)) {?
+????????????????FATAL("Unable to send message");?
+????????????????_pRTMPProtocol->EnqueueForDelete();?
+????????????????return false;?
+????????}?
+ ?*/?
+?
Also in the same method,changed the same call for the audio channel:?
? ? //10. notify |RtmpSampleAccess?
? ? message = StreamMessageFactory::? ? ? ? _pChannelAudio->id,true);?
? ? TRACK_MESSAGE("Message:n%s",34); font-size:13px">? ? 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",34); font-size:13px">? ? ? name="flvplayback",34); font-size:13px">? ? ? protocol="dynamiclinklibrary",34); font-size:13px">? ? ? aliases=?
? ? ? {?
? ? ? ? "simpleLive",34); font-size:13px">? ? ? ? "vod",34); font-size:13px">? ? ? ? "live",34); font-size:13px">? ? ? ? "WeeklyQuest",34); font-size:13px">? ? ? ? "SOSample",34); font-size:13px">? ? ? ? "oflaDemo",34); font-size:13px">? ? ? },34); font-size:13px">? ? acceptors =?
? ? ? ? {?
? ? ? ? ? ip="0.0.0.0",34); font-size:13px">? ? ? ? ? port=1935,34); font-size:13px">? ? ? ? ? protocol="inboundRtmfp"?
? ? ? ? },34); font-size:13px">? ? ? ? ? port=6666,34); font-size:13px">? ? ? ? ? protocol="inboundLiveFlv",34); font-size:13px">? ? ? ? ? waitForMetadata=true,34); font-size:13px">? ? ? ? ? port=9999,34); font-size:13px">? ? ? ? ? protocol="inboundTcpTs"?
? ? ? ? --[[{?
? ? ? ? ? port=554,34); font-size:13px">? ? ? ? ? protocol="inboundRtsp"?
? ? ? externalStreams =?
? ? ? validateHandshake=true,34); font-size:13px">? ? ? keyframeSeek=true,34); font-size:13px">? ? ? seekGranularity=1.5,--in seconds,between 0.1 and 600?
? ? ? clientSideBuffer=12,between 5 and 30?
? ? ? allowVideoSampleAccess=true,34); font-size:13px">? ? ? allowAudioSampleAccess=true,34); font-size:13px">? ? },34); font-size:13px">A big thanks for pointing me in the right direction!?
上面是那位外国仁兄解决办法:特此记录下(就是把上面加粗的代码放到你的视频服务器代码中,具体我不清楚,我不会C++)
剩下最后一个 视频录像的功能了,唉不知道怎么实现