html5播放 m3u8

注意:m3u8地址要为网络地址,直接把代码复制为html直接在本地打开,可能不行,需要放在nginx或者apache或者其他的web服务器上运行。

DOCTYPE html>
<html>
<head>
    <meta charset=utf-8 />
    <title>测试播放m3u8title>
    <link href="https://cdn.bootcdn.net/ajax/libs/video.js/5.18.4/video-js.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/video.js/5.18.4/video.min.js">script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"
            type="text/javascript">script>
head>
<body>

<video id="videoPlayer" class="video-js" controls style="width:300px;height:300px;">
    <source src="http://192.168.0.101:8178/kbkbk/index.m3u8" type="application/x-mpegURL">
video>

<script>
    videojs('videoPlayer', {});
script>

body>
html>

你可能感兴趣的:(html5,javascript)