gpt4 book ai didi

html - 使用 VideoJS 播放器播放 RTMP 流

转载 作者:行者123 更新时间:2023-12-04 03:11:16 26 4
gpt4 key购买 nike

我正在尝试使用 VideoJS 播放器播放 RTMP 流,下面是我的代码:

<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: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media. MediaError {code: 4, message: "No compatible source was found for this media."}

错误很明显,但是有很多文档向人们展示了使用 VideoJS 播放 RTMP 流的成功案例:

我确信以下 URL 在 VLC 播放器上播放,在 JWPlayer 上播放也是如此:

rtmp://184.72.239.149/vod/mp4/BigBuckBunny_115k.mov

可能是什么问题?

最佳答案

如果你想播放 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>

关于html - 使用 VideoJS 播放器播放 RTMP 流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45146146/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com