Play Tag-Based Random YouTube Videos

Does anyone know a quick way for a script to play YouTube videos randomly by simply entering a tag from a web form? Trying to build it using PHP and JavaScript will not know where to start using the YouTube API.

+4
source share
1 answer

The setShuffle function instructs YouTube to play the videos in the playlist in random order (or play them in the established order.

player.setShuffle(shufflePlaylist:Boolean):Void 

This function specifies whether to drag and drop videos from the playlist so that they play in a different order than the creator of the playlist assigned. If you shuffle a playlist after it has already started playing, the list will be reordered while the video being played continues to play. The next video that is played will then be selected based on the reordered list. This parameter will not be saved if you download or browse another playlist, which means that when loading the playlist, call the setShuffle function and then load the second playlist, the second playlist will not be shuffled.

  • The required shufflePlaylist parameter indicates whether YouTube should shuffle the playlist.
    • If true , YouTube shuffles the playback order. If you instruct the function to shuffle a playlist that has already been shuffled, YouTube will shuffle the order again.
    • If false , YouTube will reorder the playlist in its original order.

click here to learn how to use the YouTube Player JavaScript API link

0
source

Source: https://habr.com/ru/post/1403296/


All Articles