|
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>video</title>
- <!--<script src="https://unpkg.com/flv.js/dist/flv.min.js"></script>-->
- <script src="https://cdn.jsdelivr.net/npm/flv.js@latest/dist/flv.min.js"></script>
- </head>
- <body>
- <div>
- <video id="my-player" preload="auto" muted autoplay type="rtmp/flv">
- <source src="">
- </video>
- </div>
- </body>
- </html>
- <script>
- // 获取video节点
- videoElement = document.getElementById('my-player');
- if (flvjs.isSupported()) {
- flvPlayer = flvjs.createPlayer({
- type: 'flv',
- isLive: true,
- url: 'http://mzgatznryeroierla1.anfangmart.cn/live/cx_374420.flv',//flv格式流地址
- },{
- enableWorker: false, //不启用分离线程
- enableStashBuffer: false, //关闭IO隐藏缓冲区
- reuseRedirectedURL: true, //重用301/302重定向url,用于随后的请求,如查找、重新连接等。
- autoCleanupSourceBuffer: true //自动清除缓存
- });
- flvPlayer.attachMediaElement(videoElement);
- flvPlayer.load(); //加载
- flvPlayer.play();//播放
- }
- </script>
复制代码
|
|