# Module: MediaPlayer

The MediaPlayer is the primary dash.js Module and a Facade to build your player around.
It will allow you access to all the important dash.js properties/methods via the public API and all the
events to build a robust DASH media player.

Source:
  - streaming/MediaPlayer.js, line 89

### Members

#### <inner, constant> ELEMENT_NOT_ATTACHED_ERROR :string

  error string thrown when a function is called before the dash.js has received a reference of an HTML5 video element

  ##### Type:

  - string
  Source:
    - streaming/MediaPlayer.js, line 106

#### <inner, constant> MEDIA_PLAYER_NOT_INITIALIZED_ERROR :string

  error string thrown when a function is called before the dash.js has been fully initialized.

  ##### Type:

  - string
  Source:
    - streaming/MediaPlayer.js, line 116

#### <inner, constant> PLAYBACK_NOT_INITIALIZED_ERROR :string

  error string thrown when a function is called before the dash.js has been fully initialized

  ##### Type:

  - string
  Source:
    - streaming/MediaPlayer.js, line 101

#### <inner, constant> SOURCE_NOT_ATTACHED_ERROR :string

  error string thrown when a function is called before the dash.js has received a valid source stream.

  ##### Type:

  - string
  Source:
    - streaming/MediaPlayer.js, line 111

#### <inner, constant> STREAMING_NOT_INITIALIZED_ERROR :string

  error string thrown when a function is called before the dash.js has been fully initialized

  ##### Type:

  - string
  Source:
    - streaming/MediaPlayer.js, line 96

### Methods

#### addABRCustomRule(type, rulename, rule)

  Add a custom ABR Rule
  Rule will be apply on next stream if a stream is being played

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | string | rule type (one of ['qualitySwitchRules','abandonFragmentRules'])
  `rulename` | string | name of rule (used to identify custom rule). If one rule of same name has been added, then existing rule will be updated
  `rule` | object | the rule object instance

  Source:
    - streaming/MediaPlayer.js, line 1102

  ##### Throws:

  `BAD_ARGUMENT_ERROR` if called with invalid arguments.

#### addUTCTimingSource(schemeIdUri, value)

  Allows you to set a scheme and server source for UTC live edge detection for dynamic streams. If UTCTiming is defined in the manifest, it will take precedence over any time source manually added.

  If you have exposed the Date header, use the method `clearDefaultUTCTimingSources()`. This will allow the date header on the manifest to be used instead of a time server

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `schemeIdUri` | string | urn:mpeg:dash:utc:http-head:2014 urn:mpeg:dash:utc:http-xsdate:2014 urn:mpeg:dash:utc:http-iso:2014 urn:mpeg:dash:utc:direct:2014 Some specs referencing early ISO23009-1 drafts incorrectly use 2012 in the URI, rather than 2014. support these for now. urn:mpeg:dash:utc:http-head:2012 urn:mpeg:dash:utc:http-xsdate:2012 urn:mpeg:dash:utc:http-iso:2012 urn:mpeg:dash:utc:direct:2012
  `value` | string | Path to a time source.

  Default Value:
    - - schemeIdUri:urn:mpeg:dash:utc:http-xsdate:2014
      - value:http://time.akamai.com/?iso&ms/li>
  Source:
    - streaming/MediaPlayer.js, line 1163
  See:
    - `removeUTCTimingSource()`

#### attachProtectionController(value)

  Will override dash.js protection controller.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | ProtectionController | valid protection controller instance.

  Source:
    - streaming/MediaPlayer.js, line 1741

#### attachSource(urlOrManifest, startTime)

  Use this method to set a source URL to a valid MPD manifest file OR
  a previously downloaded and parsed manifest object. Optionally, can
  also provide protection information

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `urlOrManifest` | string | Object | A URL to a valid MPD manifest file, or a parsed manifest object.
  `startTime` | number | string | For VoD content the start time is relative to the start time of the first period. For live content If the parameter starts from prefix posix: it signifies the absolute time range defined in seconds of Coordinated Universal Time (ITU-R TF.460-6). This is the number of seconds since 01-01-1970 00:00:00 UTC. Fractions of seconds may be optionally specified down to the millisecond level. If no posix prefix is used the starttime is relative to MPD@availabilityStartTime

  Source:
    - streaming/MediaPlayer.js, line 1881

  ##### Throws:

  `MEDIA_PLAYER_NOT_INITIALIZED_ERROR` if called before initialize function

