我正在尝试加载crossOrigin
属性设置为anonymous
的视频,但每当我这样做时视频无法加载。
Chrome只输出传递给错误事件监听器的错误对象Firefox说这是由于缺少CORS标头,IE似乎加载了视频,但我不确定原因。
var video = document.createElement("video");
video.id = "video_1";
video.width = 500;
video.height = 300;
video.src = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
video.loop = "true";
video.muted = "true";
video.autoPlay = "true";
video.crossOrigin = "anonymous";
var videoWrapper = document.getElementById("video-wrapper");
video.addEventListener('loadeddata', function() {
console.log("successful load");
videoWrapper.appendChild(video);
}, false);
video.addEventListener('error', function(error) {
console.log("error loading");
console.log(error);
});
video.load();

<div id="video-wrapper"></div>
&#13;