React Native OTVPlayer

Namespace: props

OTVPlayer. props

Public properties

Properties:
Name Type Description
source Object

Source for the content to be played.

Properties
Name Type Description
src String

Source URI of the content.

type String

Mime type of the content.

token String

The SSP stream token in base64. It is required for SSP encrypted stream, not required for clear stream. it can be set in 5 seconds after set source.

tokenType String

The SSPHeader type, defaults as nv-authorizations

textTracks Array.<Object>

The side loaded text track for the content. Optional.

textTracks[].url Number

The url of text track source.

textTracks[].mimeType String

The mime type of the text track.

textTracks[].language String

The language of the text track.

preferredAudioLanguage String

When user sets the preferred audio languange, it allows the player to use it as a reference for selecting the appropriate default track when switching channels.

drm Object

The drm configuration for the encrypted media data Optional.

Properties
Name Type Description
type String

The drm scheme for the media data. (FairPlay, Widevine, PlayReady, or TVKey) Optional.

certificateURL String

The DRM Certificate URL

licenseURL String

The DRM License URL

ssmServerURL String

The Secure Session Management(SSM) Server URL

ssmSyncMode String

The flag indicates whether the SSM is in sync mode.

autoplay Boolean

Whether to autoplay the video. Default value is false. if autoPlay in player fails then error callback OTVPlayer.props.onError will be called with code 7026.

volume Number

The volume for playback (0-1).

muted Boolean

Whether the player is muted or not. Default value is false.

maxBitrate Number

User sets the maximum bitrate to be capped. To reset the capping we need to pass NULL or Infinity as maxBitrate. If nothing is passed, it is treated as undefined

maxResolution Object

User sets the maximum resolution to be capped. Resolution is an object with width and height. To reset the capping we need to pass NULL or Infinity as maxResolution. If nothing is passed, it is treated as undefined

Properties
Name Type Description
width Number

Maximum resolution width to be set.

height Number

Maximum resolution height to be set.

progressUpdateInterval Number

The update period for the progress event in seconds with up to 3 decimal places for milliseconds. The default value will be 0.25 seconds.

statisticsConfig Object

The statistics Configuration. An Object with statisticsTypes and statisticsUpdateInterval as its properties.

Properties
Name Type Description
statisticsUpdateInterval Number

The update period for onStatisticsUpdate event in milliseconds.

statisticsTypes Number

The type of statistics to be enabled - NONE, ALL, RENDERING, NETWORK, PLAYBACK, EVENT, DRM.

thumbnail Object

The thumbnail configuration. An Object with thumbnail display, thumbnail position and thumbnail style as its properties.

Properties
Name Type Description
display Boolean

Whether to display thumbnails or not. Default is false.

positionInSeconds Number

The postion of the thumbnail to be shown. If positionInSeconds is not set, when display is true, a thumbnail at the current postion will be shown.

style Object

The screen postion, size and styling of the thumbnail to be shown. top, left, width and height are mandatory. borderColor and borderWidth are optional.

Properties
Name Type Description
top Number

top position of the thumbnail

left Number

left position of the thumbnail

width Number

width of the thumbnail

height Number

height of the thumbnail

borderColor any

borderColor of the thumbnail. This can be a string or a number in rgba Format. default is black color

borderWidth Number

borderWidth of the thumbnail. If this is not set border is not shown on the screen.

onLoadStart function

Get called when the video starts loading.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onLoadStart

onLoad function

Get called when the video has finished loading.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onLoad

onTracksChanged function

Called when a change has occurred to the player's tracks (i.e. addition, removal or select/deselect a track).

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onTracksChanged

onTextTrackSelected function

Called when a change to the text track that has been selected (i.e. user select/deselect a track).

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onTextTrackSelected

onAudioTrackSelected function

Called when a change to the audio track that has been selected (i.e. user select/deselect a track).

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onAudioTrackSelected

onProgress function

Called when the video playback progresses.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onProgress

onSeek function

Called when the player has completed a seek operation.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onSeek

onEnd function

Called when the player has completed playback of the video to its end.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onEnd

onPaused function

