API
Events

Events

This page lists all available callbacks for handling player notifications.

Details

onAudioBecomingNoisy

Platforms: Android | iOS

Triggered when audio output changes (e.g., switching from headphones to speakers). It's recommended to pause the media when this event occurs.

Payload: none


onAudioFocusChanged

Platform: Android

Called when audio focus is gained or lost.

Payload:

PropertyTypeDescription
hasAudioFocusbooleantrue if media has audio focus, false otherwise

Example:

{
  hasAudioFocus: true
}

onAudioTracks

Platforms: Android | iOS

Triggered when available audio tracks change.

Payload: Array of objects with track details

PropertyTypeDescription
indexnumberInternal track ID
titlestringDescriptive track name
languagestringISO 639-1 (opens in a new tab) language code
bitratenumberTrack bitrate
typestringTrack MIME type
selectedbooleantrue if track is currently playing

Example:

{
  audioTracks: [
    { language: 'es', title: 'Spanish', type: 'audio/mpeg', index: 0, selected: true },
    { language: 'en', title: 'English', type: 'audio/mpeg', index: 1 }
  ]
}

onBandwidthUpdate

Platforms: Android | iOS

Called when available bandwidth changes.

Payload:

PropertyTypeDescription
bitratenumberEstimated bitrate in bits/sec
widthnumberVideo width (Android only)
heightnumberVideo height (Android only)
trackIdstringVideo track ID (Android only)

Example (iOS):

{
  bitrate: 1000000
}

Example (Android):

{
  bitrate: 1000000,
  width: 1920,
  height: 1080,
  trackId: 'some-track-id'
}

Note: On Android, set the reportBandwidth prop to enable this event.


onBuffer

Platforms: Android | iOS | web

Triggered when buffering starts or stops.

Payload:

PropertyTypeDescription
isBufferingbooleantrue if buffering is active

Example:

{
  isBuffering: true
}

onControlsVisibilityChange

Platform: Android

Triggered when the video player controls become visible or hidden.

Payload:

PropertyTypeDescription
isVisiblebooleantrue if controls are visible

Example:

{
  isVisible: true
}

onEnd

Platforms: All

Triggered when the media reaches the end.

Payload: none


onError

Platforms: All

Called when a playback error occurs.

Payload:

PropertyTypeDescription
errorobjectError details

onExternalPlaybackChange

Platform: iOS

Called when external playback mode changes (e.g., Apple TV connection/disconnection).

Payload:

PropertyTypeDescription
isExternalPlaybackActivebooleantrue if external playback is active

Example:

{
  isExternalPlaybackActive: true
}

onFullscreenPlayerWillPresent

Platforms: Android | iOS | visionOS

Called before entering fullscreen mode.

Payload: none


onFullscreenPlayerDidPresent

Platforms: Android | iOS | visionOS

Called when fullscreen mode is active.

Payload: none


onFullscreenPlayerWillDismiss

Platforms: Android | iOS | visionOS

Called before exiting fullscreen mode.

Payload: none


onFullscreenPlayerDidDismiss

Platforms: Android | iOS | visionOS

Called when fullscreen mode is exited.

Payload: none


onLoad

Platforms: All

Triggered when the media is loaded and ready to play.

Payload:

PropertyTypeDescription
currentTimenumberTime in seconds where the media will start
durationnumberLength of the media in seconds
naturalSizeobjectProperties:
  width - Width in pixels that the video was encoded at
  height - Height in pixels that the video was encoded at
  orientation - "portrait", "landscape" or "square"
audioTracksarrayAn array of audio track info objects with the following properties:
  index - Index number
  title - Description of the track
  language - 2 letter ISO 639-1 (opens in a new tab) or 3 letter ISO639-2 (opens in a new tab) language code
  type - Mime type of track
textTracksarrayAn array of text track info objects with the following properties:
  index - Index number
  title - Description of the track
  language - 2 letter ISO 639-1 (opens in a new tab) or 3 letter ISO 639-2 (opens in a new tab) language code
  type - Mime type of track
videoTracksarrayAn array of video track info objects with the following properties:
  trackId - ID for the track
  bitrate - Bit rate in bits per second
  codecs - Comma separated list of codecs
  height - Height of the video
  width - Width of the video
trackIdstringProvide key information about the video track, typically including: Resolution, Bitrate.

Example:

