Skip to content

Commit

Permalink
Add stall threshold options to reference player
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmccartney committed Feb 7, 2025
1 parent 332df78 commit 7558960
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
44 changes: 42 additions & 2 deletions samples/dash-if-reference-player/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
$scope.cmcdMode = 'query';
$scope.cmcdAllKeys = ['br', 'd', 'ot', 'tb', 'bl', 'dl', 'mtp', 'nor', 'nrr', 'su', 'bs', 'rtp', 'cid', 'pr', 'sf', 'sid', 'st', 'v']

$scope.stallThreshold = 0.3;
$scope.lowLatencyStallThreshold = 0.3;

// Persistent license
$scope.persistentSessionId = {};
$scope.selectedKeySystem = null;
Expand Down Expand Up @@ -778,6 +781,26 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
});
};

$scope.updateStallThreshold = function () {
$scope.player.updateSettings({
streaming: {
buffer: {
stallThreshold: parseFloat($scope.stallThreshold)
}
}
});
}

$scope.updateLowLatencyStallThreshold = function () {
$scope.player.updateSettings({
streaming: {
buffer: {
lowLatencyStallThreshold: parseFloat($scope.lowLatencyStallThreshold)
}
}
});
}

$scope.updateInitialRoleVideo = function () {
$scope.player.setInitialMediaSettingsFor('video', {
role: $scope.initialSettings.video
Expand Down Expand Up @@ -813,7 +836,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'

$scope._backconvertRoleScheme = function (setting) {
var scheme = 'off';

if (setting) {
scheme = undefined;
switch (setting.schemeIdUri) {
Expand Down Expand Up @@ -1136,6 +1159,16 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
config.streaming.abr.maxBitrate = { 'video': maxBitrate };
}

const stallThreshold = parseFloat($scope.stallThreshold);
if (!isNaN(stallThreshold)) {
config.streaming.buffer.stallThreshold = stallThreshold;
}

const lowLatencyStallThreshold = parseFloat($scope.lowLatencyStallThreshold);
if (!isNaN(lowLatencyStallThreshold)) {
config.streaming.buffer.lowLatencyStallThreshold = lowLatencyStallThreshold;
}

config.streaming.cmcd.sid = $scope.cmcdSessionId ? $scope.cmcdSessionId : null;
config.streaming.cmcd.cid = $scope.cmcdContentId ? $scope.cmcdContentId : null;
config.streaming.cmcd.rtp = $scope.cmcdRtp ? $scope.cmcdRtp : null;
Expand Down Expand Up @@ -1935,7 +1968,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
if (scheme === 'off') {
delete settings.accessibility;
} else {
Object.assign(settings, {accessibility: $scope._genSettingsAudioAccessibility(scheme, $scope.initialSettings.audioAccessibility)} );
Object.assign(settings, { accessibility: $scope._genSettingsAudioAccessibility(scheme, $scope.initialSettings.audioAccessibility) });
}
$scope.player.setInitialMediaSettingsFor('audio', settings);
break;
Expand Down Expand Up @@ -2308,6 +2341,12 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
$scope.useSuggestedPresentationDelay = currentConfig.streaming.delay.useSuggestedPresentationDelay;
}

function setStallThresholdOptions() {
var currentConfig = $scope.player.getSettings();
$scope.stallThreshold = currentConfig.streaming.buffer.stallThreshold;
$scope.lowLatencyStallThreshold = currentConfig.streaming.buffer.lowLatencyStallThreshold;
}

function setInitialSettings() {
var currentConfig = $scope.player.getSettings();
if (currentConfig.streaming.abr.initialBitrate.video !== -1) {
Expand Down Expand Up @@ -2468,6 +2507,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
setDrmOptions();
setTextOptions();
setLiveDelayOptions();
setStallThresholdOptions()
setInitialSettings();
setTrackSwitchModeSettings();
setInitialLogLevel();
Expand Down
13 changes: 13 additions & 0 deletions samples/dash-if-reference-player/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,19 @@
</div>
</div>
</div>
<div class="options-item">
<div class="options-item-title">Buffer</div>
<div class="options-item-body">
<div class="sub-options-item-body">
<label class="options-label">Stall Threshold:</label>
<input type="text" class="form-control" placeholder="value in seconds" ng-model="stallThreshold"
ng-change="updateStallThreshold()">
<label class="options-label">Low Latency Stall Threshold:</label>
<input type="text" class="form-control" placeholder="value in seconds" ng-model="lowLatencyStallThreshold"
ng-change="updateLowLatencyStallThreshold()">
</div>
</div>
</div>
<div class="options-item">
<div class="options-item-title">Initial Settings</div>
<div class="options-item-body">
Expand Down

0 comments on commit 7558960

Please sign in to comment.