有人可以帮我用videojs播放器播放这个视频

时间:2017-09-15 23:21:49

标签: javascript html5-video video.js

我尝试使用html5视频标签和video.js播放器播放视频,但我无法播放视频,视频采用mp4格式。

视频可以从https://drive.google.com/open?id=0BwvTwArK2QWBVVZhbnAtMjZlWlU

下载



<html>
<head>
  <link href="http://vjs.zencdn.net/6.2.7/video-js.css" rel="stylesheet">

  <!-- If you'd like to support IE8 -->
  <script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>

<body>
  <video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup="{}">
    <source src="test.mp4" type='video/mp4'>
    <p class="vjs-no-js">
      To view this video please enable JavaScript, and consider upgrading to a web browser that
      <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
  </video>

  <script src="http://vjs.zencdn.net/6.2.7/video.js"></script>
</body>
</html>
&#13;
&#13;
&#13;

我收到一条错误消息: - enter image description here

2 个答案:

答案 0 :(得分:0)

我不熟悉Video.js,但你听到的错误听起来像是海报有问题(缩略图)

在他们的主页上,他们会显示一个完整的模板来使用他们的库:

<video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
  poster="MY_VIDEO_POSTER.jpg" data-setup="{}">
    <source src="MY_VIDEO.mp4" type='video/mp4'>
    <source src="MY_VIDEO.webm" type='video/webm'>
    <p class="vjs-no-js">
      To view this video please enable JavaScript, and consider upgrading to a web browser that
      <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
</video>

答案 1 :(得分:-1)

尝试在数据设置中使用单引号,因为它应包含JSON

data-setup='{}'