Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6843641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:16:10+00:00 2026-05-27T00:16:10+00:00

YouTube iframe API: how do I control a iframe player that's already in the

  • 0

YouTube iframe API: how do I control a iframe player that's already in the HTML?

How do I subscribe to events here? I would like to listen for video finish.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:16:11+00:00Added an answer on May 27, 2026 at 12:16 am

    Have a look at my function as defined at this answer: Listening for Youtube Event in JavaScript or jQuery.

    In your case, implement the core functions as shown below (Fiddle: http://jsfiddle.net/w2w5x/)

    // Core functions defined at https://stackoverflow.com/q/7988536#7988536
    var player;
    YT_ready(function(){
        var frameID = getFrameID("YOUR-frame-or-container-ID-here");
        if (frameID) { //If the frame exists
            player = new YT.Player(frameID, {
                events: {
                    "onStateChange": function(event){
                        if(event.data == "0") {
                            //The video has finished
                            alert("The video has finished!");
                            //Do something, example: play again
                            player.playVideo();
                        }
                    }
                }
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my HTML: <a class=video iframe href=http://www.youtube.com/watch?v=Psk2Pq03rv0&#38;fs=1>Arbitrary text</a> Here is the Fancybox javascript:
I have a youtube video embed code that looks like this: <iframe width=560 height=315
so i have the two following iframe codes: <iframe title=YouTube video player class=youtube-player type=text/html
<iframe class=youtube-player type=text/html src=http://www.youtube.com/embed/JW5meKfy3fY?wmode=opaque&autohide=1&autoplay=1&volume=0&vol=0&mute=1 frameborder=0>&lt;br /&gt;</iframe> The video isn't muted! I want volume to
The Youtube Player API has a bunch of functionality that I'm interested in, such
Regarding the Youtube API Blog they are experimenting with their new HTML5 Video Player.
Fiddle link: http://jsfiddle.net/T35fH/ Hi! I m trying to have 2 iframe youtube video player
YouTube has URL's like these: http://www.youtube.com/watch?v=zKqeCtjFGFc When I create a PHP page mine would
I have a YouTube's player in the webpage. I need to change the video
It looks like the YouTube API does not have a way to stop a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.