4/11/2024 0 Comments Hide iframe code html: Fixed a bug where YouTube iFrame API code could be loaded multiple times for multiple embeds. : Added a flexible, easy-to-use WordPress plugin version of the code. : Now hides related videos on pause as well as video end screen. : Using this code, you can now embed multiple videos on the same page! Just make sure they are all using the updated version of the code, which you can find above. It is not designed to work with Internet Explorer.ĭid I mention that I’ve written a WordPress plugin that makes this all very easy and customizable? Check it out! Code Updates This code has been tested in Chrome, Firefox, Edge, and Chrome for Android. If the video is paused, the script shows a “play” button over the related videos box. When the replay button is clicked, the video plays over from the beginning again. When the video ends, the script shows a custom “replay” button over the entire embed. Under the hood, the script hooks into the YouTube API to determine whether the video is playing. Also I want it so if iframebutton1 is pressed then iframe2 will be hidden (if it's showing) and visa versa. There will be 2 buttons, 1 above each iframe and the user must click on the button to show the iframe. I would like both iframes hidden when a user first clicks on the webpage. To see the full, unminified version of the script, click here. I have a webpage with 2 iframes, 1 underneath the other. If you end up using this code, I would greatly appreciate a link back to this post as attribution, if possible! If you’re not using WordPress, you can integrate this code with your website: This is the final result (pay attention at the end of the video): For those of us who still want to be able to embed YouTube videos without related videos showing at the end, there is a snippet of code we can use as a workaround. This option was likely deprecated because it was not seeing a lot of use, but the sudden change has left the rest of us to wonder why rel=0 is not working to hide related videos like it used to. YouTube Player API Release Notes - August 23, 2018 However, you will have the option of specifying that the related videos shown in the player should be from the same channel as the video that was just played. The effect of the change is that you will not be able to disable related videos. The behavior for the rel parameter is changing on or after September 25, 2018. It is no longer possible to fully disable related videos using rel=0. However in September 2018, YouTube changed their embed code so that this rel=0 trick no longer fully removes the related videos (instead it makes it so the related videos come from the same YouTube channel as the video displayed). Before September 2018, a webmaster could disable related videos on YouTube embeds by simply adding ?rel=0 to the iframe’s src like this:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |