黑屏视频(移动设备)

Black screen video (mobile devieces)

视频在 android chrome 上不工作(在 38-40 版本中测试),我在 chrome 中有黑屏,在 firefox 中有 opera 所有工作,我有同样的ios 野生动物园的问题。

var v = document.createElement(  "video"  );
v.type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"';
v.src = "http://cyberua.16mb.com/player/data/video3.mp4";

https://jsfiddle.net/0du7LmfL/3/embedded/result/

[更新] 我找到了解决方法,但为什么不使用 document.create?

 var video = '<video id="really-cool-video" class="video-js vjs-default-skin" controls ' +
        ' preload="auto" width="640" height="264" poster="really-cool-video-poster.jpg" data-setup="{}"> <source src="http://cyberua.16mb.com/player/data/video3.mp4" type="video/mp4">  </video>'
 document.body.innerHTML = video;

https://jsfiddle.net/0du7LmfL/10/

视频编码有问题

https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats

  • :WebM 中的 VP8 和 Vorbis
  • :MP4 中的 H.264 和 MP3
  • : MP4 中的 H.264 和 AAC