I’m trying to remove these playerVars from the default settings because it’s unnecessary duplication.
I’m not able to figure out how this would be done.
start: 0,
end: 999999,
loop: true,
https://jsfiddle.net/hzyrfkwb/461/
function addVideo(video, settings) {
const defaultSettings = {
width: settings.width || 640,
height: settings.height || 390,
videoId: video.dataset.id,
playerVars: {
start: 0,
end: 999999,
loop: true,
Would there be a way where I would only add them if they are needed?
As was done in this example:
https://jsfiddle.net/hzyrfkwb/432/
Doing this would remove a lot of unnecessary duplication.
loadPlayer({
target: ".jacketc",
width: 600,
height: 338,
playerVars: {
start: 200,
end: 205,
loop: true
}
});
It doesn’t need to be stated in both the top:
function addVideo(video, settings) {
const defaultSettings = {
width: settings.width || 640,
height: settings.height || 390,
videoId: video.dataset.id,
playerVars: {
start: 0,
end: 999999,
loop: true,
And also at the bottom:
loadPlayer({
target: ".jacketc",
width: 600,
height: 338,
playerVars: {
start: 200,
end: 205,
loop: true
}
});
These should only be added to loadPlayer if they are needed.
They shouldn’t be required to be at the top in the default settings.
start: 0,
end: 999999,
loop: true,
These should only be the default settings:
autoplay: 1,
controls: 1,
showinfo: 1,
rel: 0,
iv_load_policy: 3,
cc_load_policy: 0,
fs: 0,
disablekb: 1
};
These would only be added to loadPlayer if they are needed.
If they are not needed they don’t need to appear in the javascript.
start: 0,
end: 999999,
loop: true,
How would I be able to implement this adjustment to the code?
https://jsfiddle.net/hzyrfkwb/453/
Where these playerVars aren’t needed in the default settings.
They only get added to loadPlayer if they are needed.
start: 200,
end: 205,
loop: true,
That’s exactly how it works in the other code.
https://jsfiddle.net/hzyrfkwb/465/
How would I be able to implement that in the new, updated code?
https://jsfiddle.net/hzyrfkwb/453/