m3u8中的htm5视频src未在Chrome中播放

时间:2016-05-26 08:41:55

标签: javascript google-chrome streaming html5-video m3u8

我正在关注github:https://github.com/videojs/videojs-contrib-hls#getting-started并关注该帖子How to play html5 video play m3U8 on mobile and desktop?,以便在Chrome中播放m3u8。但我不明白为什么没有发生这种情况。我总是在媒体播放器上收到错误消息无效的来源。

<!DOCTYPE html>
<html>
<head>
    <title>Video</title>
    <meta charset="utf-8" />
    <style>
        body {
            background: brown;
            color: #CCCCCC;
        }
    </style>

    <script src="video.js"></script>
    <script src="videojs.hls.min.js"></script>
    <script>
    var player = videojs('example-video');
    player.play();
    </script>
</head>
<body>
    <video id=example-video width=960 height=540 class="video-js vjs-default-skin" controls>
  <source
     src="http://esioslive6-i.akamaihd.net/hls/live/202874/AL_P_ESP1_INTER_ENG/playlist_1000.m3u8"
     type="application/x-mpegURL">
</video>

</body>
</html>

这是目录。我从这里下载了videojs-contrib-hls和videojs - contrib-hls.min https://github.com/videojs/videojs-contrib-hls/releases

enter image description here

当我从chrome控制台检查时,我发现了我试图解决但失败的错误。 错误:

Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///C:/Users/MIC/Desktop/sss/videojs.hls.min.js Failed to load resource: net::ERR_FILE_NOT_FOUND
index.html:16 Uncaught ReferenceError: videojs is not defined

知道我做错了吗?

1 个答案:

答案 0 :(得分:0)

尝试使用js引用的完整路径:

在你的情况下,将是:

<script src="file:///C:/Users/MIC/Desktop/sss/video.js"></script>
<script src="file:///C:/Users/MIC/Desktop/sss/videojs.hls.min.js"></script>

并检查F12开发人员工具中的Network标签,以检查是否已加载js文件(资源)

相关问题