#### attachTTMLRenderingDiv(div)

  Use this method to attach an HTML5 div for dash.js to render rich TTML subtitles.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `div` | HTMLDivElement | An unstyled div placed after the video element. It will be styled to match the video size and overlay z-order.

  Source:
    - streaming/MediaPlayer.js, line 1462

  ##### Throws:

  `ELEMENT_NOT_ATTACHED_ERROR` if called before attachView function

#### attachView(element)

  Use this method to attach an HTML5 VideoElement for dash.js to operate upon.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `element` | Object | An HTMLMediaElement that has already been defined in the DOM (or equivalent stub).

  Source:
    - streaming/MediaPlayer.js, line 1420

  ##### Throws:

  `MEDIA_PLAYER_NOT_INITIALIZED_ERROR` if called before initialize function

#### clearDefaultUTCTimingSources()

  Allows you to clear the stored array of time sources.

  Example use: If you have exposed the Date header, calling this method will allow the date header on the manifest to be used instead of the time server.

  Example use: Calling this method, assuming there is not an exposed date header on the manifest, will default back to using a binary search to discover the live edge

  Source:
    - streaming/MediaPlayer.js, line 1192
  See:
    - `restoreDefaultUTCTimingSources()`

#### convertToTimeCode(value)

  A utility method which converts seconds into TimeCode (i.e. 300 --> 05:00).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number | A number in seconds to be converted into a formatted time code.

  Source:
    - streaming/MediaPlayer.js, line 1982

  ##### Returns:

  A formatted time code string.

  Type
    string

#### destroy()

  Completely destroys the media player and frees all memory.

  Source:
    - streaming/MediaPlayer.js, line 468

#### duration()

  Duration of the media's playback, in seconds.

  Source:
    - streaming/MediaPlayer.js, line 897

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  The current duration of the media. For a dynamic stream this will return DVRWindow.end - DVRWindow.start

  Type
    number

#### durationAsUTC()

  Use this method to get the current duration as an absolute value, the time in seconds since midnight UTC, Jan 1 1970.
  Note - this property only has meaning for live streams.

  Source:
    - streaming/MediaPlayer.js, line 939

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  The current duration as UTC timestamp.

  Type
    number

#### enableForcedTextStreaming(enable)

  Enable/disable text
  When enabling dash will keep downloading and process fragmented text tracks even if all tracks are in mode "hidden"

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `enable` | boolean | true to enable text streaming even if all text tracks are hidden.

  Source:
    - streaming/MediaPlayer.js, line 1326

#### enableText(enable)

  Enable/disable text
  When enabling text, dash will choose the previous selected text track

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `enable` | boolean | true to enable text, false otherwise (same as setTextTrack(-1))

  Source:
    - streaming/MediaPlayer.js, line 1308

#### extend(parentNameString, childInstance, override)

  This method should be used to extend or replace internal dash.js objects.
  There are two ways to extend dash.js (determined by the override argument):

  1. If you set override to true any public method or property in your custom object will override the dash.js parent object's property(ies) and will be used instead but the dash.js parent module will still be created.
  2. If you set override to false your object will completely replace the dash.js object. (Note: This is how it was in 1.x of Dash.js with Dijon).
  When you extend you get access to this.context, this.factory and this.parent to operate with in your custom object.
  - this.context - can be used to pass context for singleton access.
  - this.factory - can be used to call factory.getSingletonInstance().
  - this.parent - is the reference of the parent object to call other public methods. (this.parent is excluded if you extend with override set to false or option 2)
  You must call extend before you call initialize

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `parentNameString` | string | name of parent module
  `childInstance` | Object | overriding object
  `override` | boolean | replace only some methods (true) or the whole object (false)

  Source:
    - streaming/MediaPlayer.js, line 2016
  See:
    - `initialize()`

