Streaming live at 10am (PST)

Youtube API hide/show iframe containing video


#1

Hi,

The problem is the following:

How to show/hide a youtube iframe and start the video from the beginning by clicking on show button again and not continue playing after having paused the video.

Many thanks for the help. I am learning HTML/CSS/JS/FLASH.

Daf
Sweden


#2

Hi @daf2014, thanks for the question. Although it is not a supported Webflow feature, you can control YouTube videos via javascript, using the YouTube API. Here is an article that shows how to control youtube video via script:

http://help.webflow.com/how-to-control-youtube-video-using-javascript

We use this method on the http://making.webflow.com site, look at the Jump To Section area.

I hope this helps smile


#3

Hi @cyberdave, thanks for sharing, this is exactly what I was looking for. I have some feedback to give, though.

This is a Webflow article's printscreen:








It's necessary to fix the script box, because the text is passing the purple area. Also, to fix Add code before ” tag” panel to Add code before < /body> tag. Despite being a simple adjustment, it would be very useful for non-programmers – like me smiley

And the most important: the article should guide to replace the "my-video" text for the Youtube Video ID in the Embed Widget (ID, Name and Src) and Script. Telling this because it wasn't explicit and I struggled to find why the whole thing wasn't working. Again, simple but not for non-programmers.

To finish, I'd suggest a tutorial's update for the iFrame Player API, as "YouTube JavaScript Player API have all been deprecated as of January 27, 2015".

Hope you find the feedback useful.


#4

Hi @DiogoFaim, I find this very useful thanks. Sometimes it is easy when you already know something, to leave things out or not be as complete as it should be. These are great points and I have added this to the documentation update list smile Thanks again for the feedback... very, very useful smile Cheers, Dave


#5