Closed startjava closed 7 months ago
👋 Thanks for opening your first issue here! 👋
If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.
With auto setup, Video.js will init any player embeds when the script lands, or on the window's load
event, that have a valid data-setup
attribute. It is disabled if videojs.options.autoSetup
is false.
autoSetupis not a player option so setting it as
trueor
falsethere has no effect. Generally it's best not to mix using both options in
data-setupand options passed to
videojs(el, options). If the player has already been set up by auto setup,
videojs(el, options)just returns the player and does not apply those options. If using
videojs(el, options)put all the options there and don't use
data-setup`.
@mister-ben
thank you !
but But I'm still not going to use the autoSetup property, is there any demo code? I searched for the code in the github repository and did not find the corresponding demo code.
You can see the difference between True and false values from the run effect, thanks
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="module" src="autoSetup.js"></script>
</head>
<body>
<div id="mydiv">
<video id="myvideo1" class="video-js" data-setup='{"width": "300px", "height": "300px", "controls":true}'>
<source src="../demo-720p.mp4" type="video/mp4">
</video>
<video id="myvideo2" class="video-js" data-setup='{"width": "300px", "height": "300px", "controls":true}'>
<source src="../demo-720p.mp4" type="video/mp4">
</video>
<video id="myvideo3" class="video-js">
</video>
</div>
</body>
</html>
import videojs from "video.js";
import "video.js/dist/video-js.css"
import {createApp, onMounted} from 'vue';
createApp({
setup() {
let player1;
let player2;
let player3;
onMounted(() => {
videojs.options.autoSetup = false;
player1 = videojs("myvideo1");
player2 = videojs("myvideo2");
player3 = videojs("myvideo3");
})
return {}
}
}).mount("#mydiv");
The above code should be 300px wide and 300px high for both players 1 and 2, but I've disabled autoSetup, so why isn't it working?
@axten
https://codepen.io/csalmeida/pen/ZEbxzeq
Is autoSetup option valid? What is the function of it?
@mister-ben
Description
html code:
js code:
run result:
why autoSetup=true and autoSetup=false result same?
how use autoSetup??
thank you !
Reduced test case
?
Steps to reproduce
1. 2. 3.
Errors
??
What version of Video.js are you using?
last new
Video.js plugins used.
_
What browser(s) including version(s) does this occur with?
chrome
What OS(es) and version(s) does this occur with?
_