我尝试使用RTMP
播放器播放VideoJS
流,下面是我的代码:
<head>
<link href="http://vjs.zencdn.net/6.2.0/video-js.css" rel="stylesheet">
<!-- If you'd like to support IE8 -->
<script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>
<body>
<video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup='{"techorder" : ["flash"]}'>
<source src="rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov" type="rtmp/mp4">
<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>
<script src="http://vjs.zencdn.net/6.2.0/video.js"></script>
</body>
我看到的错误是:
VIDEOJS:错误:(代码:4 MEDIA_ERR_SRC_NOT_SUPPORTED)未找到此媒体的兼容来源。 MediaError {code:4,message:&#34;找不到此媒体的兼容来源。&#34;}
错误非常明显,但有很多文档向人们展示了使用RTMP
播放VideoJS
信息流的成功故事:
我确信以下网址确实在VLC
播放器上播放,JWPlayer
也是如此:
rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov
可能是什么问题?
答案 0 :(得分:1)
如果你想玩RTMP
,你必须包含可以从这里检索到的flash-tech
:
https://github.com/videojs/videojs-flash
因此正确的代码就是这样:
<head>
<link href="http://vjs.zencdn.net/6.2.0/video-js.css" rel="stylesheet">
<!-- If you'd like to support IE8 -->
<script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>
<body>
<video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup='{"techorder" : ["flash"]}'>
<source src="rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov" type="rtmp/mp4">
<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>
<script src="http://vjs.zencdn.net/6.2.0/video.js"></script>
<script src="/videojs-flash.js"></script>
</body>