Skip to content

Commit

Permalink
fix(FEC-11270): cap to player size doesn't apply (#152)
Browse files Browse the repository at this point in the history
Issue: applyRestriction doesn't trigger from playkit, no restriction has changed.
Solution: should apply the logic for capLevelToPlayerSize once tracks are available., it shouldn't change from playkit at all.
  • Loading branch information
Yuvalke authored May 23, 2021
1 parent 750cc75 commit 1ca44b1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,11 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
}

/**
* apply ABR restrictions
* apply Capping to player size restrictions
* @private
* @returns {void}
*/
_maybeApplyAbrRestrictions(): void {
_maybeCapLevelToPlayerSize(): void {
if (this._config.capLevelToPlayerSize) {
const getRestrictions = () => {
return {
Expand All @@ -560,7 +560,16 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
this._clearVideoUpdateTimer();
this._videoSizeUpdateTimer = setInterval(() => this._updateRestriction(getRestrictions()), ABR_RESTRICTION_UPDATE_INTERVAL);
this._updateRestriction(getRestrictions());
} else {
}
}

/**
* apply ABR restrictions
* @private
* @returns {void}
*/
_maybeApplyAbrRestrictions(): void {
if (!this._config.capLevelToPlayerSize) {
this._clearVideoUpdateTimer();
if (Utils.Object.hasPropertyPath(this._config, 'abr.restrictions')) {
this._updateRestriction(this._config.abr.restrictions);
Expand Down Expand Up @@ -769,6 +778,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
})
.then(() => {
const data = {tracks: this._getParsedTracks()};
this._maybeCapLevelToPlayerSize();
DashAdapter._logger.debug('The source has been loaded successfully');
resolve(data);
})
Expand Down

0 comments on commit 1ca44b1

Please sign in to comment.