#### formatUTC(time, locales, hour12, withDate)

  A utility methods which converts UTC timestamp value into a valid time and date string.

  ##### Parameters:

  Name | Type | Default | Description
  --- | --- | --- | ---
  `time` | number |  | UTC timestamp to be converted into date and time.
  `locales` | string |  | a region identifier (i.e. en_US).
  `hour12` | boolean |  | 12 vs 24 hour. Set to true for 12 hour time formatting.
  `withDate` | boolean | false | default is false. Set to true to append current date to UTC time format.

  Source:
    - streaming/MediaPlayer.js, line 1965

  ##### Returns:

  A formatted time and date string.

  Type
    string

#### getActiveStream()

  This method returns the active stream

  Source:
    - streaming/MediaPlayer.js, line 2027

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

#### getAutoPlay()

  Source:
    - streaming/MediaPlayer.js, line 1069

  ##### Returns:

  The current autoPlay state.

  Type
    boolean

#### getAverageThroughput(type)

  Returns the average throughput computed in the ABR logic

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |

  Source:
    - streaming/MediaPlayer.js, line 1221

  ##### Returns:

  value

  Type
    number

#### getBitrateInfoListFor(type)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |

  Source:
    - streaming/MediaPlayer.js, line 1490

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  Type
    Array

#### getBufferLength(type)

  The length of the buffer for a given media type, in seconds. Valid media
  types are "video", "audio" and "text". If no type is passed
  in, then the minimum of video, audio and text buffer length is
  returned. NaN is returned if an invalid type is requested, the
  presentation does not contain that type, or if no arguments are passed
  and the presentation does not include any adaption sets of valid media
  type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType | 'video', 'audio' or 'text'

  Source:
    - streaming/MediaPlayer.js, line 781

  ##### Returns:

  The length of the buffer for the given media type, in
  seconds, or NaN

  Type
    number

#### getCurrentLiveLatency()

  Source:
    - streaming/MediaPlayer.js, line 1079

  ##### Throws:

  `MEDIA_PLAYER_NOT_INITIALIZED_ERROR` if called before initialize function

  ##### Returns:

  Current live stream latency in seconds. It is the difference between now time and time position at the playback head.

  Type
    number | NaN

#### getCurrentTrackFor(type)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |

  Source:
    - streaming/MediaPlayer.js, line 1562

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  `MediaInfo`

  Type
    Object | null

#### getDashAdapter()

  Returns the DashAdapter.js Module.

  Source:
    - streaming/MediaPlayer.js, line 2043
  See:
    - `module:DashAdapter`

  ##### Returns:

  Type
    Object

#### getDashMetrics()

  Returns the DashMetrics.js Module. You use this Module to get access to all the public metrics
  stored in dash.js

  Source:
    - streaming/MediaPlayer.js, line 1288
  See:
    - `module:DashMetrics`

  ##### Returns:

  Type
    Object

#### getDebug()

  Use this method to access the dash.js logging class.

  Source:
    - streaming/MediaPlayer.js, line 530

  ##### Returns:

  Type
    Debug

#### getDVRSeekOffset(value)

  This method should only be used with a live stream that has a valid timeShiftBufferLength (DVR Window).
  NOTE - If you do not need the raw offset value (i.e. media analytics, tracking, etc) consider using the `seek()` method
  which will calculate this value for you and set the video element's currentTime property all in one simple call.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number | A relative time, in seconds, based on the return value of the `duration()` method is expected.

  Source:
    - streaming/MediaPlayer.js, line 828
  See:
    - `seek()`

  ##### Returns:

  A value that is relative the available range within the timeShiftBufferLength (DVR Window).

  Type
    number

#### getDVRWindowSize()

  The timeShiftBufferLength (DVR Window), in seconds.

  Source:
    - streaming/MediaPlayer.js, line 808

  ##### Returns:

  The window of allowable play time behind the live point of a live stream as defined in the manifest.

  Type
    number

