【问题标题】:htm5 video src in m3u8 is not playing in Chromem3u8 中的 htm5 视频 src 无法在 Chrome 中播放
【发布时间】:2016-05-26 08:41:54
【问题描述】:

我正在关注 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.minhttps://github.com/videojs/videojs-contrib-hls/releases

此外,当我从 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

知道我哪里做错了吗?

【问题讨论】:

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


    【解决方案1】:

    尝试使用 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 文件(资源)

    【讨论】:

      猜你喜欢
      • 2012-01-06
      • 1970-01-01
      • 2016-12-17
      • 1970-01-01
      • 1970-01-01
      • 2014-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多