Skip to content

Commit

Permalink
Only apply restrictions to video tracks.
Browse files Browse the repository at this point in the history
Closes #179

Change-Id: I5ef1167903b98840ce2d9d031d99845269e9e1d4
  • Loading branch information
Timothy Drews committed Sep 10, 2015
1 parent 4e69e00 commit 35d4c5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 3 additions & 5 deletions lib/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,9 @@ shaka.player.Player.prototype.isLive = function() {
*
* <li>
* <b>restrictions</b>: shaka.player.Restrictions <br>
* Sets the content restrictions. For example, if maxBandwidth = 700000 and
* minBandwidth = 200000 then playback will be restricted to video tracks
* with bandwidths between 700000 and 200000. Note that if the current video
* track does not meet the restrictions then the stream will not
* automatically switch tracks.
* Sets the video track restrictions. For example, if minBandwidth = 200000
* and maxBandwidth = 700000 then the player will only permit switching to
* video tracks with bandwidths between 200000 and 700000.
* </ul>
*
* @example
Expand Down
6 changes: 3 additions & 3 deletions lib/player/restrictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ goog.provide('shaka.player.Restrictions');


/**
* Creates a Restrictions object, which describes a set of content restrictions.
* A VideoSource will not adapt (or permit switching) to any tracks that exceed
* the specified limitations.
* Creates a Restrictions object, which describes a set of video track
* restrictions. A VideoSource will not adapt (or permit switching) to video
* tracks that do not meet the specified limitations.
*
* @constructor
* @struct
Expand Down
8 changes: 5 additions & 3 deletions lib/player/stream_video_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ shaka.player.StreamVideoSource.SEEK_TOLERANCE_ = 0.01;
*
* <li>
* <b>restrictions</b>: shaka.player.Restrictions <br>
* Sets the content restrictions.
* Sets the video track restrictions.
* </ul>
*
* @example
Expand Down Expand Up @@ -809,7 +809,7 @@ shaka.player.StreamVideoSource.prototype.setPlaybackStartTime =


/**
* Applies the content restrictions, if any.
* Applies the video track restrictions, if any.
*
* @private
*/
Expand All @@ -831,6 +831,8 @@ shaka.player.StreamVideoSource.prototype.applyRestrictions_ = function() {
for (var j = 0; j < periodInfo.streamSetInfos.length; ++j) {
var streamSetInfo = periodInfo.streamSetInfos[j];

if (streamSetInfo.contentType != 'video') continue;

for (var k = 0; k < streamSetInfo.streamInfos.length; ++k) {
var streamInfo = streamSetInfo.streamInfos[k];

Expand Down Expand Up @@ -862,7 +864,7 @@ shaka.player.StreamVideoSource.prototype.applyRestrictions_ = function() {
shaka.log.info(
streamInfo.allowedByApplication ? 'Permitting' : 'Restricting',
'stream', streamInfo.id + '.',
'The application has applied new content restrictions.');
'The application has applied new video track restrictions.');
tracksChanged = true;
} // for k
} // for j
Expand Down

0 comments on commit 35d4c5e

Please sign in to comment.