• Guest - Earn a FREE TubeBuddy Upgrade for being active on the forums! Click Here to learn how you earn free upgrades for TubeBuddy!
  • Guest - TubeBuddy has a discord! Click Here to join in the conversation!

YouTube Question video embed advice

Rik

New Member
1
2
In advance embed it allows you to loop a video. But the video starts again immediately. is there a way to loop the video and then pause it at the beginning or show the thumb? Like resetting the player? I want to allow the end user the option to start the video again and not to do it automatically.
 
When embedding the YouTube video, add "?loop=1" to the end of the video URL in the embed code. This enables continuous looping of the video.

Try the below code


<iframe width="560" height="315" src="
View: https://www.youtube.com/embed/VIDEO_ID?loop=1
" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<script>
var player = document.getElementById("movie_player"); // Replace with actual element ID if different

player.addEventListener("ended", function() {
player.pause();
// Option A: Pause with black frame
player.currentTime = 0;

// Option B: Show Thumbnail (replace with your image URL)
// var thumbnail = document.createElement("img");
// thumbnail.src = "path/to/your/thumbnail.jpg";
// document.body.appendChild(thumbnail); // Adjust positioning with CSS
});
</script>