Skip to content

Commit

Permalink
Add autoLoad flag to start playback in reference client once page is …
Browse files Browse the repository at this point in the history
…loaded (#4193)
  • Loading branch information
dsilhavy committed May 31, 2023
1 parent 6994e34 commit cfb0af7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
39 changes: 10 additions & 29 deletions samples/dash-if-reference-player/app/main.js
Expand Up @@ -290,6 +290,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'

// Starting Options
$scope.autoPlaySelected = true;
$scope.autoLoadSelected = false;
$scope.cmcdEnabled = false;
$scope.cmsdEnabled = false;
$scope.cmsdApplyMb = false;
Expand Down Expand Up @@ -1495,6 +1496,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
mpd: encodeURIComponent(decodeURIComponent($scope.selectedItem.url)),
loop: $scope.loopSelected,
autoPlay: $scope.autoPlaySelected,
autoLoad: $scope.autoLoadSelected,
drmToday: $scope.drmToday,
forceQualitySwitchSelected: $scope.forceQualitySwitchSelected,
drmPrioritiesEnabled: $scope.prioritiesEnabled,
Expand Down Expand Up @@ -1559,12 +1561,10 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
for (var setting in settings) {
if (typeof defaultSettings[setting] === 'object' && defaultSettings[setting] !== null && !(defaultSettings[setting] instanceof Array)) {
settingDifferencesObject[setting] = this.makeSettingDifferencesObject(settings[setting], defaultSettings[setting], false);
}
else if(settings[setting] !== defaultSettings[setting]){
if(Array.isArray(settings[setting])){
} else if (settings[setting] !== defaultSettings[setting]) {
if (Array.isArray(settings[setting])) {
settingDifferencesObject[setting] = _arraysEqual(settings[setting], defaultSettings[setting]) ? {} : settings[setting];
}
else {
} else {
settingDifferencesObject[setting] = settings[setting];
}

Expand Down Expand Up @@ -1763,6 +1763,9 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
$scope.autoPlaySelected = this.parseBoolean(value);
$scope.toggleAutoPlay();
break;
case 'autoLoad':
$scope.autoLoadSelected = this.parseBoolean(value);
break;
case 'drmToday':
$scope.drmToday = this.parseBoolean(value);
break;
Expand Down Expand Up @@ -2295,18 +2298,6 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
var vars = getUrlVars();
var item = {};

if (vars && vars.hasOwnProperty('url')) {
item.url = vars.url;
}

// if (vars && vars.hasOwnProperty('mpd')) {
// item.url = vars.mpd;
// }

if (vars && vars.hasOwnProperty('source')) {
item.url = vars.source;
}

if (vars && vars.hasOwnProperty('stream')) {
try {
item = JSON.parse(atob(vars.stream));
Expand All @@ -2326,18 +2317,8 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
}
}

if (item.url) {
var startPlayback = false;

$scope.selectedItem = item;

if (vars.hasOwnProperty('autoplay')) {
startPlayback = (vars.autoplay === 'true');
}

if (startPlayback) {
$scope.doLoad();
}
if ($scope.autoLoadSelected && $scope.selectedItem) {
$scope.doLoad();
}
}

Expand Down
6 changes: 6 additions & 0 deletions samples/dash-if-reference-player/index.html
Expand Up @@ -145,6 +145,12 @@
<div class="options-item">
<div class="options-item-title">Playback</div>
<div class="options-item-body">
<label class="topcoat-checkbox" data-toggle="tooltip" data-placement="right"
title="Enables automatic loading of the media once the reference page is opened.">
<input type="checkbox" ng-model="autoLoadSelected"
ng-checked="autoLoadSelected">
Auto-Load
</label>
<label class="topcoat-checkbox" data-toggle="tooltip" data-placement="right"
title="Enables automatic startup of the media once the media is loaded">
<input type="checkbox" ng-model="autoPlaySelected" ng-change="toggleAutoPlay()"
Expand Down

0 comments on commit cfb0af7

Please sign in to comment.