dashjs
Version:
A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
3,133 lines (1,001 loc) • 168 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>dash.js Module: MediaPlayer</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.spacelab.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">dash.js</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="module-DashAdapter.html">DashAdapter</a></li><li><a href="module-DashMetrics.html">DashMetrics</a></li><li><a href="module-MediaPlayer.html">MediaPlayer</a></li><li><a href="module-OfflineController.html">OfflineController</a></li><li><a href="module-ProtectionController.html">ProtectionController</a></li><li><a href="module-Settings.html">Settings</a></li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="Errors.html">Errors</a></li><li><a href="MediaPlayerEvents.html">MediaPlayerEvents</a></li><li><a href="MediaPlayerModel.html">MediaPlayerModel</a></li><li><a href="MetricsReportingEvents.html">MetricsReportingEvents</a></li><li><a href="MssErrors.html">MssErrors</a></li><li><a href="OfflineErrors.html">OfflineErrors</a></li><li><a href="OfflineEvents.html">OfflineEvents</a></li><li><a href="ProtectionErrors.html">ProtectionErrors</a></li><li><a href="ProtectionEvents.html">ProtectionEvents</a></li>
</ul>
</li>
<li class="dropdown">
<a href="events.list.html" class="dropdown-toggle" data-toggle="dropdown">Events<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="MediaPlayerEvents.html#event:ADAPTATION_SET_REMOVED_NO_CAPABILITIES">MediaPlayerEvents#event:ADAPTATION_SET_REMOVED_NO_CAPABILITIES</a></li><li><a href="MediaPlayerEvents.html#event:AST_IN_FUTURE">MediaPlayerEvents#event:AST_IN_FUTURE</a></li><li><a href="MediaPlayerEvents.html#event:BUFFER_EMPTY">MediaPlayerEvents#event:BUFFER_EMPTY</a></li><li><a href="MediaPlayerEvents.html#event:BUFFER_LEVEL_STATE_CHANGED">MediaPlayerEvents#event:BUFFER_LEVEL_STATE_CHANGED</a></li><li><a href="MediaPlayerEvents.html#event:BUFFER_LEVEL_UPDATED">MediaPlayerEvents#event:BUFFER_LEVEL_UPDATED</a></li><li><a href="MediaPlayerEvents.html#event:BUFFER_LOADED">MediaPlayerEvents#event:BUFFER_LOADED</a></li><li><a href="MediaPlayerEvents.html#event:CAN_PLAY">MediaPlayerEvents#event:CAN_PLAY</a></li><li><a href="MediaPlayerEvents.html#event:CAN_PLAY_THROUGH">MediaPlayerEvents#event:CAN_PLAY_THROUGH</a></li><li><a href="MediaPlayerEvents.html#event:CAPTION_CONTAINER_RESIZE">MediaPlayerEvents#event:CAPTION_CONTAINER_RESIZE</a></li><li><a href="MediaPlayerEvents.html#event:CAPTION_RENDERED">MediaPlayerEvents#event:CAPTION_RENDERED</a></li><li><a href="MediaPlayerEvents.html#event:CONFORMANCE_VIOLATION">MediaPlayerEvents#event:CONFORMANCE_VIOLATION</a></li><li><a href="MediaPlayerEvents.html#event:CONTENT_STEERING_REQUEST_COMPLETED">MediaPlayerEvents#event:CONTENT_STEERING_REQUEST_COMPLETED</a></li><li><a href="MediaPlayerEvents.html#event:DYNAMIC_TO_STATIC">MediaPlayerEvents#event:DYNAMIC_TO_STATIC</a></li><li><a href="MediaPlayerEvents.html#event:ERROR">MediaPlayerEvents#event:ERROR</a></li><li><a href="MediaPlayerEvents.html#event:EVENT_MODE_ON_RECEIVE">MediaPlayerEvents#event:EVENT_MODE_ON_RECEIVE</a></li><li><a href="MediaPlayerEvents.html#event:EVENT_MODE_ON_START">MediaPlayerEvents#event:EVENT_MODE_ON_START</a></li><li><a href="MediaPlayerEvents.html#event:FRAGMENT_LOADING_ABANDONED">MediaPlayerEvents#event:FRAGMENT_LOADING_ABANDONED</a></li><li><a href="MediaPlayerEvents.html#event:FRAGMENT_LOADING_COMPLETED">MediaPlayerEvents#event:FRAGMENT_LOADING_COMPLETED</a></li><li><a href="MediaPlayerEvents.html#event:FRAGMENT_LOADING_PROGRESS">MediaPlayerEvents#event:FRAGMENT_LOADING_PROGRESS</a></li><li><a href="MediaPlayerEvents.html#event:FRAGMENT_LOADING_STARTED">MediaPlayerEvents#event:FRAGMENT_LOADING_STARTED</a></li><li><a href="MediaPlayerEvents.html#event:LOG">MediaPlayerEvents#event:LOG</a></li><li><a href="MediaPlayerEvents.html#event:MANIFEST_LOADED">MediaPlayerEvents#event:MANIFEST_LOADED</a></li><li><a href="MediaPlayerEvents.html#event:MANIFEST_VALIDITY_CHANGED">MediaPlayerEvents#event:MANIFEST_VALIDITY_CHANGED</a></li><li><a href="MediaPlayerEvents.html#event:METRIC_ADDED">MediaPlayerEvents#event:METRIC_ADDED</a></li><li><a href="MediaPlayerEvents.html#event:METRIC_CHANGED">MediaPlayerEvents#event:METRIC_CHANGED</a></li><li><a href="MediaPlayerEvents.html#event:METRIC_UPDATED">MediaPlayerEvents#event:METRIC_UPDATED</a></li><li><a href="MediaPlayerEvents.html#event:METRICS_CHANGED">MediaPlayerEvents#event:METRICS_CHANGED</a></li><li><a href="MediaPlayerEvents.html#event:PERIOD_SWITCH_COMPLETED">MediaPlayerEvents#event:PERIOD_SWITCH_COMPLETED</a></li><li><a href="MediaPlayerEvents.html#event:PERIOD_SWITCH_STARTED">MediaPlayerEvents#event:PERIOD_SWITCH_STARTED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_ENDED">MediaPlayerEvents#event:PLAYBACK_ENDED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_ERROR">MediaPlayerEvents#event:PLAYBACK_ERROR</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_LOADED_DATA">MediaPlayerEvents#event:PLAYBACK_LOADED_DATA</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_METADATA_LOADED">MediaPlayerEvents#event:PLAYBACK_METADATA_LOADED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_NOT_ALLOWED">MediaPlayerEvents#event:PLAYBACK_NOT_ALLOWED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_PAUSED">MediaPlayerEvents#event:PLAYBACK_PAUSED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_PLAYING">MediaPlayerEvents#event:PLAYBACK_PLAYING</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_PROGRESS">MediaPlayerEvents#event:PLAYBACK_PROGRESS</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_RATE_CHANGED">MediaPlayerEvents#event:PLAYBACK_RATE_CHANGED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_SEEKED">MediaPlayerEvents#event:PLAYBACK_SEEKED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_SEEKING">MediaPlayerEvents#event:PLAYBACK_SEEKING</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_STALLED">MediaPlayerEvents#event:PLAYBACK_STALLED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_STARTED">MediaPlayerEvents#event:PLAYBACK_STARTED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_TIME_UPDATED">MediaPlayerEvents#event:PLAYBACK_TIME_UPDATED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_VOLUME_CHANGED">MediaPlayerEvents#event:PLAYBACK_VOLUME_CHANGED</a></li><li><a href="MediaPlayerEvents.html#event:PLAYBACK_WAITING">MediaPlayerEvents#event:PLAYBACK_WAITING</a></li><li><a href="MediaPlayerEvents.html#event:QUALITY_CHANGE_RENDERED">MediaPlayerEvents#event:QUALITY_CHANGE_RENDERED</a></li><li><a href="MediaPlayerEvents.html#event:QUALITY_CHANGE_REQUESTED">MediaPlayerEvents#event:QUALITY_CHANGE_REQUESTED</a></li><li><a href="MediaPlayerEvents.html#event:REPRESENTATION_SWITCH">MediaPlayerEvents#event:REPRESENTATION_SWITCH</a></li><li><a href="MediaPlayerEvents.html#event:STREAM_ACTIVATED">MediaPlayerEvents#event:STREAM_ACTIVATED</a></li><li><a href="MediaPlayerEvents.html#event:STREAM_DEACTIVATED">MediaPlayerEvents#event:STREAM_DEACTIVATED</a></li><li><a href="MediaPlayerEvents.html#event:STREAM_INITIALIZED">MediaPlayerEvents#event:STREAM_INITIALIZED</a></li><li><a href="MediaPlayerEvents.html#event:STREAM_INITIALIZING">MediaPlayerEvents#event:STREAM_INITIALIZING</a></li><li><a href="MediaPlayerEvents.html#event:STREAM_TEARDOWN_COMPLETE">MediaPlayerEvents#event:STREAM_TEARDOWN_COMPLETE</a></li><li><a href="MediaPlayerEvents.html#event:STREAM_UPDATED">MediaPlayerEvents#event:STREAM_UPDATED</a></li><li><a href="MediaPlayerEvents.html#event:TEXT_TRACK_ADDED">MediaPlayerEvents#event:TEXT_TRACK_ADDED</a></li><li><a href="MediaPlayerEvents.html#event:TEXT_TRACKS_ADDED">MediaPlayerEvents#event:TEXT_TRACKS_ADDED</a></li><li><a href="MediaPlayerEvents.html#event:TRACK_CHANGE_RENDERED">MediaPlayerEvents#event:TRACK_CHANGE_RENDERED</a></li><li><a href="MediaPlayerEvents.html#event:TTML_PARSED">MediaPlayerEvents#event:TTML_PARSED</a></li><li><a href="MediaPlayerEvents.html#event:TTML_TO_PARSE">MediaPlayerEvents#event:TTML_TO_PARSE</a></li><li><a href="MetricsReportingEvents.html#event:CMCD_DATA_GENERATED">MetricsReportingEvents#event:CMCD_DATA_GENERATED</a></li><li><a href="OfflineEvents.html#event:OFFLINE_RECORD_FINISHED">OfflineEvents#event:OFFLINE_RECORD_FINISHED</a></li><li><a href="OfflineEvents.html#event:OFFLINE_RECORD_LOADEDMETADATA">OfflineEvents#event:OFFLINE_RECORD_LOADEDMETADATA</a></li><li><a href="OfflineEvents.html#event:OFFLINE_RECORD_STARTED">OfflineEvents#event:OFFLINE_RECORD_STARTED</a></li><li><a href="OfflineEvents.html#event:OFFLINE_RECORD_STOPPED">OfflineEvents#event:OFFLINE_RECORD_STOPPED</a></li><li><a href="ProtectionEvents.html#event:KEY_ADDED">ProtectionEvents#event:KEY_ADDED</a></li><li><a href="ProtectionEvents.html#event:KEY_ERROR">ProtectionEvents#event:KEY_ERROR</a></li><li><a href="ProtectionEvents.html#event:KEY_MESSAGE">ProtectionEvents#event:KEY_MESSAGE</a></li><li><a href="ProtectionEvents.html#event:KEY_SESSION_CLOSED">ProtectionEvents#event:KEY_SESSION_CLOSED</a></li><li><a href="ProtectionEvents.html#event:KEY_SESSION_CREATED">ProtectionEvents#event:KEY_SESSION_CREATED</a></li><li><a href="ProtectionEvents.html#event:KEY_SESSION_REMOVED">ProtectionEvents#event:KEY_SESSION_REMOVED</a></li><li><a href="ProtectionEvents.html#event:KEY_STATUSES_CHANGED">ProtectionEvents#event:KEY_STATUSES_CHANGED</a></li><li><a href="ProtectionEvents.html#event:KEY_SYSTEM_SELECTED">ProtectionEvents#event:KEY_SYSTEM_SELECTED</a></li><li><a href="ProtectionEvents.html#event:LICENSE_REQUEST_COMPLETE">ProtectionEvents#event:LICENSE_REQUEST_COMPLETE</a></li><li><a href="ProtectionEvents.html#event:LICENSE_REQUEST_SENDING">ProtectionEvents#event:LICENSE_REQUEST_SENDING</a></li><li><a href="ProtectionEvents.html#event:PROTECTION_CREATED">ProtectionEvents#event:PROTECTION_CREATED</a></li><li><a href="ProtectionEvents.html#event:PROTECTION_DESTROYED">ProtectionEvents#event:PROTECTION_DESTROYED</a></li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#LICENSE_SERVER_MANIFEST_CONFIGURATIONS">LICENSE_SERVER_MANIFEST_CONFIGURATIONS</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<h1 class="page-title">Module: MediaPlayer</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>The MediaPlayer is the primary dash.js Module and a Facade to build your player around.<br>
It will allow you access to all the important dash.js properties/methods via the public API and all the<br>
events to build a robust DASH media player.</p></div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-91">line 91</a>
</li>
</ul>
</dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<hr>
<dt class="name" id="~ELEMENT_NOT_ATTACHED_ERROR">
<h4 id="~ELEMENT_NOT_ATTACHED_ERROR"><span class="type-signature"><inner, constant> </span>ELEMENT_NOT_ATTACHED_ERROR<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>error string thrown when a function is called before the dash.js has received a reference of an HTML5 video element</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-108">line 108</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="~MEDIA_PLAYER_NOT_INITIALIZED_ERROR">
<h4 id="~MEDIA_PLAYER_NOT_INITIALIZED_ERROR"><span class="type-signature"><inner, constant> </span>MEDIA_PLAYER_NOT_INITIALIZED_ERROR<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>error string thrown when a function is called before the dash.js has been fully initialized.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-118">line 118</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="~PLAYBACK_NOT_INITIALIZED_ERROR">
<h4 id="~PLAYBACK_NOT_INITIALIZED_ERROR"><span class="type-signature"><inner, constant> </span>PLAYBACK_NOT_INITIALIZED_ERROR<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>error string thrown when a function is called before the dash.js has been fully initialized</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-103">line 103</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="~SOURCE_NOT_ATTACHED_ERROR">
<h4 id="~SOURCE_NOT_ATTACHED_ERROR"><span class="type-signature"><inner, constant> </span>SOURCE_NOT_ATTACHED_ERROR<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>error string thrown when a function is called before the dash.js has received a valid source stream.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-113">line 113</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="~STREAMING_NOT_INITIALIZED_ERROR">
<h4 id="~STREAMING_NOT_INITIALIZED_ERROR"><span class="type-signature"><inner, constant> </span>STREAMING_NOT_INITIALIZED_ERROR<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>error string thrown when a function is called before the dash.js has been fully initialized</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-98">line 98</a>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<hr>
<dt>
<h4 class="name" id="addABRCustomRule"><span class="type-signature"></span>addABRCustomRule(type, rulename, rule)</h4>
</dt>
<dd>
<div class="description">
<p>Add a custom ABR Rule<br>
Rule will be apply on next stream if a stream is being played</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>rule type (one of ['qualitySwitchRules','abandonFragmentRules'])</p></td>
</tr>
<tr>
<td class="name"><code>rulename</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>name of rule (used to identify custom rule). If one rule of same name has been added, then existing rule will be updated</p></td>
</tr>
<tr>
<td class="name"><code>rule</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the rule object instance</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1054">line 1054</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="Constants.html#BAD_ARGUMENT_ERROR"><code>BAD_ARGUMENT_ERROR</code></a> if called with invalid arguments.</p>
</div>
</dd>
<hr>
<dt>
<h4 class="name" id="addUTCTimingSource"><span class="type-signature"></span>addUTCTimingSource(schemeIdUri, value)</h4>
</dt>
<dd>
<div class="description">
<p>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.</p>
<p>If you have exposed the Date header, use the method <a href="module-MediaPlayer.html#clearDefaultUTCTimingSources"><code>clearDefaultUTCTimingSources()</code></a>.
This will allow the date header on the manifest to be used instead of a time server</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>schemeIdUri</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><ul>
<li>urn:mpeg:dash:utc:http-head:2014</li>
<li>urn:mpeg:dash:utc:http-xsdate:2014</li>
<li>urn:mpeg:dash:utc:http-iso:2014</li>
<li>urn:mpeg:dash:utc:direct:2014</li>
</ul>
<p>Some specs referencing early ISO23009-1 drafts incorrectly use
2012 in the URI, rather than 2014. support these for now.</p>
<ul>
<li>urn:mpeg:dash:utc:http-head:2012</li>
<li>urn:mpeg:dash:utc:http-xsdate:2012</li>
<li>urn:mpeg:dash:utc:http-iso:2012</li>
<li>urn:mpeg:dash:utc:direct:2012</li>
</ul></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Path to a time source.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-default method-doc-label method-doc-details-label">Default Value:</dt>
<dd class="tag-default">
<ul class="dummy">
<li><ul>
<li>schemeIdUri:urn:mpeg:dash:utc:http-xsdate:2014</li>
<li>value:http://time.akamai.com/?iso&ms/li>
</ul></li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1115">line 1115</a>
</li>
</ul>
</dd>
<dt class="tag-see method-doc-label method-doc-details-label">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="module-MediaPlayer.html#removeUTCTimingSource"><code>removeUTCTimingSource()</code></a></li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="attachProtectionController"><span class="type-signature"></span>attachProtectionController(value)</h4>
</dt>
<dd>
<div class="description">
<p>Will override dash.js protection controller.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">ProtectionController</span>
</td>
<td class="description last"><p>valid protection controller instance.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1685">line 1685</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="attachSource"><span class="type-signature"></span>attachSource(urlOrManifest, startTime)</h4>
</dt>
<dd>
<div class="description">
<p>Use this method to set a source URL to a valid MPD manifest file OR<br>
a previously downloaded and parsed manifest object. Optionally, can<br>
also provide protection information</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>urlOrManifest</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Object</span>
</td>
<td class="description last"><p>A URL to a valid MPD manifest file, or a<br>
parsed manifest object.</p></td>
</tr>
<tr>
<td class="name"><code>startTime</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">string</span>
</td>
<td class="description last"><p>For VoD content the start time is relative to the start time of the first period.<br>
For live content<br>
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.<br>
If no posix prefix is used the starttime is relative to MPD@availabilityStartTime</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1827">line 1827</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="module-MediaPlayer.html#~MEDIA_PLAYER_NOT_INITIALIZED_ERROR"><code>MEDIA_PLAYER_NOT_INITIALIZED_ERROR</code></a> if called before initialize function</p>
</div>
</dd>
<hr>
<dt>
<h4 class="name" id="attachTTMLRenderingDiv"><span class="type-signature"></span>attachTTMLRenderingDiv(div)</h4>
</dt>
<dd>
<div class="description">
<p>Use this method to attach an HTML5 div for dash.js to render rich TTML subtitles.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>div</code></td>
<td class="type">
<span class="param-type">HTMLDivElement</span>
</td>
<td class="description last"><p>An unstyled div placed after the video element. It will be styled to match the video size and overlay z-order.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1414">line 1414</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="module-MediaPlayer.html#~ELEMENT_NOT_ATTACHED_ERROR"><code>ELEMENT_NOT_ATTACHED_ERROR</code></a> if called before attachView function</p>
</div>
</dd>
<hr>
<dt>
<h4 class="name" id="attachView"><span class="type-signature"></span>attachView(element)</h4>
</dt>
<dd>
<div class="description">
<p>Use this method to attach an HTML5 VideoElement for dash.js to operate upon.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>element</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>An HTMLMediaElement that has already been defined in the DOM (or equivalent stub).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1372">line 1372</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="module-MediaPlayer.html#~MEDIA_PLAYER_NOT_INITIALIZED_ERROR"><code>MEDIA_PLAYER_NOT_INITIALIZED_ERROR</code></a> if called before initialize function</p>
</div>
</dd>
<hr>
<dt>
<h4 class="name" id="clearDefaultUTCTimingSources"><span class="type-signature"></span>clearDefaultUTCTimingSources()</h4>
</dt>
<dd>
<div class="description">
<p>Allows you to clear the stored array of time sources.</p>
<p>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.</p>
<p>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</p>
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1144">line 1144</a>
</li>
</ul>
</dd>
<dt class="tag-see method-doc-label method-doc-details-label">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="module-MediaPlayer.html#restoreDefaultUTCTimingSources"><code>restoreDefaultUTCTimingSources()</code></a></li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="convertToTimeCode"><span class="type-signature"></span>convertToTimeCode(value)</h4>
</dt>
<dd>
<div class="description">
<p>A utility method which converts seconds into TimeCode (i.e. 300 --> 05:00).</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>A number in seconds to be converted into a formatted time code.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1919">line 1919</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A formatted time code string.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="destroy"><span class="type-signature"></span>destroy()</h4>
</dt>
<dd>
<div class="description">
<p>Completely destroys the media player and frees all memory.</p>
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-453">line 453</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="duration"><span class="type-signature"></span>duration()</h4>
</dt>
<dd>
<div class="description">
<p>Duration of the media's playback, in seconds.</p>
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-849">line 849</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="module-MediaPlayer.html#~PLAYBACK_NOT_INITIALIZED_ERROR"><code>PLAYBACK_NOT_INITIALIZED_ERROR</code></a> if called before initializePlayback function</p>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<p>The current duration of the media. For a dynamic stream this will return DVRWindow.end - DVRWindow.start</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="durationAsUTC"><span class="type-signature"></span>durationAsUTC()</h4>
</dt>
<dd>
<div class="description">
<p>Use this method to get the current duration as an absolute value, the time in seconds since midnight UTC, Jan 1 1970.<br>
Note - this property only has meaning for live streams.</p>
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-891">line 891</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="module-MediaPlayer.html#~PLAYBACK_NOT_INITIALIZED_ERROR"><code>PLAYBACK_NOT_INITIALIZED_ERROR</code></a> if called before initializePlayback function</p>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<p>The current duration as UTC timestamp.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="enableForcedTextStreaming"><span class="type-signature"></span>enableForcedTextStreaming(enable)</h4>
</dt>
<dd>
<div class="description">
<p>Enable/disable text<br>
When enabling dash will keep downloading and process fragmented text tracks even if all tracks are in mode "hidden"</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>enable</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>true to enable text streaming even if all text tracks are hidden.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1278">line 1278</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="enableText"><span class="type-signature"></span>enableText(enable)</h4>
</dt>
<dd>
<div class="description">
<p>Enable/disable text<br>
When enabling text, dash will choose the previous selected text track</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>enable</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>true to enable text, false otherwise (same as setTextTrack(-1))</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1260">line 1260</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="extend"><span class="type-signature"></span>extend(parentNameString, childInstance, override)</h4>
</dt>
<dd>
<div class="description">
<p>This method should be used to extend or replace internal dash.js objects.<br>
There are two ways to extend dash.js (determined by the override argument):</p>
<ol>
<li>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.</li>
<li>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).</li>
</ol>
<b>When you extend you get access to this.context, this.factory and this.parent to operate with in your custom object.</b>
<ul>
<li><b>this.context</b> - can be used to pass context for singleton access.</li>
<li><b>this.factory</b> - can be used to call factory.getSingletonInstance().</li>
<li><b>this.parent</b> - 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)</li>
</ul>
<b>You must call extend before you call initialize</b>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>parentNameString</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>name of parent module</p></td>
</tr>
<tr>
<td class="name"><code>childInstance</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>overriding object</p></td>
</tr>
<tr>
<td class="name"><code>override</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>replace only some methods (true) or the whole object (false)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1953">line 1953</a>
</li>
</ul>
</dd>
<dt class="tag-see method-doc-label method-doc-details-label">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="module-MediaPlayer.html#initialize"><code>initialize()</code></a></li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="formatUTC"><span class="type-signature"></span>formatUTC(time, locales, hour12, withDate)</h4>
</dt>
<dd>
<div class="description">
<p>A utility methods which converts UTC timestamp value into a valid time and date string.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="default">
</td>
<td class="description last"><p>UTC timestamp to be converted into date and time.</p></td>
</tr>
<tr>
<td class="name"><code>locales</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last"><p>a region identifier (i.e. en_US).</p></td>
</tr>
<tr>
<td class="name"><code>hour12</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="default">
</td>
<td class="description last"><p>12 vs 24 hour. Set to true for 12 hour time formatting.</p></td>
</tr>
<tr>
<td class="name"><code>withDate</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>default is false. Set to true to append current date to UTC time format.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1902">line 1902</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A formatted time and date string.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="getActiveStream"><span class="type-signature"></span>getActiveStream()</h4>
</dt>
<dd>
<div class="description">
<p>This method returns the active stream</p>
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1964">line 1964</a>
</li>
</ul>
</dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p><a href="module-MediaPlayer.html#~STREAMING_NOT_INITIALIZED_ERROR"><code>STREAMING_NOT_INITIALIZED_ERROR</code></a> if called before initializePlayback function</p>
</div>
</dd>
<hr>
<dt>
<h4 class="name" id="getAutoPlay"><span class="type-signature"></span>getAutoPlay()</h4>
</dt>
<dd>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="streaming_MediaPlayer.js.html">streaming/MediaPlayer.js</a>,
<a href="streaming_MediaPlayer.js.html#sunlight-1-line-1021">line 1021</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The current autoPlay state.</p>
</div>
<dl>
<dt>
Type
</dt>