弹来弹去跑马灯!

JS播放m3u8

JS播放m3u8:

利用 hls.min.js

 

<!DOCTYPE html>
<html>
<head>
    <title>HLS Video Playback</title>
</head>
<body>
    <video id="video" controls></video>
 
    <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
    <script>
        var video = document.getElementById('video');
        var hls = new Hls();
 
        hls.loadSource('https://yourdomain.com/path/to/your/video.m3u8');
        hls.attachMedia(video);
        hls.on(Hls.Events.MANIFEST_PARSED, function() {
            video.play();
        });
    </script>
</body>
</html>

  

posted @ 2024-09-02 09:46  wgscd  阅读(35)  评论(0编辑  收藏  举报