Skip to content

Latest commit

 

History

History
1874 lines (1221 loc) · 70.1 KB

File metadata and controls

1874 lines (1221 loc) · 70.1 KB

NexPlayer API

Nexplayer

Type: namespace

Player

Type: global class

Nexplayer methods

nexplayer.Setup(configuration)

Creates and initializes the player.

Type: function of nexplayer Param:

  • configuration is an object which its properties values could be:

Mandatory Parameters:

Param Type Description
key string NexPlayer key to validate the playback.
div HTMLDivElement Div container of the player.
src string Relevant src of the video to be played.

Optional Parameters:

Param Type Description
allowScreenPlayPause boolean Allows to play and pause the video clicking on it.
autohide boolean Sets if the UI must hide when the user does not interact with the video. True by default.
autoplay boolean Determines if the video must start playing or paused. True by default.
blockZoom boolean Determines if the zoom in 360 videos is available or not.
callbackForLogger Function Function to be called when the logger shows a message.
callbackForReturn Function Sets a callback checkSupportedConfigurations(URL, DRMType) to be executed when the corresponding button is clicked.
callbacksForPlayer Function Used for retrieving the nexplayer instance and video element. This is necessary for getting the instance and use the NexPlayer API.
cast boolean Determines if the cast will be enabled or not.
chromecastEndImg string URL of an image to be used as ending.
chromecastLaunchImg string URL of an image to be used at launch.
debug boolean Determines if log information is showed. By default is set to true.
defaultQuality number Sets the starting track through its id. By default is -1, this enables the ABR.
disableFullscreen boolean Determines if the full screen will be enabled.
disableKeyEvents boolean Determines if the keyboard keys can be used to control the video (play/pause, forward/backward and volume up/down).
drm Array<NexDRMInformation> Contains an array of DRM information. By default it's set to null.
externSubtitles Array Used to provide subtitle files as external subtitles.
hideOptionsUi Object Hides the setting that you choose from the UI.
hideScreenPlay boolean Hides the play button in the middle of the video, which appears when the video is paused.
hideVolumeIcon boolean Determines if the volume icon will be hidden for mobile devices. The volume is controlled by the device buttons.
lowLatency boolean Determines if the low latency will be enabled.
liveSettings Object Settings to control live playback. Requires low latency.
logosrc string Company URL logo.
mutedAtStart boolean Determines if the video will start playing muted or not. By default this value is set to false.
pip boolean Determines if picture-in-picture will be enabled.
poster string Video poster URL.
seekUI number Sets the number of seconds the UI buttons will seek forwards or backwards. Set to 10s by default.
showingFullUI boolean Determines if the UI is hidden or not.
showUI360 boolean Determines if the 360UI will be enabled.
srcSets Array Array of objects that contains a stream and an optional DRM.
staticThumbnailsImage string Image to extract thumbnails from.
staticThumbnailsVTT string Used to provide the player an external thumbnails VTT file.
startingBufferLength number Determines the buffer that the video should have before start.
startFullscreen boolean Determines if the video will start on full screen.
subtitle string Video subtitle name.
timeUI boolean Determines if the video time will be hidden on the UI.
title string Video name.
type_360 string Selects the 360 video format to play. Possible values are 'equirectangular', 'cubemap' and 'topdown'.
useDynamicThumbnails boolean Determines if dynamic thumbnails are used. By default this value is set to false.
useiOSFullScreen boolean Determines if the iOS native full screen will be used.
vast string Advertisement URL that is going to be played. VAST, VPAID and VMAP are supported.
watermark Object Watermark image URL.
withCredentials boolean Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates.
cmcd Object Enables the Common Media Client Data. Only needs to create an empty object to enable it.
licenseWithCredentials boolean Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates with DRM.
maxFrameDrop number The value of this property should be within the range 0 - 1. A Frames_Drop_Capping event will be triggered whenever the percentage of frames dropped is higher than this threshold.
xhrSetHeader Array You can configure the headers that are necessary for the URL request.

nexplayer.checkSupportedConfigurations(URL, DRMType)

Check if the audio and video codecs and DRMType, if it is provided, are supported by the device.

Type: function of nexplayer Params:

  • URL: manifest URL of the video.
  • DRMType: optional type of DRM (e.g., "com.microsoft.playready" ) Returns: A Promise. If it is resolved returns a MediaKeySystemAccess object with the supported codecs, and if it is rejected returns a string with the error.

nexplayer.Reload(configuration)

Reloads the player with the given configuration. If the configuration object is not provided the previous one will be used. If it is provided the properties passed will override the values of the previous configuration object.

Type: function of nexplayer Param:

  • configuration is an object which its properties values could be:

Mandatory Parameters:

Param Type Description
key string NexPlayer key to validate the playback.
div HTMLDivElement Div container of the player.
src string Relevant src of the video to be played.

Optional Parameters:

Param Type Description
allowScreenPlayPause boolean Allows to play and pause the video clicking on it.
autohide boolean Sets if the UI must hide when the user does not interact with the video. True by default.
autoplay boolean Determines if the video must start playing or paused. True by default.
blockZoom boolean Determines if the zoom in 360 videos is available or not.
callbackForLogger Function Function to be called when the logger shows a message.
callbackForReturn Function Sets a callback checkSupportedConfigurations(URL, DRMType) to be executed when the corresponding button is clicked.
callbacksForPlayer Function Used for retrieving the nexplayer instance and video element. This is necessary for getting the instance and use the NexPlayer API.
cast boolean Determines if the cast will be enabled or not.
chromecastEndImg string URL of an image to be used as ending.
chromecastLaunchImg string URL of an image to be used at launch.
debug boolean Determines if log information is showed. By default is set to true.
defaultQuality number Sets the starting track through its id. By default is -1, this enables the ABR.
disableFullscreen boolean Determines if the full screen will be enabled.
disableKeyEvents boolean Determines if the keyboard keys can be used to control the video (play/pause, forward/backward and volume up/down).
drm Array<NexDRMInformation> Contains an array of DRM information. By default it's set to null.
externSubtitles Array Used to provide subtitle files as external subtitles.
hideOptionsUi Object Hides the setting that you choose from the UI.
hideScreenPlay boolean Hides the play button in the middle of the video, which appears when the video is paused.
hideVolumeIcon boolean Determines if the volume icon will be hidden for mobile devices. The volume is controlled by the device buttons.
lowLatency boolean Determines if the low latency will be enabled.
liveSettings Object Settings to control live playback. Requires low latency.
logosrc string Company URL logo.
mutedAtStart boolean Determines if the video will start playing muted or not. By default this value is set to false.
pip boolean Determines if picture-in-picture will be enabled.
poster string Video poster URL.
seekUI number Sets the number of seconds the UI buttons will seek forwards or backwards. Set to 10s by default.
showingFullUI boolean Determines if the UI is hidden or not.
showUI360 boolean Determines if the 360UI will be enabled.
srcSets Array Array of objects that contains a stream and an optional DRM.
staticThumbnailsImage string Image to extract thumbnails from.
staticThumbnailsVTT string Used to provide the player an external thumbnails VTT file.
startingBufferLength number Determines the buffer that the video should have before start.
startFullscreen boolean Determines if the video will start on full screen.
subtitle string Video subtitle name.
timeUI boolean Determines if the video time will be hidden on the UI.
title string Video name.
type_360 string Selects the 360 video format to play. Possible values are 'equirectangular', 'cubemap' and 'topdown'.
useDynamicThumbnails boolean Determines if dynamic thumbnails are used. By default this value is set to false.
useiOSFullScreen boolean Determines if the iOS native full screen will be used.
vast string Advertisement URL that is going to be played. VAST, VPAID and VMAP are supported.
watermark object Watermark image URL.
withCredentials boolean Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates.
cmcd Object Enables the Common Media Client Data. Only needs to create an empty object to enable it.
licenseWithCredentials boolean Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates with DRM.
maxFrameDrop number The value of this property should be within the range 0 - 1. A Frames_Drop_Capping event will be triggered whenever the percentage of frames dropped is higher than this threshold.
xhrSetHeader Array You can configure the headers that are necessary for the URL request.

nexplayer.decodeData(data)

Decodes an ArrayBuffer and converts it into a string. END OF TEXT (\u0003) and NULL (\u0000) unicode characters are cleaned.

Type: function of nexplayer

Param:

  • data is the ArrayBuffer to decode.

Returns: decoded and cleaned string or null if the parameter provided is not an ArrayBuffer.

Player methods and objects

player.getTracks() ⇒ Array.< Track >

Gets all of the videoes avaliable tracks (different qualities).

Type: instance method of Player Returns: Array.< Track > - all the tracks available.

player.getCurrentTrack() ⇒ Track

Get the current track information.

Type: instance method of Player Returns: Track - the current track.

player.setCurrentTrack(trackID)

Sets the current track.

Type: instance method of Player Export:

Param Type Description
trackID number ID of the track to be used.

player.enableABR()

Enables the ABR to change automatically between tracks.

Type: instance method of Player

player.disableABR()

Disables the ABR to prevent the player from changing tracks regardless of bandwidth.

Type: instance method of Player

player.getAudioStreams() ⇒ Array.< AudioStream >

Get the available audio streams.

Type: instance method of Player Returns: An array - which contains the available audio streams.

player.getCurrentAudioStream() ⇒ AudioStream

Get the audio stream currently in use.

Type: instance method of Player Returns: AudioStream - the current audio track.

player.setAudioStream(streamID)

Sets the current audio stream.

Type: instance method of Player Export:

Param Type Description
streamID number ID of the audio stream to be used.

player.getCurrentSubtitle()

Gets the current subtitle info.