#### getInitialMediaSettingsFor(type)

  This method returns media settings that is used to pick the initial track. Format of the settings
  is following:
  {lang: langValue,
  index: indexValue,
  viewpoint: viewpointValue,
  audioChannelConfiguration: audioChannelConfigurationValue,
  accessibility: accessibilityValue,
  role: roleValue}

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |

  Source:
    - streaming/MediaPlayer.js, line 1608

  ##### Throws:

  `MEDIA_PLAYER_NOT_INITIALIZED_ERROR` if called before initialize function

  ##### Returns:

  Type
    Object

#### getLowLatencyModeEnabled()

  Returns a boolean that indicates whether the player is operating in low latency mode.

  Source:
    - streaming/MediaPlayer.js, line 693

  ##### Returns:

  Type
    boolean

#### getOfflineController()

  Detects if Offline is included and returns an instance of OfflineController.js

  Source:
    - streaming/MediaPlayer.js, line 1268

#### getPlaybackRate()

  Returns the current playback rate.

  Source:
    - streaming/MediaPlayer.js, line 716

  ##### Returns:

  Type
    number

#### getProtectionController()

  Detects if Protection is included and returns an instance of ProtectionController.js

  Source:
    - streaming/MediaPlayer.js, line 1731

#### getQualityFor(type)

  Gets the current download quality for media type video, audio or images. For video and audio types the ABR
  rules update this value before every new download unless autoSwitchBitrate is set to false. For 'image'
  type, thumbnails, there is no ABR algorithm and quality is set manually.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType | 'video', 'audio' or 'image' (thumbnails)

  Source:
    - streaming/MediaPlayer.js, line 982
  See:
    - `setQualityFor()`

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  the quality index, 0 corresponding to the lowest bitrate

  Type
    number

#### getSettings()

  Get the current settings object being used on the player.

  Source:
    - streaming/MediaPlayer.js, line 1917

  ##### Returns:

  The settings object being used.

  Type
    PlayerSettings

#### getSource()

  Returns the source string or manifest that was attached by calling attachSource()

  Source:
    - streaming/MediaPlayer.js, line 1847

  ##### Throws:

  `SOURCE_NOT_ATTACHED_ERROR` if called before attachSource function

  ##### Returns:

  Type
    string | manifest

#### getStreamsFromManifest(manifest)

  This method returns the list of all available streams from a given manifest

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `manifest` | Object |

  Source:
    - streaming/MediaPlayer.js, line 1506

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  list of `StreamInfo`

  Type
    Array

#### getTargetLiveDelay()

  Returns the target live delay

  Source:
    - streaming/MediaPlayer.js, line 852

  ##### Returns:

  The target live delay

  Type
    number

#### getTopBitrateInfoFor(type)

  Gets the top quality BitrateInfo checking portal limit and max allowed.
  It calls getMaxAllowedIndexFor internally

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType | 'video' or 'audio'

  Source:
    - streaming/MediaPlayer.js, line 963

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  Type
    BitrateInfo | null

#### getTracksFor(type)

  This method returns the list of all available tracks for a given media type

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |

  Source:
    - streaming/MediaPlayer.js, line 1521

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  list of `MediaInfo`

  Type
    Array

#### getTracksForTypeFromManifest(type, manifest, streamInfo)

  This method returns the list of all available tracks for a given media type and streamInfo from a given manifest

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |
  `manifest` | Object |
  `streamInfo` | Object |

  Source:
    - streaming/MediaPlayer.js, line 1544

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  list of `MediaInfo`

  Type
    Array

#### getTTMLRenderingDiv()

  Returns instance of Div that was attached by calling attachTTMLRenderingDiv()

  Source:
    - streaming/MediaPlayer.js, line 1450

  ##### Returns:

  Type
    Object

#### getVersion()

  Current version of Dash.js

  Source:
    - streaming/MediaPlayer.js, line 519

  ##### Returns:

  the current dash.js version string.

  Type
    string