Called when the player has paused playback of the video.

Application needs to set handler to receive and handle the event.

See OTVPlayer.props.onPaused

onPlay function

Called when the player starts or resumes playback of the video.

Application needs to set handler to receive and handle the event.

See OTVPlayer.props.onPlay.

onError function

Called when OTVPlayerView has encountered an error it will return an errorType, error and error message.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onError

onWaiting function

Called when playback has stalled.

Application needs to set handler to receive and handle the event.

See OTVPlayer.props.onWaiting

onStopped function

Called when the player stop playback of the video, after stop api call.

Application needs to set handler to receive and handle the event.

See OTVPlayer.props.onStopped

onStatisticsUpdate function

Gets called periodically to display the stats.

Application needs to set handler to receive and handle information from the event.

See OTVPlayer.props.onStatisticsUpdate

onDownloadResChanged function

Event triggered when resolution is changed

Application triggers the event from the player to specify the selected resolution

See OTVPlayer.props.onDownloadResChanged

onThumbnailAvailable function

Called when the Thumbnails for the content being played become availible to be shown.

Application needs to set handler to receive and handle the event.

See OTVPlayer.props.onThumbnailAvailable

Type Definitions

OTVPlayer.props.onAudioTrackSelected(event)

Callback set by application to handle event onAudioTrackSelected.

Name Type Description
event Object

The event object.

Name Type Description
index Number

The native index of the audio track.

OTVPlayer.props.onBitratesAvailable(event)

Callback set by application to handle event onBitratesAvailable.

If provided by the App, will be triggered by the RN Plugin once bitrates information is available for a currently played content.

Name Type Description
event Object

The event object.

Name Type Description
bitrates Array.<Number>

Array of bitrates (in bits per second) for the currently selected content.

OTVPlayer.props.onDownloadResChanged(event)

Callback given by application to the player for getting the event onDownloadResChanged.

Name Type Description
event Object

The event object.

Name Type Description
width number

the width, in pixels, to cap the content.

height number

the height, in pixels, to cap the content.

OTVPlayer.props.onEnd(event)

Callback set by application to handle event onEnd.

Name Type Description
event Object

The event object. This will be empty.

OTVPlayer.props.onError(event)

Callback set by application to handle event onError.

Name Type Description
event Object

The event object.

Name Type Description
code number

Refer ERROR_TABLE for error codes.

nativeError Object

Platform specific error object

OTVPlayer.props.onLicenseRequest(keySystem, source, requestPayload, licenseRequestType)

Callback set by application to handle the event onLicenseRequest if application chooses to handle license requests by itself.

If App sets this callback prop, it will be called whenever Player wants App to provide any of the following:

  • license data.
  • Certificate data.
  • Renewed license data.
The App should return a Promise from this callback.
Once the Promise is fulfilled, the data provided should be an ArrayBuffer.
If the Promise is rejected, the playback shall fail and an onError shall be triggered.
If a channel/content change is requested before fulfilling or rejecting a promise, the Player will discard the last Promise.
NOTE: Apps should make sure not to accept/reject Promises which were made for the previous content (if a new content request was made).
NOTE: Currently supported for browser-based SDK only.
Name Type Description
keySystem String

The key System string value:

  • Widevine: "com.widevine.alpha"
  • Playready: "com.microsoft.playready"
  • TVKey: "com.tvkey.drm" (For HbbTV supporting TVKey only)
  • Fairplay: "com.apple.fps" (for Safari and iOS/tvOS devices)
NOTE: Can be the source→drm→type or if source→drm→type not available, the highest security DRM available.
source Object

The source this request is related to:

Name Type Description
src String

The resource URL. Should be what App provided as a prop: source→src.

token String

The token string. Should be what App provided as a prop: source→token. Undefined if not provided as a prop.

type String

Mime type of the src request. Should be what App provided as a prop: source→type. Undefined if not provided as a prop.

requestPayload ArrayBuffer

Payload data to be used for making license request

licenseRequestType String

Request type:

  • "license-request": a new license
  • "license-renewal": a renewal of license
  • "certificate-request": a certificate request (applicable for Widevine and FairPlay only).