Type: instance method of Player Returns: Current Subtitle - the current subtitle track (undefined if no subtitles are activated).

player.getSubtitles()

Gets all the avaliable subtitle tracks info.

Type: instance method of Player Returns: Array of subtitles - the subtitle tracks of the video.

player.setSubtitle(subID)

Sets the current subtitle track.

Type: instance method of Player Export:

Param Type Description
subID number ID of the subtitle track to be used

player.isLive() ⇒ boolean

Informs whether the video is live or on demand (VOD). This needs to be called when the manifest is finally loaded. It is recommended to use within the video "loadeddata" event.

Type: instance method of Player Returns: boolean - true if the video is live, otherwise it returns false.

player.on(callbackType, functionToBeCalled)

Adds a listener for Events.

Type: instance method of Player Export:

Param Type Description
callbackType NexEvent Event to listen for
functionToBeCalled NexCallbackEvent Function called on each event

player.attachSubtitleRendererDiv(subtitleRendererDiv)

Adds a DIV to render certain subtitles in a more precise way. This is optional and the native subtitles of the video element will be used if this is not set.

Type: instance method of Player Export:

Param Type Description
subtilteRendererDiv SubtitleRendererDiv DIV to render some advanced subtitles

player.create360View()

Creates the 360 view.

Type: instance method of Player

player.FairPlayNexLicenseRequestLoaded(event)

Called when the FairPlay request is done.

Type: instance method of Player Export:

Param Description
event Event

player.FairPlayNexLicenseRequestFailed(event)

Called if the FairPlay request fails.

Type: instance method of Player Export:

Param Description
event Event

player.setThumbnailResources(callback, vttURl, imageURL)

Sets thumbnail resources. This method should be called before Init().

Type: instance method of Player Export:

Param Type Description
callback NexCallbackEvent function called when the thumbnails are loaded
vttURl String path to the .vtt thumbnails file
imageURL String path to the thumbnails image file

player.isUTC() ⇒ boolean

Indicates whether the video information (currentTime, duration, seekable range, etc.) of the video element is based on the present or on an absolute value that starts at midnight UTC, Jan 1, 1970. If this is true, you will need to take this into account when seeking through the currentTime of the video element. Some useful methods (like getCurrentTime, getDuration, and seek) are available to reduce the complexity in these cases. Note that this property only applies to live streams.

Type: instance method of Player Returns: boolean - true if the video information is using UTC, false otherwise.

player.getCurrentTime() ⇒ number

