Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3832

YouTube API Playlist Index Appears Not To Be Zero-Based

$
0
0

I have a YouTube player embedded in my website with the src set to the following URL format:

https://www.youtube.com/embed?listType=playlist&list=[playlistId]&index=0&rel=0&autoplay=1

The index parameter does not appear to be working correctly. The documentation says the index is 0-based. However, values of 0 or 1 will both play the 1st video in my playlist, a value of 2 will play the 2nd video, 3 will play the 3rd video, and so on. It would appear the index is 1-based despite what the documentation says.

Supporting my assumption, go to YouTube and view a playlist (like this one). Hover over one of the videos in the list and observe the URL. The URL for the first video will have an index = 1, the second video will have index = 2, etc.

Obviously I can update the code in my site to use a 1-based index and fix my issue. However, I would like some confirmation that the index is indeed supposed to be 1-based and that YouTube isn't going to come back later and "fix" the index to be 0-based as described in the documentation, thus breaking my site again.


Viewing all articles
Browse latest Browse all 3832

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>