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