Returns the currentTime taking into account isUTC (if isUTC is true, getCurrentTime's returned value will be different from the time of the video element).

Type: instance method of Player Returns: number - the current time of the video.

player.getDuration() ⇒ number

Returns the duration taking into account isUTC (if isUTC is true, getDuration's returned value will be different from the duration of the video element).

Type: instance method of Player Returns: number - the duration of the video.

player.getDVRWindowSize() ⇒ number

Returns the window of allowable play time behind the live point of a live stream, this value will increase until the buffer is full, with the full content, at that point of time, the value will be constant.

Type: instance method of Player Returns: number - the window of allowable play time behind the live point of a live stream.

player.getURL()

Returns the current video URL.

Type: instance method of Player Returns: String

player.checkFrameDrop() ⇒ number

Returns the number of dropped frames as proxy for CPU load

Type: instance method of Player Returns: number - number of dropped frames.

player.seek(value)

Sets the currentTime property of the attached video element. (if isUTC is true, the seek value will be in a different format than the currentTime of the video element).

Type: instance method of Player

Param Type Description
event Event value in seconds that the player will seek to.
 //Non-live video
 player.seek(120) // This will seek forward 120 seconds (2:00 minutes), must be a positive number ranging from 0 to the full duration of the video in seconds
 //Live video
 player.seek(-120) // It jumps back 120 seconds (2:00 minutes) from the current live time, must be a negative number ranging from minus {the DVR window size} to 0

player.seekLive()

Jump to the livestream current time from the current position (if isUTC is true, the seek value will be in a different format than the currentTime of the video element). Only works on livestreams.

Type: instance method of Player

player.getBufferLength() ⇒ number

Returns the seconds of buffer loaded that the player has available to play.

Type: instance method of Player Returns: number - time of buffer length

player.getCurrentLiveTime() ⇒ number

Returns the time in which the livestream is at.

Type: instance method of Player Returns: number - time in which the livestream is at.

player.getTimeUntilLive() ⇒ number

Returns the time difference between the current video time and the livestream time.

Type: instance method of Player Returns: number - time difference between the time it's currently found in and the time the livestream is at.

player.getManifestInfo()

Returns some information about the manifest.

Type: instance method of Player Returns: number - some information about the manifest.

player.getTimeShiftBufferDepth ⇒ number

Returns the time shift buffer depth in seconds, this function only works in live streams.

Type: instance method of Player Returns: number - time shift buffer depth

player.getProtocol() ⇒ number

Returns the protocol type.

Type: instance method of Player Returns: number - the protocol type.

player.getThumbnailController() ⇒ ThumbController

Returns the preview thumbnail controller.

Type: instance method of Player Returns: ThumbController - Thumbnail controller

player.setThumbnailStep(step)

Sets the time interval between frames for dynamic thumbnails.

Type: instance method of Player

Param Type Description
step number The seconds between two different thumbnails.

player.enablePreviewThumbnails(option)

Enable thumbnails preview. This method must be called before Init().

Type: instance method of Player

Param Type Description
option boolean The value that enable or not the thumbnails.

player.setSpeed(speed)

Set the video playback speed.

Type: instance method of Player

Param Type Description
speed number The speed value.

#### player.getQualityLevels() ⇒ array

Get the video quality levels array.

Type: instance method of Player Returns: array - quality levels array info

player.togglePlayPause()

Plays or pauses the playback.

Type: instance method of Player

player.toggleFullScreen()

Toggles between full screen or window mode.

Type: instance method of Player

player.showStats()

Displays basic stream information when typing "nex" on the keyboard.

Type: instance method of Player

player.jumpForward(value)

Jumps forward to the current playback position of the player.

Type: instance method of Player Param: {number} value is the number of seconds to jump forward

player.jumpBackward(value)

Jumps backward to the current playback position of the player.

Type: instance method of Player Param: {number} value is the number of seconds to jump backward

player.setThumbnailStep(step)

Sets the step for dynamic thumbnails.

Type: instance method of Player Param: {number} step is the seconds between two different thumbnails

player.getCurrentLiveLatency()

Returns the live latency value.

Type: instance method of Player Returns: latency number of seconds

player.getCurrentBuffer()

Returns the current buffer level.

Type: instance method of Player

player.isControlBarOpen()

Returns if the control bar is opened.

Type: instance method of Player Returns: boolean

player.toggleLanguagesMenu()

Toggles the subtitle menu options.

Type: instance method of Player

player.loadSource(url)

Change the URL of the content without changing the instance.

Type: instance method of Player

player.nextFocus()

Moves along to the next element that can be focused. The possible elements to be focused are: 'nexplayer_play_pause', 'nexplayer_full_volume_div', 'nexplayer_language', 'nexplayer_full_screen', 'nexplayer_return_container'

Type: instance method of Player

player.previousFocus()

Moves along to the previous element that can be focused. The possible elements to be focused are: 'nexplayer_play_pause', 'nexplayer_full_volume_div', 'nexplayer_language', 'nexplayer_full_screen', 'nexplayer_return_container'.

Type: instance method of Player

player.clickFocus()

Click the current focused element.

Type: instance method of Player

player.toggleBar()

Hides or shows the playback bar.

Type: instance method of Player

player.isFullScreen()

Informs if the video is full screen or not

Type: instance method of Player.Player

Returns: boolean - true if the video is fullscreen, otherwise it returns false.

player.getConfig()

Returns the parameters defined in the set up, for that video

Type: instance method of Player.Player

player.getPlaybackSpeed()

Returns the play back speed.

Type: instance method of Player Returns: Number

player.getStreamType()

Returns the type of video (DASH/ HLS/ mp4 ...)

Type: instance method of Player Returns: String

player.hasEnded()

Returns true if the video has ended.

Type: instance method of Player Returns: boolean

player.isAd()

Returns true while an ad is played back or content playback has been paused for ad playback, false otherwise.

Type: instance method of Player Returns: boolean

player.isPaused()

Returns true if the video state is paused, otherwise false

Type: instance method of Player Returns: boolean

player.isPlaying()

Returns true if the video state is playing, otherwise false

Type: instance method of Player Returns: boolean

player.isReady()

Returns true if the player has finished initialization and is ready to use and to handle other API calls.

Type: instance method of Player Returns: boolean

player.enterPictureInPicture()

To enter picture in picture mode

Type: instance method of Player

player.exitPictureInPicture()

To exit picture in picture mode

Type: instance method of Player

player.isPictureInPicture()

Returns true if the video is in picture in picture, otherwise false.

Type: instance method of Player Returns: boolean

player.isPictureInPictureAvailable()

Return true if pictur in pictur mode is supported for the browser, otherwise false.

Type: instance method of Player Returns: boolean

player.getVersion()

Returns the version of the SDK.

Type: instance method of Player Returns: String

player.hiddenVolumeIcon()

Hides the volume icon.

Type: instance method of Player

player.showVolumeIcon()

Shows the volume icon.

Type: instance method of Player

player.getThumbnailAt(number)

Get the thumbnail at a specific video time.

Param Type Description
Time number Get thumbnails at the given time.

Type: instance method of Player

Returns: Promise <Frame, object> - Frame as resolve, and object which contains details as a reject.

Ad methods

player.adManager()

Returns the AdManager instance in order to perform actions on ads through the IMA SDK.

Type: instance method of Player Returns: AdManager object

player.adManager().getAdObject()

Returns the IMA SDK manager object.

Type: instance method of Player Returns: IMAs AdManager object

player.adManager().getId()

Returns the ID of the current ad.

Type: instance method of Player Returns: String

player.adManager().getTitle()

Returns the title of the current ad.

Type: instance method of Player Returns: String

player.adManager().getDescription()

Returns the description of the current ad.

Type: instance method of Player Returns: String

player.adManager().getMediaUrl()

Returns the video ad URL.

Type: instance method of Player Returns: String

player.adManager().getSurveyURL()

Returns the ad survey URL.

Type: instance method of Player Returns: String

player.adManager().getDuration()

Returns the total duration of the current ad.

Type: instance method of Player Returns: number

player.adManager().getSkipTime()

Returns how much time is left until the user can skip the ad (only if it is skippable).

Type: instance method of Player Returns: number

player.adManager().getCurrentTime()

Returns the current time position of the ad.

Type: instance method of Player Returns: number

player.adManager().getContentType()

Returns the ad video type (e.g. "video/mp4").

Type: instance method of Player Returns: String

player.adManager().isSkippable()

Returns whether the ad is skippable or not.

Type: instance method of Player Returns: boolean

player.adManager().isLinear()

Returns whether the ad is linear or not.

Type: instance method of Player Returns: boolean

player.adManager().isVpaid()

Returns whether the ad is in the VPAID format or not.

Type: instance method of Player Returns: boolean

player.adManager().pause()

Pauses the ad.

Type: instance method of Player

player.adManager().play()

Plays the ad when it is paused.

Type: instance method of Player

player.adManager().skip()

Skips the ad (if possible).

Type: instance method of Player

player.adManager().abort()

Closes the ad and starts the video.

Type: instance method of Player

player.adManager().setVolume(value)

Set the volume for the current ad.

Type: instance method of Player

Param Type Description
value number The volume to set, from 0 (muted) to 1 (loudest).

player.adManager().destroy()

Removes ad assets loaded at runtime that need to be properly removed at the time of ad completion and stops the ad and all tracking.

Type: instance method of Player

player.adManager().discardAdBreak()

If an ad break is currently playing, discard it and resume content. Otherwise, ignore the next scheduled ad break. For example, this can be called immediately after the ads manager loads to ignore a preroll without losing future midrolls or postrolls. This is a no-op unless the ad request returned a playlist or VMAP response.

Type: instance method of Player

player.adManager().focus()

Puts the focus on the skip button, if exists. Otherwise, the focus is put on interactive elements, including icons or interactive creatives.

Type: instance method of Player

player.adManager().getAdSkippableState()

Returns true if the current ad can be skipped.

Return: boolean True if the current ad can be skipped, false otherwise.

Type: instance method of Player

player.adManager().getCuePoints()

Returns an array of offsets in seconds indicating when a scheduled ad break will play. A preroll is represented by 0, and a postroll is represented by -1. An empty array indicates the ad or ad pod has no schedule and can be played at any time.

Return non-null Array of number List of time offsets in seconds.

Type: instance method of Player

player.adManager().getRemainingTime()

Get the remaining time of the current ad that is playing. If the ad is not loaded yet or has finished playing, the API would return -1.

Return number Returns the time remaining for current ad. If the remaining time is undefined for the current ad (for example custom ads), the value returns -1.

Type: instance method of Player

player.adManager().getVolume()

Get the volume for the current ad.

Return number The volume of the current ad, from 0 (muted) to 1 (loudest).

Type: instance method of Player

player.adManager().init(width, height, viewMode, videoElement)

Call init to initialize the ad experience on the ads manager.

Get the volume for the current ad.

Param Type Description
width number The desired width of the ad.
height number The desired height of the ad.
viewMode viewMode The desired view mode. Value must not be null.
videoElement Optional HTMLVideoElement The video element for custom playback. This video element overrides the one provided in the AdDisplayContainer constructor. Only use this property if absolutely necessary - otherwise we recommend specifying this video element while creating the AdDisplayContainer. Value may be null.

Type: instance method of Player

player.adManager().isCustomPlaybackUsed()

Returns true if a custom video element is being used to play the current ad.

Return boolean Whether custom playback is used.

Type: instance method of Player

player.adManager().resize(width, height, viewMode)

Resizes the current ad.

Param Type Description
width number New ad slot width.
height number New ad slot height.
viewMode viewMode The new view mode. Value must not be null.

Type: instance method of Player

player.adManager().getAdSystem()

The source ad server information included in the ad response.

Return: string The source ad server of the ad, or the empty string if this information is unavailable.

Type: instance method of Player

player.adManager().getAdvertiserName()

The advertiser name as defined by the serving party.

Return: string The advertiser name, or the empty string if this information is unavailable.

Type: instance method of Player

player.adManager().getApiFramework()

Identifies the API needed to execute the ad. This corresponds with the apiFramework specified in vast.

Return: nullable string The API framework need to execute the ad, or null if this information is unavailable.

Type: instance method of Player

player.adManager().getCreativeAdId()

Returns the ISCI (Industry Standard Commercial Identifier) code for an ad, or empty string if the code is unavailable. This is the Ad-ID of the creative in the VAST response.

Return: string

Type: instance method of Player

player.adManager().getCreativeId()

Retrieves the ID of the selected creative for the ad.

Return: stringThe ID of the selected creative for the ad, or the empty string if this information is unavailable.

Type: instance method of Player

player.adManager().getDealId()

Returns the first deal ID present in the wrapper chain for the current ad, starting from the top. Returns the empty string if unavailable.

Return: string

Type: instance method of Player

player.adManager().getHeight()

Returns the height of the selected non-linear creative.

Return: number The height of the selected non-linear creative or 0 for a linear creative.

Type: instance method of Player

player.adManager().getMinSuggestedDuration()

Returns the minimum suggested duration in seconds that the nonlinear creative should be displayed. Returns -2 if the minimum suggested duration is unknown. For linear creative it returns the entire duration of the ad.

Return: number The minimum suggested duration in seconds that a creative should be displayed.

Type: instance method of Player

player.adManager().getTraffickingParameters()

Gets custom parameters associated with the ad at the time of ad trafficking.

Return: non-null Object with string properties A mapping of trafficking keys to their values, or the empty Object if this information is not available.

Type: instance method of Player

player.adManager().getTraffickingParametersString()

Gets custom parameters associated with the ad at the time of ad trafficking. Returns a raw string version of the parsed parameters from getTraffickingParameters.

Return: string Trafficking parameters, or the empty string if this information is not available.

Type: instance method of Player

player.adManager().getUiElements()

Returns the UI elements that are being displayed when this ad is played. Refer to UiElements for possible elements of the array returned.

Return: non-null Array of string The UI elements being displayed.

Type: instance method of Player

player.adManager().getUniversalAdIdRegistry()

The registry associated with cataloging the UniversalAdId of the selected creative for the ad.

Deprecated: Use ad.getUniversalAdIds() instead.

Return: string Returns the registry value, or "unknown" if unavailable.

Type: instance method of Player

player.adManager().getUniversalAdIds()

The list of UniversalAdIds of the selected creative for the ad.

Return: non-null Array of non-null UniversalAdIdInfo Returns the list of universal ad ID information that applies for this ad.

Type: instance method of Player

player.adManager().getUniversalAdIdValue()

The UniversalAdId of the selected creative for the ad.

Deprecated: Use ad.getUniversalAdIds() instead.

Return: string Returns the id value or "unknown" if unavailable.

Type: instance method of Player

player.adManager().getVastMediaBitrate()

When both the creative and the media file have been selected by the SDK, this will return the bitrate for the media file as listed in the vast response.

Return: number The bitrate for the selected media file or 0.

Type: instance method of Player

player.adManager().getVastMediaHeight()

Returns the VAST media height of the selected creative.

Return: number The VAST media height of the selected creative or 0 if none is selected.

Type: instance method of Player

player.adManager().getVastMediaWidth()

Returns the VAST media width of the selected creative.

Return: number The VAST media width of the selected creative or 0 if none is selected.

Type: instance method of Player

player.adManager().getWidth()

Returns the width of the selected creative.

Return: number The width of the selected non-linear creative or 0 for a linear creative.

Type: instance method of Player

player.adManager().getWrapperAdIds()

Ad IDs used for wrapper ads. The IDs returned starts at the inline ad (innermost) and traverses to the outermost wrapper ad. An empty array is returned if there are no wrapper ads.

Return: non-null Array of string The IDs of the ads, starting at the inline ad, or an empty array if there are no wrapper ads.

Type: instance method of Player

player.adManager().getWrapperAdSystems()

Ad systems used for wrapper ads. The ad systems returned starts at the inline ad and traverses to the outermost wrapper ad. An empty array is returned if there are no wrapper ads.

Return: non-null Array of string The ad systems of the ads, starting at the inline ad, or an empty array if there are no wrapper ads.

Type: instance method of Player

player.adManager().getWrapperCreativeIds()

Selected creative IDs used for wrapper ads. The creative IDs returned starts at the inline ad and traverses to the outermost wrapper ad. An empty array is returned if there are no wrapper ads.

Return: non-null Array of string The IDs of the ads' creatives, starting at the inline ad, or an empty array if there are no wrapper ads.

Type: instance method of Player

player.adManager().islinear()

Indicates whether the ad’s current mode of operation is linear or non-linear. If the value is true, it indicates that the ad is in linear playback mode; if false, it indicates non-linear mode. The player checks the linear property and updates its state according to the details of the ad placement. While the ad is in linear mode, the player pauses the content video. If linear is true initially, and the ad is a pre-roll (defined externally), the player may choose to delay loading the content video until near the end of the ad playback.

Return: boolean True if the ad is linear, false otherwise.

Type: instance method of Player

player.adManager().addClickListener(func)

Sets a listener function called each time the user clicks on the ad.

Type: instance method of Player

Param Type Description
func function the function called when the user clicks on the ad

player.adManager().addVolumeMutedListener(func)

Sets a listener function called each time the user mutes the ad's volume.

Type: instance method of Player

Param Type Description
func function the function called when the user mutes the ad

player.adManager().addVolumeChangedListener(func)

Sets a listener function called each time the user changes the ad's volume.

Type: instance method of Player

Param Type Description
func function the function called when the user changes the ad's volume

player.adManager().addSkippedListener(func)

Sets a listener function called each time the user skips the ad.

Type: instance method of Player

Param Type Description
func function the function called when the user skips the ad

player.adManager().addPausedListener(func)

Sets a listener function called each time the user pauses the ad.

Type: instance method of Player

Param Type Description
func function the function called when the user pauses the ad

player.adManager().addResumedListener(func)

Sets a listener function called each time the user resumes the ad.

Type: instance method of Player

Param Type Description
func function the function called when the user resumes the ad

player.adManager().addStartedListener(func)

Sets a listener function called when the ad starts.

Type: instance method of Player

Param Type Description
func function the function called when the ad starts

player.adManager().addFirstQuartileListener(func)

Sets a listener function called when the ad reaches the first quartile of the video duration.

Type: instance method of Player

Param Type Description
func function the function called when the ad reaches the first quartile of the video duration

player.adManager().addMidpointListener(func)

Sets a listener function called when the ad reaches the middle of the video duration.

Type: instance method of Player

Param Type Description
func function the function called when the ad reaches the middle of the video duration

player.adManager().addThirdQuartileListener(func)

Sets a listener function called when the ad reaches the third quartile of the video duration.

Type: instance method of Player

Param Type Description
func function the function called when the ad reaches the third quartile of the video duration

player.adManager().addCompleteListener(func)

Sets a listener function called when the ad finishes.

Type: instance method of Player

Param Type Description
func function the function called when the ad finishes

player.adManager().addImpressionListener(func)

Sets a listener function called when the impression URL has been pinged.

Type: instance method of Player

Param Type Description
func function the function called when the impression URL has been pinged

player.adManager().addErrorListener(func)

Sets a listener function called when the ad fails during loading or playing.

Type: instance method of Player

Param Type Description
func function the function called when the ad fails during loading or playing

player.adManager().addBlockedListener(func)

Sets a listener function called when the ad is blocked by an external app.

Type: instance method of Player

Param Type Description
func function the function called when the ad is blocked by an external app

Static

Player.NexProtocol : enum

Type: static enum of Player Read only: true Properties:

Name Type Default
HLS number 0
DASH number 1
PROGRESSIVE_DOWNLOAD number 2
UNKNOWN number 3
OTHER number 4

Player.NexEvent : enum

Type: static enum of Player Read only: true Properties:

Name Type Default
Track_Change number 0
Fragment_Loading_Completed number 1
Player_Destroyed number 2
Speed_Change number 3
Error number 4
Cue_Change number 5
Fragment_Buffered number 6
Playlist_Loading_Completed number 7
Fragment_Loading number 8
Invalid_License number 9
Frames_Drop_Capping number 10

Player.THUMB_TYPE : enum

Type: static enum of Player Read only: true Properties:

Name Type Default
STATIC_THUMBNAILS number 0
DYNAMIC_THUMBNAILS number 1

Global Typedef

NexCallbackEvent : function

Called when a NexEvent happens.

Type: global typedef

NexCallback : function

Called when a FairPlay content needs to request the license.

Type: global typedef

Param Description
event when the webkitkeymessage event from FairPlay is called.

NexHeaders : Object

Type: global typedef Properties:

Name Type Description
FieldName string of the HTTPHeaders.
FieldValue string of the HTTPHeaders.

NexDRMInformation : Object

Type: global typedef Properties:

Name Type Description
NexDRMType string NexDRMType of the video.
NexDRMKey string NexDRMKey of the video.
NexHeaders Array.<NexHeaders> NexHeaders of the video.
NexCallback NexCallback NexCallback for FairPlay content.

Track : Object

Type: global typedef Properties:

Name Type Description
width number width of the video.
height number height of the video.
bitrate number bitrate of the video.
id number id of the video.
  • Bitrate property is not available on Safari iOS, Fairplay protected videos on Safari Mac OS or .mp4 videos.

AudioStream : Object

Type: global typedef Properties:

Name Type Description
id number id of the stream.
language number language of the stream.
name number name of the stream.

Frame : Object

Type: global typedef Properties:

Name Type Description
f canvas Thumbnail canvas instance.
w number Width.
h number Height.
st number Thumbnail starting time.
ft number Thumbnail ending time.

VR Player

player.setFieldView()

Set the field of view.

Type: instance method of Player

Param Type Description
fov number the fov value.

player.getFieldView()

get the field of view.

Type: instance method of Player Returns: number

Multiview

multiview.additionalVideo(info)

Creates and initializes the player.

Type: function of nexplayer Param:

  • configuration is an object which its properties values could be:

Mandatory Parameters:

Param Type Description
key string NexPlayer key to validate the playback.
div HTMLDivElement Div container of the player.
src string Relevant src of the video to be played.

Optional Parameters:

Param Type Description
allowScreenPlayPause boolean Allows to play and pause the video clicking on it.
autohide boolean Sets if the UI must hide when the user does not interact with the video. True by default.
autoplay boolean Determines if the video must start playing or paused. True by default.
blockZoom boolean Determines if the zoom in 360 videos is available or not.
callbackForLogger Function Function to be called when the logger shows a message.
callbackForReturn Function Sets a callback checkSupportedConfigurations(URL, DRMType) to be executed when the corresponding button is clicked.
callbacksForPlayer Function Used for retrieving the nexplayer instance and video element. This is necessary for getting the instance and use the NexPlayer API.
cast boolean Determines if the cast will be enabled or not.
chromecastEndImg string URL of an image to be used as ending.
chromecastLaunchImg string URL of an image to be used at launch.
debug boolean Determines if log information is showed. By default is set to true.
defaultQuality number Sets the starting track through its id. By default is -1, this enables the ABR.
disableFullscreen boolean Determines if the full screen will be enabled.
disableKeyEvents boolean Determines if the keyboard keys can be used to control the video (play/pause, forward/backward and volume up/down).
drm Array<NexDRMInformation> Contains an array of DRM information. By default it's set to null.
externSubtitles Array Used to provide subtitle files as external subtitles.
hideOptionsUi Object Hides the setting that you choose from the UI.
hideScreenPlay boolean Hides the play button in the middle of the video, which appears when the video is paused.
hideVolumeIcon boolean Determines if the volume icon will be hidden for mobile devices. The volume is controlled by the device buttons.
lowLatency boolean Determines if the low latency will be enabled.
liveSettings Object Settings to control live playback. Requires low latency.
logosrc string Company URL logo.
mutedAtStart boolean Determines if the video will start playing muted or not. By default this value is set to false.
pip boolean Determines if picture-in-picture will be enabled.
poster string Video poster URL.
seekUI number Sets the number of seconds the UI buttons will seek forwards or backwards. Set to 10s by default.
showingFullUI boolean Determines if the UI is hidden or not.
showUI360 boolean Determines if the 360UI will be enabled.
srcSets Array Array of objects that contains a stream and an optional DRM.
staticThumbnailsImage string Image to extract thumbnails from.
staticThumbnailsVTT string Used to provide the player an external thumbnails VTT file.
startingBufferLength number Determines the buffer that the video should have before start.
startFullscreen boolean Determines if the video will start on full screen.
subtitle string Video subtitle name.
timeUI boolean Determines if the video time will be hidden on the UI.
title string Video name.
type_360 string Selects the 360 video format to play. Possible values are 'equirectangular', 'cubemap' and 'topdown'.
useDynamicThumbnails boolean Determines if dynamic thumbnails are used. By default this value is set to false.
useiOSFullScreen boolean Determines if the iOS native full screen will be used.
vast string Advertisement URL that is going to be played. VAST, VPAID and VMAP are supported.
watermark object Watermark image URL.
withCredentials boolean Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates.
cmcd Object Enables the Common Media Client Data. Only needs to create an empty object to enable it.
licenseWithCredentials boolean Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates with DRM.
maxFrameDrop number The value of this property should be within the range 0 - 1. A Frames_Drop_Capping event will be triggered whenever the percentage of frames dropped is higher than this threshold.
xhrSetHeader Array You can configure the headers that are necessary for the URL request.

multiview.addPlayer(player)

This method stores each new player which will allow the MultipleView instance to control all the videos.

Type: instance method of Player

multiview.Initialize()

This method only has to be called once in the index and starts all the videos sequentially. It must be called after all videos are set.

Type: instance method of Player

multiview.togglePlayPause()

Enables toggle between play and pause.

Type: instance method of Player

multiview.seek(value)

Sets the currentTime property of the attached video element. (if isUTC is true, the seek value will be in a different format than the currentTime of the video element).

Type: instance method of Player

Param Type Description
event Event value in seconds that the player will seek to.

multiview.seekLive()

Jump to the livestream current time from the current position (if isUTC is true, the seek value will be in a different format than the currentTime of the video element). only works in livestream.

Type: instance method of Player

Youtube Player

YouTubePlayer.init()

Initialise the youtube player

YouTubePlayer.URL(url)

Parse youtube url to extract the id of the video

Type: instance method of Player