You can’t really expect people to get dropped into some code with no information about anything and come up with a solution. I’m not even sure what a working version would look like.
-
videoPlayer.init
is called with an object. You can add the array of video ids as a property.
videoPlayer.init({
afterPlayerReady: function initCover() {
manageCover.init(function playVideo() {
videoPlayer.play();
});
},
videos: [
"0dgNc5S8cLI",
"mnfmQe8Mv1g",
"CHahce95B1g",
"2VwsvrPFr9w"
]
});
- As such the function must accept an object (options object). The argument to
videoPlayer.init
will be an object with properties which you can then access in the function.
function init(options) {
addEvents(options.afterPlayerReady);
config.playlist = options.videos.join();
loadIframeScript();
window.onYouTubeIframeAPIReady = onYouTubeIframeAPIReady;
}
- You have to change the parameter to
addEvents
it now is passed the one handler function (I renamed the parameter tohandler
).
function addEvents(handler) {
eventHandlers.afterPlayerReady = handler;
events.afterPlayerReady = new Event("afterPlayerReady");
}
Fork. I have no idea if it is working as intended because I have no idea what that is.