我正在使用VideoJS和React。
在componentDidMount
中初始化VideoJS时,我没有指定视频的src,因为此视频播放器动态地提供源,并且在加载时,没有选择/接收源。当用户点击查看特定内容时,稍后通过AJAX调用进行设置。
在这种情况下,我在componentDidMount中初始化我的组件时收到错误:
componentDidMount(){
videojs("myvideo", {}, function(){
// this initializes the player.
});
}
页面渲染后,我收到了错误:
VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. i {code: 4, message: "The media could not be loaded, either because the …rk failed or because the format is not supported."}
我的视频标记如下所示:
return(
//...other stuff here
<video id="myvideo" className="video-js vjs-default-skin" controls preload="auto" width="1000" height="1000">
<source id="video-source" type="video/webm" />
</video>)
正如您所看到的,在初始化videojs时尚未指定src视频。加载时我不能收到什么错误?