Youtube Random Video With Cover Image

Size
2,600 Kb
Views
28,336

How do I make an youtube random video with cover image?

What is a youtube random video with cover image? How do you make a youtube random video with cover image? This script and codes were developed by Joo Vctor De Oliveira Santos on 17 September 2022, Saturday.

Youtube Random Video With Cover Image Previews

Youtube Random Video With Cover Image - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Youtube Random Video With Cover Image</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- <ul class="videoList">	<li><a href="#" class="active" data-videoid="0">Cat Watching Horror Movie</a></li>	<li><a href="#" data-videoid="1">The Ultimate Viral Cat Video</a></li>	<li><a href="#" data-videoid="2">Cats Saying "No" to Bath - A Funny Cats In Water Compilation</a></li>
</ul> -->
<div class="video-container">	<div id="video-placeholder"></div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src='https://www.youtube.com/iframe_api'></script> <script src="js/index.js"></script>
</body>
</html>

Youtube Random Video With Cover Image - Script Codes CSS Codes

.videoList a.active{	background-color: green;	color: white;
}
.video-container{	position: relative;	width: min-content;	width: -moz-min-content;	width: -webkit-min-content;
}
#imagemCover{	position: absolute;	max-height: 400px;	left: 50%;	transform: translateX(-50%);
}

Youtube Random Video With Cover Image - Script Codes JS Codes

var videos = ["_kgRFHaNo-Y", "7WZPysRdP8A", "fzzjgBAaWZw"];
var player;
function onYouTubeIframeAPIReady() { player = new YT.Player('video-placeholder', { width: 600, height: 400, videoId: '_kgRFHaNo-Y', events: { onReady: initialize,	onStateChange: verificaFim } });
}
function initialize(){ // Update the controls on load //updateTimerDisplay(); //updateProgressBar(); // Clear any old interval. //clearInterval(time_update_interval); // Start interval to update elapsed time display and // the elapsed part of the progress bar every second. // time_update_interval = setInterval(function () { // updateTimerDisplay(); // updateProgressBar(); // }, 1000)
}
function verificaFim(event) { if (event.data != YT.PlayerState.ENDED) {	return;	}	mostrarImg();
}
function mostrarImg(){	$('.video-container').prepend('<img id="imagemCover" src="https://www.youtube.com/yts/img/yt_1200-vfl4C3T0K.png" />');	setTimeout(proximoVideo, 5000);
}
function proximoVideo(){	$("#imagemCover").remove();	var current = player.getVideoData()['video_id'];	var nextVideo = -1;	do{	nextVideo = Math.round(Math.random() * (videos.length - 1));	}while(videos[nextVideo] == current || !videos[nextVideo]);	console.log(nextVideo, videos[nextVideo]);	player.loadVideoById(videos[nextVideo]);
}
Youtube Random Video With Cover Image - Script Codes
Youtube Random Video With Cover Image - Script Codes
Home Page Home
Developer Joo Vctor De Oliveira Santos
Username jvhti
Uploaded September 17, 2022
Rating 3
Size 2,600 Kb
Views 28,336
Do you need developer help for Youtube Random Video With Cover Image?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Joo Vctor De Oliveira Santos (jvhti) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!