Skip to main content

Events Reference

Event Usage

The Vertical Player emits events when user actions or playback state changes occur. These events can be listened to using a single event listener and distinguished by the returned eventName.

Supported Listener

LISTENERDESCRIPTION
on(eventName, callback)Attaches callback to the event identified by eventName. The callback is invoked every time the player emits that event.

Basic Usage Example

<script>
vpVerticalPlayer("divId")
.setup(config)
.then(() => {
vpVerticalPlayer("divId").on("vp-video-started", (event) => {
// ...
});
});
</script>

Native Video Events

EVENT NAMEDESCRIPTION
waitingPlayback is ready but waiting for more data (buffering).
endedPlayback has finished.
playUser initiated playback.
pausePlayback has been paused.
playingPlayback has started or resumed.
volumechangeVolume level or mute state changed.
stalledNo data is being loaded during a playback attempt.
canplayEnough data is available to begin playback.
progressMedia buffering progress has been updated.
timeupdateCurrent playback time has changed.
loadeddataFirst frame of the media has been loaded.
loadedmetadataMedia metadata loaded (duration, dimensions, etc.).
loadstartMedia loading has started.
seekingA seek operation is in progress.
seekedA seek operation has completed.
suspendBrowser has intentionally halted media loading.
ratechangePlayback rate has changed.
errorThe video element failed to load or decode the source.

Player State Events

EVENT NAMEDESCRIPTION
vp-subtitle-changeSubtitle track was changed.
vp-seekedSeeking operation has finished.
vp-finishedVideo playback has finished.
vp-state-playingPlayer entered the playing state.
vp-state-pausedPlayer entered the paused state.
vp-first-frameFirst video frame was loaded.
vp-readyPlayer is ready for API calls.
vp-video-switchActive video was changed.
vp-timeEmitted every 5 seconds with time and duration.
vp-user-interactionAny user interaction with the player.
vp-video-lockedVideo is locked and cannot be played.
vp-mutedMute state changed through the player. The event detail includes muted and currentTime.
vp-fullscreenPlayer entered or left fullscreen. The event detail includes fullscreen.
vp-quality-changeThe viewer picked a different quality level. The event detail includes qualityIndex.
vp-resizeThe player container was resized. The event detail includes width and height.
vp-viewableThe player entered or left the viewport. The event detail includes viewable.
vp-buffer-changeBuffered amount changed. The event detail includes percentage of the video buffered ahead.
vp-buffer-fullThe whole video is buffered.
vp-video-errorA video source failed to load and the feed skipped past it. The event detail includes videoIndex and file.
vp-sharing-openThe share panel was opened.
vp-activation-gestureThe viewer's first interaction anywhere on the page, which browsers require before audio can play.
vp-playlist-appendedVideos were added to the playlist with addVideos(). The event detail includes addedCount, totalCount, and startIndex.
vp-playlist-near-endThe viewer is approaching the end of the playlist, which is the cue to append more videos. The event detail includes videoIndex, remaining, and totalCount.
EVENT NAMEDESCRIPTION
vp-timed-link-showA timed link became visible. The event detail carries the link: title, url, time, and duration when one is set.
vp-timed-link-clickThe viewer clicked a timed link. The event detail carries the same fields as vp-timed-link-show.

Playback Health Events

EVENT NAMEDESCRIPTION
vp-play-attemptFired once per view when playback is first requested, or backfilled if a failure implies an attempt that was never recorded. The event detail adds autoStart (false only when the viewer started playback) to the shared payload below.
vp-fatal-errorFired at most once per view when the player gives up on the current video. Always implies an attempt. See the fields below.
vp-error-recoveredFired when a fatal-class error was survived by a fallback and playback resumed. The event detail adds recoveryReason and recoveryMethod.
vp-autoplay-blockedFired when the browser blocks autoplay, after both the unmuted and the muted attempt were rejected. The event detail includes autoStart.
vp-video-interruptedFired once when a livestream already in playback is disrupted. The event detail includes reason (networkError, mediaError, or otherError), multiStream, and currentTime. Livestreams only.
vp-video-recoveredFired once after a livestream recovers from an interruption. The event detail includes currentTime. Livestreams only.

