How to control YouTube in iframe?

0 favourites
  • 5 posts
  • Hello!

    I did a bit of searching and experimenting but was unable to figure this out! I've never used the iframe plugin before and my javascript knowledge is low.

    With an iframe that has a YouTube video within, how would be best to communicate with this? Would it be preferable to use "browser > execute javascript", or use the built-in javascript feature in C3?

    I wanted to be able to pause, play, seekto, etc.

    Many thanks for reading!

  • You don't need to do all of that. Just use the embed url of the video.

    On the youtube video page, click on the Share button. In the Embed option, look for the direct url of the src and use that.

    Or did you want separate sprites to use for the pause/play buttons? In that case, you'll have to use their API...

    css-tricks.com/play-button-youtube-and-vimeo-api

  • You don't need to do all of that. Just use the embed url of the video.

    On the youtube video page, click on the Share button. In the Embed option, look for the direct url of the src and use that.

    Or did you want separate sprites to use for the pause/play buttons? In that case, you'll have to use their API...

    https://css-tricks.com/play-button-youtube-and-vimeo-api/

    Hello, many thanks for replying!

    I would like to use their API and send commands to the Youtube player, so I could do something similar to your example of using separate sprites to act as play/pause (and seeking which is most important for me!), but I have no idea how to apply their API this within the Event Sheet View.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi Jase00, did you have any luck with this? I'm also looking for a way to control a youtube video using C3. I'd like to be able to Play/Pause the video in it's iFrame, trigger events at a specific playback time and basically use C3 to control any aspect of the video that the Youtube IFrame Player API allows. Unfortunately I've had no luck so far - I can achieve results using just HTML and Javascript, but I can't get C3 to successfully replicate this functionality. Does anyone know if it's actually possible, and if so, how?

    Many Thanks,

    Steve.

  • Hello!

    Funnily enough, I was trying to look into this again today.

    I think one part that I was stuck at that I cannot find a solution for is enabling "Cross domain" communication in a preview window (or access-origin or something, I can't recall), so that we can communicate between the iframe and Construct 3.

    I am at work at the moment so I cannot look too much right now, but I would still like to know how to configure this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)