4/21/2023 0 Comments Push playlist![]() We also keep track of the index, within the player's playlist, of the last video played before the transition. If they do no match, we update the player's playlist. It's a simple array of Youtube videos identifiers, in which we can push new data whenever we want.Įverytime a video transition happens, we check the length of our playlist against the length of the player's playlist. ![]() The idea is to maintain a separate playlist, that we can manipulate. By updating the playlist only when a transition happen, there is no (well, a barely) noticeable interruption. Some observation shows that the -1 event fires when a playlist transitions from one video to another. The data property of the event object that the API passes to your event listener function will specify an integer that corresponds to the new player state. ![]() This event fires whenever the player's state changes. The API provides events, one of which will reveal itself to be useful to our purpose: onStateChange. By getting a little creative, we can actually use loadPlaylist() without causing any interruption.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |