HTTP流包括HTTP動(dòng)態(tài)流(HDS)和HTTP實(shí)時(shí)流(HLS)
要通過HTTP流向客戶端提供實(shí)時(shí)流,需要將流發(fā)布到Adobe Media Server上的HTTP Live Packager服務(wù)(rootinstall / applications / livepkgr)。
livepkgr服務(wù)會(huì)提取流,將其打包為片段,然后將片段實(shí)時(shí)交付給Flash和iOS客戶端
一、工具:Adobe Media Server 5(視頻服務(wù)器:鏈接:
https://pan.baidu.com/s/1PVmgzo7wtZEnPoIVOjZTXw 提取碼:bwfx)
二、發(fā)布和播放單個(gè)實(shí)時(shí)流
1、打開Flash Media Live Encoder rootinstall\conf\config.xml文件,將標(biāo)記flashmedialiveencoder_config/mbrconfig/streamsynchronization/enable設(shè)置為true:
2、將實(shí)時(shí)流發(fā)布到Adobe Media Server
Encoding Options面板,Preset的Video(打鉤狀態(tài))下的Format,選擇H.264,點(diǎn)擊旁邊扳手按鈕,
Keyframe Frequency(關(guān)鍵幀) 設(shè)置成4 或者 Applications/livepkgr/events/_definst_/liveevent/Event.xml文件中的4或<FragmentDuration>的倍數(shù)。<FragmentDuration>的默認(rèn)值為4000毫秒
AMS URL:rtmp://localhost/livepkgr(如果要給名需要把原來livepkgr里的文件拷貝)
Stream輸入livestream?adbe-live-event = liveevent(livestream是流名字)
3、播放:將samples\videoPlayer目錄復(fù)制到webroot中來,瀏覽器里面打開
http://localhost/videoPlayer/videoplayer.html,STREAM URL輸入:http://localhost/hds-live/livepkgr/_definst_/liveevent/livestream.f4m
4、網(wǎng)頁中播放:在webroot新建文件video.html,內(nèi)容如下:
!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<video src="/hls-live/livepkgr/_definst_/liveevent/livestream.m3u8" controls="controls" width="400" height="300"></video>
</body>
</html>
直接訪問這個(gè)頁面即可
5、如果再次推送以前已經(jīng)流,要?jiǎng)h除applications\livepkgr\events\_definst_\liveevent下的STREAM 文件和applications\livepkgr\streams\_definst_\下的流文件夾
6、注意所有的url都不能有空格,切記