Skip to content

Commit

Permalink
Add example for binding to other event layers
Browse files Browse the repository at this point in the history
Per issue clappr#1768
  • Loading branch information
kad3nce authored Mar 6, 2019
1 parent b5d9e24 commit b54725b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion doc/API_EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can listen to several [events from Clappr](http://clappr.github.io/classes/Events.html).

```javascript
// You can either listen some events this way
// You can either listen to events fired from the player layer this way
var player = new Clappr.Player({
events: {
onReady: function() { ... }, //Fired when the player is ready on startup
Expand All @@ -21,3 +21,11 @@ var player = new Clappr.Player({
// or this way
player.on(Clappr.Events.PLAYER_PLAY, function() { ... })
```

If you want to listen for events from other layers, you need to add the bind for the specific scope.

For example, the `CONTAINER_STATE_BUFFERING` event is triggered by the container, so if you want to listen for events from the container layer on your code, here is how:

```javascript
player.core.activeContainer.on(Clappr.Events.CONTAINER_STATE_BUFFERING, function() { ... })
```

0 comments on commit b54725b

Please sign in to comment.