Detect end of YouTube video?

Is there any way to detect when a youtube video ends? Or starts?

The time to open the video is different depending on download speeds

John, might this info help?

Thanks for the reference but it doesn’t apply. I’m trying to do this in real basic.

Do you mean you’re trying to do this in a desktop app? If this is the case your post is miscategorized. But you can create your own html page that uses the iframe api above and host the page in a webview in your application. Use the api and some javascript in your page to change the title of the page when your desired events have occurred. You can periodically poll the title of the page via the webview from your app and capture the events that way.

No, I’m trying to do it in a web app.