2017-03-07 271 views
0

我正在嘗試視頻js player中的rtmp url,但它不起作用。如何在網絡瀏覽器中播放rtmp直播流?

在視頻js中,我們必須在源文件中給出類型(application/x-mpegURL | video/mp4)。

<video id="wiPlayer" class="video-js vjs-default-skin" 
       controls codecs="avc1.4D401E, mp4a.40.2" preload="auto" width="1200" height="400" poster="<?=$post->screenShotUrl?>" 
       data-setup='{"aspectRatio":"640:320", "autoplay": true, "controlBar": {"fullscreenToggle": true, "progressControl": true}}'> 
<p class="vjs-no-js">We're sorry, but your browser doesn't support Video</p> 
</video> 

的js代碼是

player = videojs('wiPlayer'); 
     player.src({ 
       src: stream_url, 
       type: mPlayerType,// "video/mp4",//application/x-mpegURL 
       useCueTags: true 
       }); 
     window.onOrientation(player, 'wiPlayer'); 
     player.play(); 

我的網址是這樣的:

rtmp://vid-11239002.pull.usnecenter.broadcastapp.agora.cn/live/public1265537 

我怎麼能起到這樣的視頻直播JS流網址嗎?或者我們有其他解決方案嗎?

回答

0

RTMP的類型是rtmp/mp4rtmp/flv。這隻適用於具有Flash的瀏覽器。