OTVPlayer.props.onLoad(event)

Callback set by application to handle event onLoad.

Name Type Description
event Object

The event object.

Name Type Description
duration Number

The duration of the content in seconds.

canPlayReverse Boolean

A Boolean value that indicates whether the item can be played in reverse.

Only for iOS, and the value is true for Android.

canPlayFastForward Boolean

A Boolean value that indicates whether the item can be fast forwarded.

Only for iOS, and the value is true for Android.

canPlaySlowForward Boolean

A Boolean value that indicates whether the item can be played slower than normal.

Only for iOS, and the value is true for Android.

canPlaySlowReverse Boolean

A Boolean value that indicates whether the item can be played slowly backward.

Only for iOS, and the value is true for Android.

canStepBackward Boolean

A Boolean value that indicates whether the item supports stepping backward.

Only for iOS, and the value is true for Android.

canStepForward Boolean

A Boolean value that indicates whether the item supports stepping forward.

Only for iOS, and the value is true for Android.

naturalSize Object

Indicates the natural dimensions of the media data referenced by the track.

Name Type Description
width Number

The width of the media data.

height Number

The height of the media data.

orientation String

"landscape" or "portrait" to indicate the orientation.

OTVPlayer.props.onLoadStart(event)

Callback set by application to handle the event onLoadStart.

Name Type Description
event Object

The event object.

Name Type Description
src String

The Source URI of the media data.

type String

The Source type.

OTVPlayer.props.onPaused(event)

Callback set by application to handle event onPaused.

Name Type Description
event Object

The event object. This will be empty.

See:

OTVPlayer.props.onPlay(event)

Callback set by application to handle event onPlay.

Name Type Description
event Object

The event object. This will be empty.

See:

OTVPlayer.props.onPlaying(event)

Callback set by application to handle event onPlaying.

Name Type Description
event Object

The event object. This will be empty.

OTVPlayer.props.onProgress(event)

Callback set by application to handle event onProgress.

Name Type Description
event Object

The event object.

Name Type Description
currentTime Number

The current time from the content of the playback in seconds.

  • For VOD content, the value is the current playback time between 0 and total duration (event.seekableDuration).
  • For LIVE content, the value is the program date time of the current playback.
currentPosition Number

The current position of the playback in seconds.

playableDuration Number

The duration of the media data.

seekableDuration Number

The seekable duration of the media data.

  • For VOD content, the value is equal to event.playableDuration.
  • For LIVE content, the value is equal to the seekable windows size in seconds.

OTVPlayer.props.onSeek(event)

Callback set by application to handle event onSeek.

Name Type Description
event Object

The event object.

Name Type Description
currentPosition Number

The current position of the playback in seconds.

seekPosition Number

The seek position value set from props.seek.position.

See:

OTVPlayer.props.onSelectedBitrateChanged(event)

Callback set by application to handle event onSelectedBitrateChanged.

If provided by the App, will be triggered by the RN Plugin on every change of bitrate at which the current content is running.
This is the actual rate at which content is running (depending on currently available bandwidth on the Client).

Name Type Description
event Object

The event object.

Name Type Description
bitrate Number

bitrate in bits per second.

OTVPlayer.props.onStatisticsUpdate(event)

Callback set by application to handle the event onStatisticsUpdate and display required statistics.

Name Type Description
event Object

The event object.

Name Type Description
availableBitrates Array

The available bitrates while playback. Applicable for iOS/tvOS, Android and Web(DASH).

selectedBitrate Number

The selected bitrate from the available bitrate. Applicable for iOS/tvOS, Android and Web(DASH).

bitrateSwitches Number

Number of bitrate switches happening from start to the end of the playback. Applicable for iOS/tvOS, Android.

bitrateDowngrade Number

Number of times the bitrate has switched to a lower bitrate. Applicable for iOS/tvOS, Android.

averageVideoBitrate Number

This value indicates the average video bitrate. Applicable for iOS/tvOS.

averageAudioBitrate Number

This value indicates the average audio bitrate. Applicable for iOS/tvOS.

