2 Likes
For this code, Why are we writing videoPlayer.src = https://player.vimeo.com/video/${ videoPlaySectionData[card.id - 1]["vimeoId"] }
;
Purpose of – DOMContentLoaded
2 Likes
when we want to go for the exact position or indexing of your object of your particular id then we writing videoPlayer.src = https://player.vimeo.com/video/${ videoPlaySectionData[card.id - 1]["vimeoId"] }
;
Purpose of – DOMContentLoaded:- it is a event listener which can be used to detect a fully-loaded page.
2 Likes
videoPlayer.src = `https://player.vimeo.com/video/${ videoPlaySectionData[card.id - 1]["vimeoId"] }` ;
In general, json means array of objects.
In videoPlaySectionData (object) json data, this array's index starts from 0 and we have card.id from 1. So we are substracting 1 from card.id to get 0th index data.
Purpose of DOMContentLoaded() function :-
-> It is an event listener
-> This event fires when HTML document has been completely downloaded and executed of webpage.
-> It doesn't wait for other things like images, subframes, stylesheets and async scripts to finish loading.
2 Likes