去年11月份開始來到這家新公司,做視訊監控的
而我負責做web觀看端,之前是說視訊播放用flash來做,然後界面的話直接用原生的html
後來就溫習了css js jq ajax...... 還有dwr
也做了一個類似的小demo出來,當然沒什麼功能,隻能播放rtmp視訊流而已
後來今年回來說都用flex做,到現在3 、4個月了,功能差不多實作了
還差一個視訊截圖加一個視訊錄像的功能,昨天開始做截圖,網上找方法,還挺簡單的
但是應用到視訊截圖就報錯了:
securityerror: error #2123: 安全沙箱沖突:bitmapdata.draw:
xxx 不能通路 rtmp://xxxxx。未被授權通路任何政策檔案。
網上也很多人遇到這個問題,說的方法但是都沒有解決我的問題
由于我們的視訊伺服器是用crtmpserver,網上的解決辦法大多是fms的
就在今天中午,無意間再次谷歌了下錯誤,找到一個人跟我的一模一樣的實作方式,和同樣的錯誤
我把解決辦法摘抄上來
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::getnotifyrtmpsampleaccess(
_pchannelaudio->id, _rtmpstreamid, 0, true, true, true);
track_message("message:\n%s", str(message.tostring()));
if (!_prtmpprotocol->sendmessage(message)) {
fatal("unable to send message");
_prtmpprotocol->enqueuefordelete();
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"
},
port=6666,
protocol="inboundliveflv",
waitformetadata=true,
port=9999,
protocol="inboundtcpts"
--[[{
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++)
剩下最後一個 視訊錄像的功能了,唉不知道怎麼實作