#### getVideoElement()

  Returns instance of Video Element that was attached by calling attachView()

  Source:
    - streaming/MediaPlayer.js, line 1405

  ##### Throws:

  `ELEMENT_NOT_ATTACHED_ERROR` if called before attachView function

  ##### Returns:

  Type
    Object

#### getVolume()

  Returns the current audio volume, from 0.0 (silent) to 1.0 (loudest).

  Source:
    - streaming/MediaPlayer.js, line 762

  ##### Returns:

  Type
    number

#### getXHRWithCredentialsForType(type)

  Gets whether withCredentials on XHR requests for a particular request
  type is true or false

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | string | one of HTTPRequest.*_TYPE

  Source:
    - streaming/MediaPlayer.js, line 1251

  ##### Returns:

  Type
    boolean

#### initialize( [view] [, source] [, autoPlay], startTime)

  Upon creating the MediaPlayer you must call initialize before you call anything else.
  There is one exception to this rule. It is crucial to call `extend()`
  with all your extensions prior to calling initialize.

  ALL arguments are optional and there are individual methods to set each argument later on.
  The args in this method are just for convenience and should only be used for a simple player setup.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `view` | HTML5MediaElement | <optional> | Optional arg to set the video element. `attachView()`
  `source` | string | <optional> | Optional arg to set the media source. `attachSource()`
  `autoPlay` | boolean | <optional> | Optional arg to set auto play. `setAutoPlay()`
  `startTime` | number | string |  | For VoD content the start time is relative to the start time of the first period. For live content If the parameter starts from prefix posix: it signifies the absolute time range defined in seconds of Coordinated Universal Time (ITU-R TF.460-6). This is the number of seconds since 01-01-1970 00:00:00 UTC. Fractions of seconds may be optionally specified down to the millisecond level. If no posix prefix is used the starttime is relative to MPD@availabilityStartTime

  Source:
    - streaming/MediaPlayer.js, line 271
  See:
    - `attachSource()`
    - `setAutoPlay()`

#### isDynamic()

  Returns a Boolean that indicates whether the media is in the process of dynamic.

  Source:
    - streaming/MediaPlayer.js, line 680

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  Type
    boolean

#### isMuted()

  A Boolean that determines whether audio is muted.

  Source:
    - streaming/MediaPlayer.js, line 738

  ##### Returns:

  Type
    boolean

#### isPaused()

  Returns a Boolean that indicates whether the Video Element is paused.

  Source:
    - streaming/MediaPlayer.js, line 603

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  Type
    boolean

#### isReady()

  The ready state of the MediaPlayer based on both the video element and MPD source being defined.

  Source:
    - streaming/MediaPlayer.js, line 482
  See:
    - `attachView()`
    - `attachSource()`

  ##### Returns:

  The current ready state of the MediaPlayer

  Type
    boolean

#### isSeeking()

  Returns a Boolean that indicates whether the media is in the process of seeking to a new position.

  Source:
    - streaming/MediaPlayer.js, line 666

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  Type
    boolean

#### isTextEnabled()

  Return if text is enabled

  Source:
    - streaming/MediaPlayer.js, line 1343

  ##### Returns:

  return true if text is enabled, false otherwise

  Type
    boolean

#### off(type, listener, scope)

  Use the off method to remove listeners for public events found in MediaPlayer.events. `MediaPlayerEvents`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | string | `MediaPlayerEvents`
  `listener` | function | callback method when the event fires.
  `scope` | Object | context of the listener so it can be removed properly.

  Source:
    - streaming/MediaPlayer.js, line 509

#### on(type, listener, scope, options)

  Use the on method to listen for public events found in MediaPlayer.events. `MediaPlayerEvents`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | string | `MediaPlayerEvents`
  `listener` | function | callback method when the event fires.
  `scope` | Object | context of the listener so it can be removed properly.
  `options` | Object | object to define various options such as priority and mode

  Source:
    - streaming/MediaPlayer.js, line 496

