Skip to content

Commit

Permalink
Catch certificate errors in demo
Browse files Browse the repository at this point in the history
If the demo fails to fetch a cert for custom content, it will now
catch and display the error.

Issue #1914

Change-Id: Ib058cdcf8d90b675b3624c264ec7a80909d1cc47
  • Loading branch information
joeyparrish committed May 8, 2019
1 parent 189902b commit 43770e0
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,26 +854,26 @@ class ShakaDemoMain {
* @param {ShakaDemoAssetInfo} asset
*/
async loadAsset(asset) {
this.selectedAsset = asset;
const videoBar = document.getElementById('video-bar');
this.showNode_(videoBar);
this.closeError_();
this.video_.poster = ShakaDemoMain.mainPoster_;
try {
this.selectedAsset = asset;
const videoBar = document.getElementById('video-bar');
this.showNode_(videoBar);
this.closeError_();
this.video_.poster = ShakaDemoMain.mainPoster_;

// Scroll to the top of the page, so that if the page is scrolled down, the
// user won't need to manually scroll up to see the video.
videoBar.scrollIntoView({behavior: 'smooth', block: 'start'});
// Scroll to the top of the page, so that if the page is scrolled down,
// the user won't need to manually scroll up to see the video.
videoBar.scrollIntoView({behavior: 'smooth', block: 'start'});

// The currently-selected asset changed, so update asset cards.
this.dispatchEventWithName_('shaka-main-selected-asset-changed');
// The currently-selected asset changed, so update asset cards.
this.dispatchEventWithName_('shaka-main-selected-asset-changed');

await this.drmConfiguration_(asset);
this.controls_.getCastProxy().setAppData({'asset': asset});
await this.drmConfiguration_(asset);
this.controls_.getCastProxy().setAppData({'asset': asset});

const manifestUri = (asset.storedContent ?
asset.storedContent.offlineUri :
null) || asset.manifestUri;
try {
const manifestUri = (asset.storedContent ?
asset.storedContent.offlineUri :
null) || asset.manifestUri;
await this.player_.load(manifestUri);
// Now that something is loaded, enable controls.
if (this.nativeControlsEnabled_) {
Expand Down

0 comments on commit 43770e0

Please sign in to comment.