如何使用Javascript从URL流式传输视频

时间:2017-04-25 19:08:26

标签: javascript video-streaming

当我尝试从网址流式传输视频时,出现以下错误:

Uncaught (in promise) DOMException: Failed to load because no supported source was found.

显然,我已经过测试,我的资源很有用。这是一个简化的JS fiddle,这里是该小提琴代码的副本:

// Create HTML Video Element to play the video
var video = document.createElement('video');
video.addEventListener('loadeddata', function (e) {
    document.body.appendChild( video );
});

video.src = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4';
video.crossOrigin = 'anonymous';
video.loop = true;
video.play();

为了让它发挥作用,我需要更改什么?

0 个答案:

没有答案