[javascript] How to detect when a youtube video finishes playing?

I am working on a site that has a ton of embedded youtube videos, the client wants to show a popup whenever a video stops splaying.

I looked at the youtube api and there seems to be a way to detect when a video ends:

http://code.google.com/apis/youtube/js_api_reference.html

but I can't embed the videos like they mentioned on that page since the videos are all already on the site (thousands that have been added manually by pasting embed code).

Is there a way to detect the ending of these videos without changing any of the existing videos (using javascript)?

This question is related to javascript flash api actionscript youtube

The answer is


What you may want to do is include a script on all pages that does the following ... 1. find the youtube-iframe : searching for it by width and height by title or by finding www.youtube.com in its source. You can do that by ... - looping through the window.frames by a for-in loop and then filter out by the properties

  1. inject jscript in the iframe of the current page adding the onYoutubePlayerReady must-include-function http://shazwazza.com/post/Injecting-JavaScript-into-other-frames.aspx

  2. Add the event listeners etc..

Hope this helps


Examples related to javascript

need to add a class to an element How to make a variable accessible outside a function? Hide Signs that Meteor.js was Used How to create a showdown.js markdown extension Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Summing radio input values How to execute an action before close metro app WinJS javascript, for loop defines a dynamic variable name Getting all files in directory with ajax

Examples related to flash

Assign command output to variable in batch file How to detect when a youtube video finishes playing? Error #2032: Stream Error How to embed a video into GitHub README.md? Want custom title / image / description in facebook share link from a flash app Flash CS4 refuses to let go How to add link to flash banner How can I detect if Flash is installed and if not, display a hidden div that informs the user? differences between using wmode="transparent", "opaque", or "window" for an embedded object on a webpage Best way to determine user's locale within browser

Examples related to api

I am receiving warning in Facebook Application using PHP SDK Couldn't process file resx due to its being in the Internet or Restricted zone or having the mark of the web on the file Failed to load resource: the server responded with a status of 404 (Not Found) css Call another rest api from my server in Spring-Boot How to send custom headers with requests in Swagger UI? This page didn't load Google Maps correctly. See the JavaScript console for technical details How can I send a Firebase Cloud Messaging notification without use the Firebase Console? Allow Access-Control-Allow-Origin header using HTML5 fetch API How to send an HTTP request with a header parameter? Laravel 5.1 API Enable Cors

Examples related to actionscript

How to detect when a youtube video finishes playing? How to pass "Null" (a real surname!) to a SOAP web service in ActionScript 3 What is the best way to get the minimum or maximum value from an Array of numbers?

Examples related to youtube

Youtube - downloading a playlist - youtube-dl YouTube Autoplay not working How to embed new Youtube's live video permanent URL? How do you use youtube-dl to download live streams (that are live)? How can I get the actual video URL of a YouTube live stream? YouTube: How to present embed video with sound muted ffprobe or avprobe not found. Please install one Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000 cast_sender.js error: Failed to load resource: net::ERR_FAILED in Chrome Embed YouTube video - Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'