{
  canPlaySlowForward: true,
  canPlayReverse: false,
  canPlaySlowReverse: false,
  canPlayFastForward: false,
  canStepForward: false,
  canStepBackward: false,
  currentTime: 0,
  duration: 5910.208984375,
  naturalSize: {
     height: 1080
     orientation: 'landscape'
     width: '1920'
  },
  audioTracks: [
    { language: 'es', title: 'Spanish', type: 'audio/mpeg', index: 0 },
    { language: 'en', title: 'English', type: 'audio/mpeg', index: 1 }
  ],
  textTracks: [
    { title: '#1 French', language: 'fr', index: 0, type: 'text/vtt' },
    { title: '#2 English CC', language: 'en', index: 1, type: 'text/vtt' },
    { title: '#3 English Director Commentary', language: 'en', index: 2, type: 'text/vtt' }
  ],
  videoTracks: [
    { index: 0, bitrate: 3987904, codecs: "avc1.640028", height: 720, trackId: "f1-v1-x3", width: 1280 },
    { index: 1, bitrate: 7981888, codecs: "avc1.640028", height: 1080, trackId: "f2-v1-x3", width: 1920 },
    { index: 2, bitrate: 1994979, codecs: "avc1.4d401f", height: 480, trackId: "f3-v1-x3", width: 848 }
  ],
  trackId: "720p 2400kbps",
}

Note: audioTracks, textTracks, and videoTracks are not available on the web.


onLoadStart

Platforms: All

Triggered when media starts loading.

Payload:

PropertyTypeDescription
isNetworkbooleantrue if media is loaded from a network
typestringMedia type (not available on Windows)
uristringMedia source URI (not available on Windows)

Example:

{
  isNetwork: true,
  type: '',
  uri: 'https://example.com/video.mp4'
}

onPlaybackStateChanged

Platforms: Android | iOS | visionOS | web

Triggered when playback state changes.

Payload:

PropertyTypeDescription
isPlayingbooleantrue if media is playing
isSeekingbooleantrue if seeking is in progress

Example:

{
  isPlaying: true,
  isSeeking: false
}

onPictureInPictureStatusChanged

Platforms: iOS | Android | web

Triggered when Picture-in-Picture (PiP) mode is activated or deactivated.

Payload:

PropertyTypeDescription
isActivebooleantrue if PiP mode is active

Example:

{
  isActive: true
}

onPlaybackRateChange

Platforms: All

Triggered when playback speed changes.

Payload:

PropertyTypeDescription
playbackRatenumber0 (paused), 1 (normal speed), other values indicate speed changes

Example:

{
  playbackRate: 0  // indicates paused
}

onProgress

Platforms: All

Triggered every progressUpdateInterval milliseconds, providing information about the current playback position.

Payload:

PropertyTypeDescription
currentTimenumberCurrent playback position (seconds)
playableDurationnumberDuration that can be played using only the buffer (seconds)
seekableDurationnumberDuration that can be seeked to (usually the total length of the media)

Example:

{
  currentTime: 5.2,
  playableDuration: 34.6,
  seekableDuration: 888
}

onReadyForDisplay

Platforms: Android | iOS | Web

Triggered when the first video frame is ready to be displayed. This is when the poster is removed.

Payload: none


onReceiveAdEvent

Platforms: Android | iOS

Triggered when an AdEvent is received from the IMA SDK.

Enum AdEvent possible values for Android (opens in a new tab) and iOS (opens in a new tab):

AdEvent
EventPlatformDescription
AD_BREAK_ENDEDiOSFired the first time each ad break ends. Applications must reenable seeking when this occurs (only used for dynamic ad insertion).
AD_BREAK_READYAndroid, iOSFires when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false.
AD_BREAK_STARTEDiOSFired first time each ad break begins playback. If an ad break is watched subsequent times this will not be fired. Applications must disable seeking when this occurs (only used for dynamic ad insertion).
AD_BUFFERINGAndroidFires when the ad has stalled playback to buffer.
AD_CAN_PLAYAndroidFires when the ad is ready to play without buffering, either at the beginning of the ad or after buffering completes.
AD_METADATAAndroidFires when an ads list is loaded.
AD_PERIOD_ENDEDiOSFired every time the stream switches from advertising or slate to content. This will be fired even when an ad is played a second time or when seeking into an ad (only used for dynamic ad insertion).
AD_PERIOD_STARTEDiOSFired every time the stream switches from content to advertising or slate. This will be fired even when an ad is played a second time or when seeking into an ad (only used for dynamic ad insertion).
AD_PROGRESSAndroidFires when the ad's current time value changes. The event data will be populated with an AdProgressData object.
ALL_ADS_COMPLETEDAndroid, iOSFires when the ads manager is done playing all the valid ads in the ads response, or when the response doesn't return any valid ads.
CLICKAndroid, iOSFires when the ad is clicked.
COMPLETEDAndroid, iOSFires when the ad completes playing.
CONTENT_PAUSE_REQUESTEDAndroidFires when content should be paused. This usually happens right before an ad is about to cover the content.
CONTENT_RESUME_REQUESTEDAndroidFires when content should be resumed. This usually happens when an ad finishes or collapses.
CUEPOINTS_CHANGEDiOSCuepoints changed for VOD stream (only used for dynamic ad insertion).
DURATION_CHANGEAndroidFires when the ad's duration changes.
ERRORAndroid, iOSFires when an error occurred while loading the ad and prevent it from playing.
FIRST_QUARTILEAndroid, iOSFires when the ad playhead crosses first quartile.
IMPRESSIONAndroidFires when the impression URL has been pinged.
INTERACTIONAndroidFires when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data.
LINEAR_CHANGEDAndroidFires when the displayed ad changes from linear to nonlinear, or the reverse.
LOADEDAndroid, iOSFires when ad data is available.
LOGAndroid, iOSFires when a non-fatal error is encountered. The user need not take any action since the SDK will continue with the same or next ad playback depending on the error situation.
MIDPOINTAndroid, iOSFires when the ad playhead crosses midpoint.
PAUSEDAndroid, iOSFires when the ad is paused.
RESUMEDAndroid, iOSFires when the ad is resumed.
SKIPPABLE_STATE_CHANGEDAndroidFires when the displayed ads skippable state is changed.
SKIPPEDAndroid, iOSFires when the ad is skipped by the user.
STARTEDAndroid, iOSFires when the ad starts playing.
STREAM_LOADEDiOSStream request has loaded (only used for dynamic ad insertion).
TAPPEDiOSFires when the ad is tapped.
THIRD_QUARTILEAndroid, iOSFires when the ad playhead crosses third quartile.
UNKNOWNiOSAn unknown event has fired
USER_CLOSEAndroidFires when the ad is closed by the user.
VIDEO_CLICKEDAndroidFires when the non-clickthrough portion of a video ad is clicked.
VIDEO_ICON_CLICKEDAndroidFires when a user clicks a video icon.
VOLUME_CHANGEDAndroidFires when the ad volume has changed.
VOLUME_MUTEDAndroidFires when the ad volume has been muted.