#### pause()

  This method will call pause on the native Video Element.

  Source:
    - streaming/MediaPlayer.js, line 589

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

#### play()

  The play method initiates playback of the media defined by the `attachSource()` method.
  This method will call play on the native Video Element.

  Source:
    - streaming/MediaPlayer.js, line 573
  See:
    - `attachSource()`

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

#### preload()

  Causes the player to begin streaming the media as set by the `attachSource()`
  method in preparation for playing. It specifically does not require a view to be attached with `attachView()` to begin preloading.
  When a view is attached after preloading, the buffered data is transferred to the attached mediaSource buffers.

  Source:
    - streaming/MediaPlayer.js, line 553
  See:
    - `attachSource()`
    - `attachView()`

  ##### Throws:

  `SOURCE_NOT_ATTACHED_ERROR` if called before attachSource function

#### provideThumbnail(time, callback)

  Provide the thumbnail at time position. This can be asynchronous, so you must provide a callback ro retrieve thumbnails informations

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `time` | number | A relative time, in seconds, based on the return value of the `duration()` method is expected
  `callback` | function | A Callback function provided when retrieving thumbnail the given time position. Thumbnail object is null in case there are is not a thumbnails representation or if it doesn't contain a thumbnail for the given time position.

  Source:
    - streaming/MediaPlayer.js, line 1781

#### registerCustomCapabilitiesFilter(filter)

  Registers a custom capabilities filter. This enables application to filter representations to use.
  The provided callback function shall return a boolean based on whether or not to use the representation.
  The filters are applied in the order they are registered.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `filter` | function | the custom capabilities filter callback

  Source:
    - streaming/MediaPlayer.js, line 1644

#### registerLicenseRequestFilter(filter)

  Registers a license request filter. This enables application to manipulate/overwrite any request parameter and/or request data.
  The provided callback function shall return a promise that shall be resolved once the filter process is completed.
  The filters are applied in the order they are registered.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `filter` | function | the license request filter callback

  Source:
    - streaming/MediaPlayer.js, line 1682

#### registerLicenseResponseFilter(filter)

  Registers a license response filter. This enables application to manipulate/overwrite the response data
  The provided callback function shall return a promise that shall be resolved once the filter process is completed.
  The filters are applied in the order they are registered.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `filter` | function | the license response filter callback

  Source:
    - streaming/MediaPlayer.js, line 1694

#### removeABRCustomRule(rulename)

  Remove a custom ABR Rule

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `rulename` | string | name of the rule to be removed

  Source:
    - streaming/MediaPlayer.js, line 1113

#### removeAllABRCustomRule()

  Remove all ABR custom rules

  Source:
    - streaming/MediaPlayer.js, line 1122

#### removeUTCTimingSource(schemeIdUri, value)

  Allows you to remove a UTC time source. Both schemeIdUri and value need to match the Dash.vo.UTCTiming properties in order for the entry to be removed from the array

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `schemeIdUri` | string | see `addUTCTimingSource()`
  `value` | string | see `addUTCTimingSource()`

  Source:
    - streaming/MediaPlayer.js, line 1177
  See:
    - `clearDefaultUTCTimingSources()`

  ##### Throws:

  `BAD_ARGUMENT_ERROR` if called with invalid arguments, schemeIdUri and value are not string type.

#### reset()

  Sets the MPD source and the video element to null. You can also reset the MediaPlayer by
  calling attachSource with a new source file.

  This call does not destroy the MediaPlayer. To destroy the MediaPlayer and free all of its
  memory, call destroy().

  Source:
    - streaming/MediaPlayer.js, line 438

#### resetSettings()

  Resets the settings object back to the default.

  Source:
    - streaming/MediaPlayer.js, line 1950

#### restoreDefaultUTCTimingSources()

  Allows you to restore the default time sources after calling `clearDefaultUTCTimingSources()`

  Default Value:
    - - schemeIdUri:urn:mpeg:dash:utc:http-xsdate:2014
      - value:http://time.akamai.com/?iso&ms
  Source:
    - streaming/MediaPlayer.js, line 1209
  See:
    - `addUTCTimingSource()`

