Skip to content

Commit

Permalink
Add a brief error event tutorial
Browse files Browse the repository at this point in the history
Closes #106.

Change-Id: Ifdacd0f54c81052940ac00fa69c31cca322c415a
  • Loading branch information
joeyparrish committed Jun 23, 2015
1 parent cdb2934 commit ce77c47
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tutorials/errors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
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>
8 changes: 8 additions & 0 deletions tutorials/errors_sample1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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) { /* ... */ });
1 change: 1 addition & 0 deletions tutorials/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{ "player": { "title": "DASH Playback with the Shaka Player" } },
{ "offline": { "title": "Offline Playback with the Shaka Player" } },
{ "live": { "title": "Live Streaming" } },
{ "errors": { "title": "Listening for Errors" } },
{ "language": { "title": "Language Support" } },
{ "dev": { "title": "Shaka Player Development" } },
{ "windows": { "title": "Building on Windows" } },
Expand Down

0 comments on commit ce77c47

Please sign in to comment.