From cfb0af7e41b7ab46fd5d5ea3fa5aacee9a657368 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Wed, 31 May 2023 09:00:03 +0200 Subject: [PATCH] Add autoLoad flag to start playback in reference client once page is loaded (#4193) --- samples/dash-if-reference-player/app/main.js | 39 +++++--------------- samples/dash-if-reference-player/index.html | 6 +++ 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/samples/dash-if-reference-player/app/main.js b/samples/dash-if-reference-player/app/main.js index 2e81c7c87a..3052643e71 100644 --- a/samples/dash-if-reference-player/app/main.js +++ b/samples/dash-if-reference-player/app/main.js @@ -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; @@ -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, @@ -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]; } @@ -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; @@ -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)); @@ -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(); } } diff --git a/samples/dash-if-reference-player/index.html b/samples/dash-if-reference-player/index.html index d0632f33ee..58dbde0484 100644 --- a/samples/dash-if-reference-player/index.html +++ b/samples/dash-if-reference-player/index.html @@ -145,6 +145,12 @@
Playback
+