Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video.js with empty source

Tags:

video.js

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?

like image 896
ash-f Avatar asked Feb 15 '23 19:02

ash-f


1 Answers

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" }
]);
like image 108
misterben Avatar answered Mar 07 '23 16:03

misterben