bytesDownloaded Number

The number of bytes downloaded. Applicable for iOS/tvOS, Android.

downloadBitrate Number

The download bitrate. Applicable for iOS/tvOS, Android and Web(DASH).

downloadBitrateAverage Number

The average download bitrate. Applicable for iOS/tvOS, Android and Web(DASH).

numberOfMediaRequests Number

The number of media read requests from the server to this client. The number of media requests Applicable for iOS/tvOS.

transferDuration Number

The accumulated duration, in seconds, of active network transfer of bytes. Applicable for iOS/tvOS.

downloadsOverdue Number

The total number of times that downloading the segments took too long. Applicable for iOS/tvOS.

finalIPAddress String

IPAddress of the playing content. Applicable for iOS/tvOS, Android.

finalURL String

finalURL of the content. Applicable for iOS/tvOS, Android.

url String

url of the content. Applicable for iOS/tvOS, Android and Web(HLS).

numberOfServerAddressChanges Number

A count of changes to the server address over the last uninterrupted period of playback. Applicable for iOS/tvOS.

bufferedDuration Number

The time taken to buffer. Applicable for iOS/tvOS, Android.

availableResolutions ArrayBuffer

This gives the available resolutions as array of Objects. Each object contains width and height. Applicable for iOS/tvOS.

selectedResolution Object

This is the selected resolution width and resolution height. Applicable for iOS/tvOS, Android, Web(DASH) and Web(HLS).

Name Type Description
width Number

Resolution width in pixels.

height Number

Resolution height in pixels.

streamBitrate Number

The stream bitrate. Applicable for Android and Web(DASH).

startUpTime Number

The accumulated duration, in seconds, until the player item is ready to play. Applicable for iOS/tvOS.

numberOfStalls Number

The total number of playback stalls encountered. Applicable for iOS/tvOS.

playbackType String

The playback type - VOD/LIVE. Applicable for iOS/tvOS.

playbackStartDate String

The date and time at which playback began for this event. Applicable for iOS/tvOS.

playbackStartOffset Number

The offset, in seconds, in the playlist where the last uninterrupted period of playback began. Applicable for iOS/tvOS.

frameDrops Number

The number of frame drops. Applicable for iOS/tvOS, Android and Web(DASH).

frameDropsPerSecond Number

The number of frame drops per second. Applicable for iOS/tvOS, Android and Web(DASH).

framesPerSecondNominal Number

{@label iOS} The number of frames per second nominal. Applicable for iOS/tvOS, Android and Web(DASH).

framesPerSecond Number

The number of frames per second. Applicable for iOS/tvOS, Android and Web(DASH).

OTVPlayer.props.onStopped(event)

Callback set by application to handle event onStopped.

Name Type Description
event Object

The event object. This will be empty.

See:

OTVPlayer.props.onTextTrackSelected(event)

Callback set by application to handle event onTextTrackSelected.

Name Type Description
event Object

The event object.

Name Type Description
index Number

The native index of the text track.

OTVPlayer.props.onThumbnailAvailable(event)

Callback set by application to notify when thumbnails are available.

Name Type Description
event Object

The event object. This will be empty.

OTVPlayer.props.onTracksChanged(event)

Callback set by application to handle event onTracksChanged.

Name Type Description
event Object

The event object.

Name Type Description
audioTracks Array.<Object>

Array of available audio tracks.

audioTracks[].title String

The title of the track.

audioTracks[].language String

The language of the track.

audioTracks[].encodeType Number

Refer to AUDIO_ENCODING_TYPE.

audioTracks[].channelCount Number

The count of channels in the track.

audioTracks[].characteristics Array.<String>

Characteristics of the track.

textTracks Array.<Object>

Array of available text tracks.

textTracks[].title String

The title of the track.

textTracks[].language String

The language of the track.

textTracks[].encodeType Number

Refer to TEXT_ENCODING_TYPE.

textTracks[].characteristics Array.<String>

Characteristics of the track.

OTVPlayer.props.onWaiting(event)

Callback set by application to handle event onWaiting.

Name Type Description
event Object

The event object. This will be empty.