#### retrieveManifest(url, callback)

  Allows application to retrieve a manifest. Manifest loading is asynchronous and requires the app-provided callback function

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `url` | string | url the manifest url
  `callback` | function | A Callback function provided when retrieving manifests

  Source:
    - streaming/MediaPlayer.js, line 1820

#### seek(value)

  Sets the currentTime property of the attached video element. If it is a live stream with a
  timeShiftBufferLength, then the DVR window offset will be automatically calculated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number | A relative time, in seconds, based on the return value of the `duration()` method is expected. For dynamic streams duration() returns DVRWindow.end - DVRWindow.start. Consequently, the value provided to this function should be relative to DVRWindow.start.

  Source:
    - streaming/MediaPlayer.js, line 622
  See:
    - `getDVRSeekOffset()`

  ##### Throws:

  - `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  - `BAD_ARGUMENT_ERROR` if called with an invalid argument, not number type or is NaN.

#### setAutoPlay(value)

  Set to false to prevent stream from auto-playing when the view is attached.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | boolean |

  Default Value:
    - true
  Source:
    - streaming/MediaPlayer.js, line 1059
  See:
    - `attachView()`

  ##### Throws:

  `BAD_ARGUMENT_ERROR` if called with an invalid argument, not boolean type.

#### setConfig( [config])

  Configure media player with customs controllers. Helpful for tests

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `config` | object | <optional> | controllers configuration

  Source:
    - streaming/MediaPlayer.js, line 200

#### setCurrentTrack(track [, noSettingsSave])

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `track` | MediaInfo |  |  | instance of `MediaInfo`
  `noSettingsSave` | boolean | <optional> | false | specify if settings from the track must not be saved for incoming track selection

  Source:
    - streaming/MediaPlayer.js, line 1622

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

#### setInitialMediaSettingsFor(type, value)

  This method allows to set media settings that will be used to pick the initial track. Format of the settings
  is following:
  {lang: langValue (can be either a string primitive, a string object, or a RegExp object to match),
  index: indexValue,
  viewpoint: viewpointValue,
  audioChannelConfiguration: audioChannelConfigurationValue,
  accessibility: accessibilityValue,
  role: roleValue}

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | MediaType |
  `value` | Object |

  Source:
    - streaming/MediaPlayer.js, line 1586

  ##### Throws:

  `MEDIA_PLAYER_NOT_INITIALIZED_ERROR` if called before initialize function

#### setMute(value)

  Use this method to set the native Video Element's muted state. Takes a Boolean that determines whether audio is muted. true if the audio is muted and false otherwise.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | boolean |

  Source:
    - streaming/MediaPlayer.js, line 727

  ##### Throws:

  `BAD_ARGUMENT_ERROR` if called with an invalid argument, not boolean type.

#### setPlaybackRate(value)

  Use this method to set the native Video Element's playback rate.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number |

  Source:
    - streaming/MediaPlayer.js, line 706

#### setProtectionData(value)

  Sets Protection Data required to setup the Protection Module (DRM). Protection Data must
  be set before initializing MediaPlayer or, once initialized, before PROTECTION_CREATED event is fired.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | ProtectionDataSet | object containing property names corresponding to key system name strings and associated values being instances of.

  Source:
    - streaming/MediaPlayer.js, line 1756
  See:
    - `initialize()`
    - `dashjs.Protection.events.PROTECTION_CREATED`

#### setQualityFor(type, value, forceReplace)

  Sets the current quality for media type instead of letting the ABR Heuristics automatically selecting it.
  This value will be overwritten by the ABR rules unless autoSwitchBitrate is set to false.

  ##### Parameters:

  Name | Type | Default | Description
  --- | --- | --- | ---
  `type` | MediaType |  | 'video', 'audio' or 'image'
  `value` | number |  | the quality index, 0 corresponding to the lowest bitrate
  `forceReplace` | boolean | false | true if segments have to be replaced by segments of the new quality

  Source:
    - streaming/MediaPlayer.js, line 1010
  See:
    - `getQualityFor()`

  ##### Throws:

  `STREAMING_NOT_INITIALIZED_ERROR` if called before initializePlayback function

#### setTextTrack(idx)

  Use this method to change the current text track for both external time text files and fragmented text tracks. There is no need to
  set the track mode on the video object to switch a track when using this method.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `idx` | number | Index of track based on the order of the order the tracks are added Use -1 to disable all tracks. (turn captions off). Use module:MediaPlayer#dashjs.MediaPlayer.events.TEXT_TRACK_ADDED.

  Source:
    - streaming/MediaPlayer.js, line 1362
  See:
    - `dashjs.MediaPlayer.events.TEXT_TRACK_ADDED`

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

#### setVolume(value)

  A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number |

  Source:
    - streaming/MediaPlayer.js, line 749

  ##### Throws:

  `BAD_ARGUMENT_ERROR` if called with an invalid argument, not number type, or is NaN or not between 0 and 1.

#### setXHRWithCredentialsForType(type, value)

  Sets whether withCredentials on XHR requests for a particular request
  type is true or false

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | string | one of HTTPRequest.*_TYPE
  `value` | boolean |

  Default Value:
    - false
  Source:
    - streaming/MediaPlayer.js, line 1238

#### time(streamId)

  Current time of the playhead, in seconds.

  If called with no arguments then the returned time value is time elapsed since the start point of the first stream, or if it is a live stream, then the time will be based on the return value of the `duration()` method.
  However if a stream ID is supplied then time is relative to the start of that stream, or is null if there is no such stream id in the manifest.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `streamId` | string | The ID of a stream that the returned playhead time must be relative to the start of. If undefined, then playhead time is relative to the first stream.

  Source:
    - streaming/MediaPlayer.js, line 872

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  The current playhead time of the media, or null.

  Type
    number

#### timeAsUTC()

  Use this method to get the current playhead time as an absolute value, the time in seconds since midnight UTC, Jan 1 1970.
  Note - this property only has meaning for live streams. If called before play() has begun, it will return a value of NaN.

  Source:
    - streaming/MediaPlayer.js, line 920

  ##### Throws:

  `PLAYBACK_NOT_INITIALIZED_ERROR` if called before initializePlayback function

  ##### Returns:

  The current playhead time as UTC timestamp.

  Type
    number

#### unregisterCustomCapabilitiesFilter(filter)

  Unregisters a custom capabilities filter.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `filter` | function | the custom capabilities filter callback

  Source:
    - streaming/MediaPlayer.js, line 1654

#### unregisterLicenseRequestFilter(filter)

  Unregisters a license request filter.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `filter` | function | the license request filter callback

  Source:
    - streaming/MediaPlayer.js, line 1704

#### unregisterLicenseResponseFilter(filter)

  Unregisters a license response filter.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `filter` | function | the license response filter callback

  Source:
    - streaming/MediaPlayer.js, line 1714

#### updatePortalSize()

  Update the video element size variables
  Should be called on window resize (or any other time player is resized). Fullscreen does trigger a window resize event.

  Once windowResizeEventCalled = true, abrController.checkPortalSize() will use element size variables rather than querying clientWidth every time.

  Source:
    - streaming/MediaPlayer.js, line 1036

#### updateSettings(settingsObj)

Update the current settings object being used on the player. Anything left unspecified is not modified.

  This function does not update the entire object, only properties in the passed in object are updated.

  This means that updateSettings({a: x}) and updateSettings({b: y}) are functionally equivalent to
  updateSettings({a: x, b: y}). If the default values are required again, @see`resetSettings`.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `settingsObj` | PlayerSettings | An object corresponding to the settings definition.

  Source:
    - streaming/MediaPlayer.js, line 1940

  ##### Example

      player.updateSettings({
           streaming: {
               lowLatencyEnabled: false,
               abr: {
                   maxBitrate: { audio: 100, video: 1000 }
               }
           }
       });

#### Search results