1.如果是在.cs文件里初始化视频元素,没有遇到无法播放问题。
2.如果是js动态换播放器的poster和src遇到此问题,解决办法是用videojs提供的函数来设置
https://github.com/videojs/video.js/blob/stable/docs/api/vjs.Player.md#play
这里需要注意的是,一定要给src初始值,再调用函数去改变src的值
<video id="example_video_1" class="video-js vjs-default-skin" src="http://video-js.zencoder.com/oceans-clip.mp4" controls preload="none" width="370" height="264" data-setup="{}" >
<source id="example_video_source" src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' /></video>
<track kind="captions" src="../Scripts/video-js-4.12.5/demo.captions.vtt" srclang="zh-CN" label="English"></track>
<track kind="subtitles" src="../Scripts/video-js-4.12.5/demo.captions.vtt" srclang="zh-CN" label="English"></track>
var myPlayer = videojs('example_video_1');
// setting
myPlayer.poster(data.Imageurl);
myPlayer.src(data.videourl);
myPlayer.play();
|