Youtube API Multiple Videos

Developer
Size
2,326 Kb
Views
68,816

How do I make an youtube api multiple videos?

What is a youtube api multiple videos? How do you make a youtube api multiple videos? This script and codes were developed by Ali Klein on 11 July 2022, Monday.

Youtube API Multiple Videos Previews

Youtube API Multiple Videos - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Youtube API Multiple Videos</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div> <button id="stop">Stop All Videos</button>
</div>
<div class="wrapper"> <div id="player1"></div> <div id="player2"></div> <div id="player3"></div>
</div>
<div class="wrapper"> <div id="player4"></div> <div id="player5"></div> <div id="player6"></div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Youtube API Multiple Videos - Script Codes CSS Codes

button { background-color: lightcoral; color: white; display: block; margin: 20px auto; min-width: 120px; border: none; padding: 0 1em; font-size: 12px; line-height: 40px; text-align: center; outline: none; cursor: pointer;
}
.wrapper { display: flex; align-content: center; justify-content: space-around; margin-bottom: 2vw;
}

Youtube API Multiple Videos - Script Codes JS Codes

var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var playerInfoList = [{ id: 'player1', height: '175', width: '300', videoId: 'dOy7vPwEtCw'
}, { id: 'player2', height: '175', width: '300', videoId: 'QWtsV50_-p4'
}, { id: 'player3', height: '175', width: '300', videoId: 'y-JqH1M4Ya8'
}, { id: 'player4', height: '175', width: '300', videoId: 'gH7dMBcg-gE'
}, { id: 'player5', height: '175', width: '300', videoId: '7wL9NUZRZ4I'
}, { id: 'player6', height: '175', width: '300', videoId: 'S4R8HTIgHUU'
}];
function onYouTubeIframeAPIReady() { if (typeof playerInfoList === 'undefined') return; for (var i = 0; i < playerInfoList.length; i++) { var curplayer = createPlayer(playerInfoList[i]); players[i] = curplayer; }
}
var players = new Array();
function createPlayer(playerInfo) { return new YT.Player(playerInfo.id, { height: playerInfo.height, width: playerInfo.width, videoId: playerInfo.videoId, });
}
$(document).ready(function () { $('#stop').click(function () { $(players).each(function (i) { this.stopVideo(); }); });
})
Youtube API Multiple Videos - Script Codes
Youtube API Multiple Videos - Script Codes
Home Page Home
Developer Ali Klein
Username AliKlein
Uploaded July 11, 2022
Rating 3
Size 2,326 Kb
Views 68,816
Do you need developer help for Youtube API Multiple Videos?

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!

Ali Klein (AliKlein) 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!