I currently experience a small issue where I receive a warning from video.js which is as following:
VIDEOJS: WARN: Player "media" is already initialized. Options will not be applied.
The bizarre thing is that it has not been initialized. But rather it is within a jQuery's $(document).ready.
The relevant code is:
<script src="//vjs.zencdn.net/5.19.1/video.min.js"></script>
<script>
$(document).ready(function() {
var player = videojs('media', {
fluid: true,
playbackRates: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
});
});
<script>
It know it has something to do with when how fast these resources get loaded, because every now and then the warning will not appear and the options are applied.
I do need this the player initialized once the "document is ready", though. How can I go about this issue?
Any help I would greatly appreciate!
I had the same problem. Videojs gets automatically initialized when the data-setup attribute is present in the <video> tag.
Remove data-setup and the player will not initialize by itself, the warning will not show up anymore when you execute the JS code now:
var player = videojs('media', options);
Now you can define the options and simply do ("media" is the id of your videoplayer):
var options = {
"playbackRates": [1, 1.5, 2],
};
var video = videojs('media', options);
video.ready(function() {
// …
});
I also face the same problem. Videojs gets automatically initialized
Just Remove "data-setup" and the player will not initialize by itself

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With