A view is one video. The feed rotates the view on every switch, so swiping through ten videos produces up to ten attempts and up to ten fatal errors, joined by uniqueViewId. Ads ride the current video's view and never produce their own attempt. Geo-blocked videos, videos that are not published yet, and paywall locks are intentional outcomes and are not reported here.

vp-play-attempt, vp-fatal-error and vp-error-recovered share this payload:

FIELDDESCRIPTION
eventattempt, fatal-error, or error-recovered.
uniqueViewIdJoin key for the current view.
userIdViewer identifier used by analytics.
videoIdIdentifier of the current video.
playerIdConfiguration identifier of the player instance.
projectIdProject the player belongs to.
fileSource URL of the current video, with any query string removed.
isLivetrue when the current video is a livestream.
currentTimePlayback position when the event fired.
isVerticalAlways true for the Vertical Player.

vp-fatal-error adds:

FIELDDESCRIPTION
categoryBroad class of the failure: network, media, unsupported, or other.
fatalReasonMachine-readable reason, see the table below.
locationNumeric code matching fatalReason, useful for grouping in dashboards.
phasestart if playback had not begun yet, playback if the video was already playing.
detailsUnderlying error detail as reported by the streaming library or the browser.
httpCodeHTTP status of the failed request, when the failure was a network response.
extraDetailsJSON string with additional context, including recoveredErrors for this view.

Reasons the Vertical Player reports:

REASONCODEMEANING
fileMissing101No source URL was provided for the video.
fileUnreachable102The manifest or file could not be loaded.
levelUnreachable103A quality rendition could not be loaded.
networkError106Network failure without a more specific reason.
manifestEmpty201The manifest loaded but contained no streams.
streamEmpty202The stream loaded but contained no segments.
segmentError203A segment failed to load or parse.
codecUnsupported301The browser cannot decode the codecs in the stream.
decodeError302The browser failed to decode the media.
keyError401An encryption key could not be loaded or applied.
browserUnsupported501The browser cannot play the source at all.
playRejected502The browser rejected the play request for a non-policy reason.
otherError503Unrecoverable failure that fits none of the above.

The reason vocabulary is shared with the Web Player, so not every value appears in every situation. vp-error-recovered reports recoveryReason (networkError or mediaError) with the recoveryMethod that worked (retry or recoverMediaError).

Ad Events

EVENT NAMEDESCRIPTION
vp-ad-clickUser clicked the ad.
vp-ad-first-quartileAd reached 25% playback.
vp-ad-second-quartileAd reached 50% playback.
vp-ad-third-quartileAd reached 75% playback.
vp-ad-completeAd finished playback (not skipped).
vp-ad-skipAd was skipped by the user.
vp-ad-progressAd playback progress update.
vp-ad-impressionAd impression was registered.
vp-ad-errorError occurred during ad playback.
vp-ad-time-updateAd playback time was updated.
vp-ad-readyThe ad finished loading and is ready to play.
vp-ad-playThe ad started or resumed playing.
vp-ad-pauseThe ad was paused.
vp-ad-muteThe ad's mute state changed. The event detail includes muted.
vp-ad-skippableThe ad became skippable, or its skip state changed. The event detail includes skippable.

Analytics Events

EVENT NAMEDESCRIPTION
vp-embedPlayer was embedded.
vp-video-startedVideo playback started.
vp-video-completedVideo playback completed.
vp-first-quartile25% of the video was watched.
vp-second-quartile50% of the video was watched.
vp-third-quartile75% of the video was watched.
vp-video-statePeriodic playback state emitted every 10s.
vp-twenty-view20 seconds of the video were watched.
vp-true-viewValid view based on user interaction.
watchedtimeTotal watch time tracked.

Generic Event (vp-event / vpEvent)

The Vertical Player emits a generic event called vp-event (vpEvent) that captures all player events, including playback, state, analytics, ad, and native video events.

EVENT NAMEALIASDESCRIPTION
vp-eventvpEventGeneric event for custom player events.

Listening to All Vertical Player Events

You can listen to all Vertical Player events using the vp-event listener and filter by the eventName property.

vpVerticalPlayer("player").on("vp-event", (e) => {
console.log("Vertical Player Event:", e.eventName, e);
});