Payload:

PropertyTypeDescription
eventAdEventThe ad event received
dataRecord<string, string> | undefinedAdditional ad event data

Example:

{
  "data": {
    "key": "value"
  },
  "event": "LOG"
}

onRestoreUserInterfaceForPictureInPictureStop

Platforms: iOS | visionOS

Corresponds to Apple's restoreUserInterfaceForPictureInPictureStopWithCompletionHandler (opens in a new tab). Call restoreUserInterfaceForPictureInPictureStopCompleted inside this function when the UI is restored.

Payload: none


onSeek

Platforms: Android | iOS | Windows UWP | web

Triggered when a seek operation completes.

Payload:

PropertyTypeDescription
currentTimenumberCurrent time after seeking
seekTimenumberRequested seek time

Example:

{
  currentTime: 100.5,
  seekTime: 100
}

Note: On iOS, this callback is not reported when native controls are enabled.


onTimedMetadata

Platforms: Android | iOS | visionOS

Triggered when timed metadata is available.

Payload:

PropertyTypeDescription
metadataarrayArray of metadata objects

Example:

{
  metadata: [
    { value: 'Streaming Encoder', identifier: 'TRSN' },
    { value: 'Internet Stream', identifier: 'TRSO' },
    { value: 'Any Time You Like', identifier: 'TIT2' }
  ]
}

onTextTrackDataChanged

Platforms: Android | iOS

Triggered when new subtitle data becomes available.

Payload:

PropertyTypeDescription
subtitleTracksstringThe subtitle text content in a compatible format

Example:

{
  subtitleTracks: "This blade has a dark past."
}

onTextTracks

Platforms: Android | iOS

Triggered when available text (subtitle) tracks change.

Payload:

PropertyTypeDescription
indexnumberInternal track ID
titlestringTrack name
languagestring2 letter ISO 639-1 (opens in a new tab) language code
typestringTrack MIME type (VTT, SRT, TTML)
selectedbooleantrue if the track is currently playing

Example:

{
  textTracks: [
    {
      index: 0,
      title: 'English Subtitles',
      type: 'vtt',
      selected: true
    }
  ]
}

onVideoTracks

Platform: Android

Triggered when video tracks change.

Payload:

PropertyTypeDescription
indexnumberTrack index
trackIdstringInternal track ID
codecsstringCodec type
widthnumberVideo width
heightnumberVideo height
bitratenumberTrack bitrate (bps)
selectedbooleantrue if the track is playing
rotationnumberRotation angle (0, 90, 180, 270)

Example:

{
  videoTracks: [
    {
      index: 0,
      trackId: "1",
      codecs: "video/mp4",
      width: 1920,
      height: 1080,
      bitrate: 5000000,
      selected: true,
      rotation: 0
    }
  ]
}

onVolumeChange

Platforms: Android | iOS | visionOS | web

Triggered when the player volume changes.

Note: This event applies to the player's volume, not the device's system volume.

Payload:

PropertyTypeDescription
volumenumberVolume level (0 to 1)

Example:

{
  volume: 0.5
}
We are TheWidlarzGroupPremium support →