Events
PoWa dispatches events to report its state to any listeners. There are certain window-level events to announce player instantiation or instantiation errors. The remaining events fire on the player object itself and relay the state of that specific player. A wildcard event, *
, relays all events. All events are defined on window.PoWa.EVENTS
but note that this will not be available until powa.js
has been loaded to the page.
The PoWa object to listen to is reported on the POWA_READY
event or can be located under the object window.powas
keyed by the id
of the .powa
element.
Window events are CustomEvent
events so the pertinent data is located under the detail
parameter. PoWa has its own event system (on, off, once) that reports the pertinent information at the top level of the event object.
For a full list of events, you can log PoWa.EVENTS
in the console
EVENT | VALUE | DATA | DESCRIPTION |
---|---|---|---|
POWA_READY | powaReady |
| Fires when a player is instantiated and ready for interaction.
|
POWA_ERROR | powaError |
| Fires when a player fails to instantiate. One common cause for this error is that the video has reached its “publication end date” and is no longer available. The player is still viable, though, and will accept calls to
|
Player Events
EVENT | VALUE | DATA | DESCRIPTION |
---|---|---|---|
ALL | * | Subscribe to all events.
| |
BUFFERING | powaBuffering |
| Fires when data is available for the current playback position, but not enough to actually play more than one frame. |
COMPLETE | complete |
| The content has finished playing. |
END | end |
| The video has either errored out, been skipped, or reached completion. |
ERROR | error |
| The video has experienced an error. |
FIRST_FRAME | firstFrame |
| This event ensures that the first frame of the content is visible to the user. The content is playing. |
LOADED | loaded |
| Loading of media has begun. |
MEDIA_START | mediaStart |
| When the content is set and ads rolled, the player triggers this event for internal components to prepare to play content. |
NOT_VIEWABLE | notViewable |
| Fires when an element hits the viewable threshold (default: 0.5) is vertically outside of the viewport. The default can be overridden via a threshold option, powa.on(PoWa.EVENTS.NOT_VIEWABLE, notViewableHandler, {"threshold": 0.0}) . The threshold can be set from 0 (any amount of element not visible) to 1 (entire element not visible). Multiple VIEWABLE or NOT_VIEWABLE listeners can be registered but only the threshold of the first listener is honored, all other listeners will be triggered at that initial threshold. |
VIEWABLE | viewable |
| Fires when an element hits the viewable threshold (default: 0.5) is vertically within the viewport. The default can be overridden via a threshold option, powa.on(PoWa.EVENTS.VIEWABLE, viewableHandler, {"threshold": 1.0}) . The threshold can be set from 0 (any amount of element visible) to 1 (entire element visible). Multiple VIEWABLE or NOT_VIEWABLE listeners can be registered but only the threshold of the first listener is honored, all other listeners will be triggered at that initial threshold. |
PAUSE | pause |
| The video has been paused. |
PLAY | play |
| The video is playing. |
PROGRESS | progress |
| Reports the amount of buffered media that has been loaded. |
SKIP | skip |
| This event indicates the user skipped the displayed ad. |
START | start |
| The sequence of events for a new video has begun. The event is triggered when the user clicks a promo image or the auto play feature is engaged. From this event, the content playback flow begins. The event begins to download information about the video to play, and, if there are ads, the corresponding requests are made to play them. The content is not playing yet. |
TIME | time |
| The current timing information of the video. Fires about once per second. |
POWA_RENDER | powaRender | Default | The player has appeared on the page. |
PLAYBACK_0 | playback0 | This event is called immediately after MEDIA_START is triggered. This event indicates that playback has started but content is not guaranteed to be currently viewable. | |
PLAYBACK_25 | playback25 | The video is 25% complete. This event triggers only if the content reaches the 25% played mark. | |
PLAYBACK_50 | playback50 | The video is 50% complete. This event triggers only if the content reaches the 50% played mark. | |
PLAYBACK_75 | playback75 | The video is 75% complete. This event triggers only if the content reaches the 75% played mark. | |
PLAYBACK_100 | playback100 | The video is complete. This event triggers only if the content reaches the 100% played mark. This event is called immediately after COMPLETE is triggered. | |
PROMO_CLICK | promoClick |
| The user has clicked a .powa-shot-click element on the promo. |
PROMO_CUSTOM | promoCustom |
| The user has interacted with a .powa-shot-<(click|hover|touch)>-<custom event> element on the promo. Will subsequently fire a promo(Click|Hover|Touch)<Custom> event (e.g. … would fire promoCustom then promoClickTest ). |
PROMO_HOVER | promoHover |
| The user has clicked a .powa-shot-click-play element on the promo (issues ‘play()’ on the accompanying player). |
PROMO_TOUCH | promoTouch |
| The user has touched a ‘.powa-shot-touch’ element on the promo. |
Ads Events
EVENT | VALUE | DATA | DESCRIPTION |
---|---|---|---|
AD_BAR_MUTE | adBarMute |
| The user clicked ‘mute’ on the ad bar. |
AD_BAR_PAUSE | adBarPause |
| The user clicked ‘pause’ on the ad bar. |
AD_BAR_PLAY | adBarPlay |
| The user clicked ‘play’ on the ad bar. |
AD_BAR_SKIP | adBarSkip |
| The user clicked ‘skip’ on the ad bar. |
AD_CLICK | adClick |
| The user clicked the preroll ad. |
AD_COMPANIONS | adCompanions |
| The ad has companion ads available. |
AD_COMPLETE | adComplete |
| The ad has played through to completion. |
AD_DESTROYED | adDestroyed |
| The ad module has been torn down. |
AD_DURATION_CHANGE | adDurationChange |
| The duration of the ad has changed. |
AD_END | adEnd |
| The ad has errored out, been skipped, or reached completion. |
AD_ERROR | adError |
| The ad has experienced an error. |
AD_FIRST_FRAME | adFirstFrame |
| The ad video has begun playing. |
AD_LOADED | adLoaded |
| Ad has been loaded |
AD_MUTE | adMute |
| The ad has been muted. |
AD_PAUSE | adPause |
| The ad has been paused. |
AD_PLAY | adPlay |
| The ad is playing. |
AD_SETUP_ERROR | adSetupError |
| The ad module has failed to instantiate. |
AD_SKIP | adSkip |
| The ad has been skipped. |
AD_START | adStart |
| The sequence of ad events has begun. |
AD_START_UNREPORTED | adStartUnreported |
| The ad in question is buggy and does not report ‘timeRemaining’ so we use a shadow timer instead. |
AD_TIME | adTime |
| The current timing information of the ad. Fires about once per second. |