首页 前端知识 html5播放flv视频

html5播放flv视频

2024-05-28 09:05:06 前端知识 前端哥 504 312 我要收藏

参考:flv-h265 - npmHTML5 FLV Player. Latest version: 1.7.0, last published: 6 months ago. Start using flv-h265 in your project by running `npm i flv-h265`. There are no other projects in the npm registry using flv-h265.icon-default.png?t=N7T8https://www.npmjs.com/package/flv-h265 本地安装也可以:

npm i -S flv.js
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title> flvjs Demo</title>
</head>

<body>
    <video id="videoElement" class="video-js" controls muted autoplay>
    </video>
    <script src="https://cdn.bootcdn.net/ajax/libs/flv.js/1.6.2/flv.js"></script>


    <script>
        if (flvjs.isSupported()) {
            var videoElement = document.getElementById('videoElement');
            var flvPlayer = flvjs.createPlayer({
                type: 'flv',
                url: 'https://rivermap-file.oss-cn-hangzhou.aliyuncs.com/video/flv/test.flv'
            });
            flvPlayer.attachMediaElement(videoElement);
            flvPlayer.load();
            flvPlayer.play();
        }
    </script>
</body>

</html>

转载请注明出处或者链接地址:https://www.qianduange.cn//article/9883.html
标签
音视频
评论
发布的文章

JQuery中的load()、$

2024-05-10 08:05:15

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!