Videojs和rtmp流媒体

时间:2017-02-20 13:20:20

标签: video video.js

嘿我使用videojs来显示某些视频,一些需要显示的视频是rtmp流媒体。

我正在尝试使用以下配置来运行视频,但没有运气。 这类视频是否需要某些插件?

这是我迄今取得的成就:

<link href="http://vjs.zencdn.net/5.0.2/video-js.css" rel="stylesheet">
    <script src="http://vjs.zencdn.net/ie8/1.1.0/videojs-ie8.min.js"></script>
    <script src="http://vjs.zencdn.net/5.0.2/video.js"></script>
    
  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="http://vjs.zencdn.net/v/oceans.png" data-setup="{}">
    <source src="rtmp://aljazeeraflashlivefs.fplive.net/aljazeeraflashlive-live/aljazeera_ara_high" type="rtmp/mp4">
    <track kind="captions" src="../shared/example-captions.vtt" srclang="en" label="English"></track>
    <!-- Tracks need an ending tag thanks to IE9 -->
    <track kind="subtitles" src="../shared/example-captions.vtt" srclang="en" label="English"></track>
    <!-- Tracks need an ending tag thanks to IE9 -->
    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
  </video>

VideoJS是否支持rtmp流媒体,根据文档说它支持Flash视频(包括rtmp?)

我已将视频类型更改为rtmp / mp4即可?

如果我使用的是vlc或vlc插件,那么我可以运行以下视频: RTMP://aljazeeraflashlivefs.fplive.net/aljazeeraflashlive-live/aljazeera_ara_high

2 个答案:

答案 0 :(得分:1)

我在项目中使用了它

<head>
<link href="https://vjs.zencdn.net/7.6.6/video-js.css" rel="stylesheet" />
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<title>Stream PAGE</title>
<!-- This style is clearly not needed but yolo  -->
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>   
<body>
<h1>What you want</h1>
<video id="player" class="video-js vjs-default-skin" width="800" height="440"  controls preload="none">
<source src="http://192.168.205.1:9000/1234.m3u8" type="application/x-mpegURL" />
</video>
<script>
var player = videojs('#player')
</script>

答案 1 :(得分:0)

不要忘记将您的源类型更改为:type =“application / x-mpegURL”/&gt;如果它是m3u8