Using Events

You'll find some event interaction here.

Let's first create a basic player like this:

<!DOCTYPE html>
<html>
  <head>
    <title>afterglow player</title>
    <script src="//cdn.jsdelivr.net/npm/afterglowplayer@1.x"></script>
  </head>
  <body>
    <video class="afterglow" id="myvideo" width="1280" height="720">
        <source type="video/mp4" src="/path/to/myvideo.mp4" />
    </video>
  </body>
<html>

This is what the player looks like:

We observed the 'ready' event by using Events to display the alert you just saw. Here is how:

afterglow.on('myvideo', 'ready', function(){
    alert('Yeah, afterglow is ready to go. This alert was brought to you by the "ready" event').
});

Here is the latest event that was triggered (watch it update when you interact):

Read more about all available events here: Event documentation.