BarkingLlama Roulette adds a simple shortcode and REST endpoint that selects a random YouTube video from a configured playlist and embeds it on your site.
Perfect for motivational cards as Shorts, “daily randomness” pages, or any curated playlist you want to keep fresh.
Features:
* Shortcode: [llama_roulette]
* REST endpoint: /wp-json/llama-roulette/v1/random
* Playlist caching via transients to reduce YouTube API calls
* Optional Privacy Enhanced Mode (youtube-nocookie embeds)
* “Start Muted” setting for reliable autoplay
This plugin uses the YouTube Data API v3 (Google) to retrieve videos from the configured YouTube playlist so it can select and display a random video.
What data is sent and when:
* The configured playlist ID (or playlist ID parsed from a provided playlist URL) is sent when the plugin requests playlist items.
* The configured YouTube API key is sent with those API requests for authentication.
* These requests occur when cached playlist data is missing or expired, or when playlist data must be refreshed.
Service provider:
* Google / YouTube Data API v3
Terms of Service and Privacy Policy:
* Google API Services Terms of Service: https://developers.google.com/terms/
* YouTube API Services Terms of Service: https://developers.google.com/youtube/terms/api-services-terms-of-service
* Google Privacy Policy: https://policies.google.com/privacy
Basic:
[llama_roulette]
Available attributes:
* button_label – Custom label for the trigger button (e.g., button_label="Try Luck").
* playlist – Optional YouTube Playlist ID or URL to override the global setting.
* autoplay – Set to 1 to auto-load/play, 0 to wait for click.
* muted – Set to 1 to start muted, 0 for sound (Note: browsers block unmuted autoplay).
* show_title – Set to 1 to show the video title below the player, 0 to hide.
* align – left, center, or right.
* max_width – Any CSS width value (e.g., max_width="800px").
* aspect_ratio – CSS aspect-ratio (e.g., 16/9, 4/3).
* class – Append custom CSS classes.
Example:
[llama_roulette playlist=”PLxxxx” button_label=”Spin!” autoplay=”1″ muted=”1″ show_title=”1″]
GET /wp-json/llama-roulette/v1/random
Optional query param:
* playlist (Playlist ID or URL) to override the configured playlist for that request
Example:
GET /wp-json/llama-roulette/v1/random?playlist=PLabc123
This plugin is licensed under the GPLv2 or later.