How to Start Youtube Playlist from Random Video

If you want to start a Youtube playlist from random video, just add: &index=random_number to the src attribute of the embed code.

The code

To produce a random number, I use php rand. Something like

        print rand(1,9)

(replace “9” with the count of your playlist videos).


Here is an example of embed code:

<iframe width="853"
                src="//<?php print rand(1,9)?>"

Your comments are welcome!

MediSign - EHR for Small Medical Practices

EHR for Small Medical Practices

Medical records. Appointments. Electronic invoicing.