Skip to content

Commit

Permalink
Add 'restrictions' for the shaka player abr
Browse files Browse the repository at this point in the history
  • Loading branch information
comrat committed Nov 3, 2023
1 parent 06ca56e commit 34df96b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions platform/video.shaka/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ Player.prototype.setupDrm = function(type, options, callback, error) {
var ui = this.ui
log("DefaultBand", ui.maxBandwidth)
if (ui.maxBandwidth || ui.minBandwidth) {
var abr = {}
var restrictions = {}
if (ui.maxBandwidth)
abr.maxBandwidth = ui.maxBandwidth
restrictions.maxBandwidth = ui.maxBandwidth
if (ui.minBandwidth)
abr.minBandwidth = ui.minBandwidth
config.abr = abr
restrictions.minBandwidth = ui.minBandwidth

config.abr = { restrictions: restrictions }
}

log("SetupDRM", config)
Expand Down Expand Up @@ -153,18 +154,19 @@ Player.prototype.setAudioTrack = function(trackId) {

var abr = {
enabled: false,
switchInterval: 0
switchInterval: 0,
restrictions: { }
}

var ui = this.ui
if (ui.defaultBandwidth)
abr.defaultBandwidthEstimate = ui.defaultBandwidth
abr.restrictions.defaultBandwidthEstimate = ui.defaultBandwidth

if (ui.maxBandwidth)
abr.maxBandwidth = ui.maxBandwidth
abr.restrictions.maxBandwidth = ui.maxBandwidth

if (ui.minBandwidth)
abr.minBandwidth = ui.minBandwidth
abr.restrictions.minBandwidth = ui.minBandwidth

this.shakaPlayer.configure({
abr: abr,
Expand Down Expand Up @@ -196,18 +198,17 @@ Player.prototype.setVideoTrack = function(trackId) {

var abr = {
enabled: false,
switchInterval: 0
switchInterval: 0,
restrictions: { }
}

var ui = this.ui
if (ui.defaultBandwidth)
abr.defaultBandwidthEstimate = ui.defaultBandwidth

if (ui.maxBandwidth)
abr.maxBandwidth = ui.maxBandwidth
abr.restrictions.maxBandwidth = ui.maxBandwidth

if (ui.minBandwidth)
abr.minBandwidth = ui.minBandwidth
abr.restrictions.minBandwidth = ui.minBandwidth

this.shakaPlayer.configure({ abr: abr });
this._videoTrackHeight = video.height
Expand Down

0 comments on commit 34df96b

Please sign in to comment.