Closes Issue #222: Autoplay Feature from Youtube #258
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
There's a pull request (#231) but it isn't active for a long time. So I've used that pull request and made some work with it to close the issue #222.
Types of changes
What types of changes does your code introduce? Check all the boxes that apply:
Cleaned up the code from pull request #231.
Then fixed some bugs:
(1) Fixed getNewVideoID function. Previously it just popped up all
the playList and left only the first element. And if this element
would be current video id then nextId will be set to null. Now I've
made a reverse for playlist array to get just the same next video from
YouTube as Youtube suggests itself and that is done with no further
changes in the code. I've also removed the while loop from
getNewVideoID function and that gives the code an opportunity
to check all the playlist for a next track during the session.
(2) Fixed the problem when tracks were added to videoMetadata["items"]
when they were already there. Now there is a clause that checks if
current track has already been played and if so just doesn't add
a duplicate.
Final checklist:
Go over all the following points and check all the boxes that apply
If you're unsure about any of these, don't hesitate to ask. We're here to help!