mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-14 15:56:38 +03:00
ce77c47c69
Closes #106. Change-Id: Ifdacd0f54c81052940ac00fa69c31cca322c415a
43 lines
1.5 KiB
HTML
43 lines
1.5 KiB
HTML
<!--
|
|
Copyright 2015 Google Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<h3 class="tutorial-heading">
|
|
Player Errors vs Video Errors
|
|
</h3>
|
|
|
|
<p>
|
|
Shaka Player dispatches 'error' events to the application. Although you may be
|
|
used to listening for events on the video element, this is not recommended when
|
|
using Shaka Player. There can be spurious events when unloading video sources,
|
|
and Shaka Player will filter these out for you. In addition, Shaka Player will
|
|
dispatch certain DASH-related or EME-related errors that you cannot receive any
|
|
other way.
|
|
</p>
|
|
|
|
<pre class="prettyprint source"><code id="errors_sample1">var video = document.getElementById('video');
|
|
var player = new shaka.player.Player(video);
|
|
|
|
// DO listen for errors from the Player.
|
|
player.addEventListener('error', function(event) { /* ... */ });
|
|
|
|
// DO NOT listen for errors from the video element.
|
|
//video.addEventListener('error', function(event) { /* ... */ });
|
|
</code></pre>
|
|
|
|
<p>
|
|
See also the list of events fired by {@link shaka.player.Player}.
|
|
</p>
|