Video.js with empty source

2019-05-04 18:19发布

Is there anyway I can place video.js without setting source on video tag? Video.js fails without source when starts.

I want place video.js without source and set sourace from js api later.

same question here but no one answered. VideoJS, without source?

标签: video.js
1条回答
祖国的老花朵
2楼-- · 2019-05-04 18:53

Use preload="none" on the video element

<video id="my_video" controls preload="none" class="video-js vjs-default-skin" data-setup="{}" />

Then load with the API

videojs("my_video").src([
  { type: "video/mp4", src: "http://vjs.zencdn.net/v/oceans.mp4" },
  { type: "video/webm", src: "http://vjs.zencdn.net/v/oceans.webm" }
]);
查看更多
登录 后发表回答