Skip to content

Commit

Permalink
Fixed a bug in how the demo detects audio assets.
Browse files Browse the repository at this point in the history
In HLS, the resolution property is optional. This means we
cannot assume that a variant with a video stream has a defined
width. Such a check was causing us to incorrectly identify
variants as audio-only, and applying the audio-only poster
incorrectly.
Instead, this change checks for the presence of a video codec.

Closes #794

Change-Id: I80ebd11ebc735468220816c5133a3398436f4530
  • Loading branch information
theodab committed May 22, 2017
1 parent 16f9ca6 commit 3130efb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions demo/asset_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ shakaDemo.load = function() {
shakaDemo.hashShouldChange_();

// Audio-only tracks have no width/height.
var videoTracks =
player.getVariantTracks().filter(function(t) { return t.width; });
var videoTracks = player.getVariantTracks().filter(function(t) {
return t.videoCodec;
});

// Set a different poster for audio-only assets.
if (videoTracks.length == 0) {
Expand Down
5 changes: 3 additions & 2 deletions demo/receiver_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ ShakaReceiver.prototype.checkIdle_ = function() {
this.cancelIdleTimer_();

// Audio-only tracks have no width/height.
var videoTracks =
this.player_.getVariantTracks().filter(function(t) { return t.width; });
var videoTracks = this.player_.getVariantTracks().filter(function(t) {
return t.videoCodec;
});

// Set a special poster for audio-only assets.
if (videoTracks.length == 0) {
Expand Down

0 comments on commit 3130efb

Please sign in to comment.