diff --git a/lib/player/player.js b/lib/player/player.js index 322825b164..a7abc6166c 100644 --- a/lib/player/player.js +++ b/lib/player/player.js @@ -746,13 +746,13 @@ shaka.player.Player.prototype.setPlaybackRate = function(rate) { * For example: A Restrictions instance with maxBandwidth = 700000 * and minBandwidth = 200000 will restrict * playback to video tracks with bandwidth between 700000 and 200000. + * @throws {TypeError} if restrictions argument isn't a Restrictions instance. * @export */ shaka.player.Player.prototype.setRestrictions = function(restrictions) { - shaka.asserts - .assert(restrictions instanceof shaka.player.DrmSchemeInfo.Restrictions); - if (!(restrictions instanceof shaka.player.DrmSchemeInfo.Restrictions)) - return; + if (!(restrictions instanceof shaka.player.DrmSchemeInfo.Restrictions)) { + throw new TypeError('Argument must be a Restrictions instance.'); + } this.restrictions_ = restrictions; this.videoSource_.setRestrictions(this.restrictions_); };