From 143a0708a7c4ea7b14c2da34c1bd10082204af90 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Tue, 11 Jul 2023 16:18:18 +0200 Subject: [PATCH 01/28] Update version number to 4.7.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b85b9b9c12..58cbed18ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dashjs", - "version": "4.7.1", + "version": "4.7.2", "description": "A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.", "author": "Dash Industry Forum", "license": "BSD-3-Clause", From 3a1cfc273bbdd3f0fc5bc2f1dbf63ebea4df12be Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Tue, 11 Jul 2023 16:22:53 +0200 Subject: [PATCH 02/28] Update content steering reference stream --- samples/advanced/content-steering.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/advanced/content-steering.html b/samples/advanced/content-steering.html index be6e3338a3..c14be08533 100644 --- a/samples/advanced/content-steering.html +++ b/samples/advanced/content-steering.html @@ -249,7 +249,7 @@

Architecture

+ value="https://cloudfront.content-steering.com/bbb/playlist_steering_cf_https.mpd">
From 56b33ca0a3ae76362604c29ef765f271f9c172fd Mon Sep 17 00:00:00 2001 From: Benjamin Clos Date: Wed, 12 Jul 2023 05:33:03 -0600 Subject: [PATCH 03/28] fix(types): TextRequest url property (#4211) * chore: update typescript@^5; * fix(types): set skipLibChecks: false; * fix(types): fix url property for TextRequest & FragmentRequest; --- index.d.ts | 2 +- package-lock.json | 16 ++++++++-------- package.json | 2 +- tsconfig.json | 5 ++++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/index.d.ts b/index.d.ts index d7bc3f5b83..43c4a1fded 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4067,7 +4067,7 @@ declare namespace dashjs { startTime: number; timescale: number; type: 'InitializationSegment' | 'MediaSegment' | null; - url: string; + url: string | null; wallStartTime: number | null; } diff --git a/package-lock.json b/package-lock.json index d53abe2130..e01b7fe8ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "sinon": "^7.3.2", "stream-browserify": "^3.0.0", "string-replace-loader": "^3.0.1", - "typescript": "^4.1.5", + "typescript": "^5.1.3", "webpack": "^5.75.0", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", @@ -16278,16 +16278,16 @@ "dev": true }, "node_modules/typescript": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", - "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", + "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/ua-parser-js": { @@ -31088,9 +31088,9 @@ "dev": true }, "typescript": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", - "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", + "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index 58cbed18ba..1a67745e9a 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "sinon": "^7.3.2", "stream-browserify": "^3.0.0", "string-replace-loader": "^3.0.1", - "typescript": "^4.1.5", + "typescript": "^5.1.3", "webpack": "^5.75.0", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", diff --git a/tsconfig.json b/tsconfig.json index cdcebb708a..1aa9a6d037 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,9 @@ "index.d.ts" ], "compilerOptions": { - "noImplicitAny": true + "noImplicitAny": true, + "strict": true, /* Enable all strict type-checking options. */ + "skipLibCheck": false } + } \ No newline at end of file From 520cfe512ec2c34f474f2ae4cf1bfaf252550e47 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Wed, 12 Jul 2023 14:24:59 +0200 Subject: [PATCH 04/28] Fix wrong Typescript definition of updateSource (#4223) --- index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 43c4a1fded..10a53f8a1b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -758,8 +758,6 @@ declare namespace dashjs { addHttpRequest(request: HTTPRequest, responseURL: string, responseStatus: number, responseHeaders: object, traces: object): void; addManifestUpdateRepresentationInfo(representation: Representation, mediaType: MediaType): void; - - updateSource(urlOrManifest: string | object): void; getCurrentLiveLatency(): number; @@ -1306,6 +1304,8 @@ declare namespace dashjs { getSource(): string | object; + updateSource(urlOrManifest: string | object): void; + getCurrentLiveLatency(): number; getTopBitrateInfoFor(type: MediaType): BitrateInfo; From e56b6691bbad0d474736dcf1efaba80bbd970442 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Wed, 12 Jul 2023 15:07:00 +0200 Subject: [PATCH 05/28] =?UTF-8?q?Fix=20a=20bug=20for=20VTT.js=20based=20re?= =?UTF-8?q?ndering=20that=20causes=20cues=20not=20to=20be=20remov=E2=80=A6?= =?UTF-8?q?=20(#4224)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix a bug for VTT.js based rendering that causes cues not to be removed after switching to a different stream --- src/streaming/text/TextTracks.js | 47 ++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/streaming/text/TextTracks.js b/src/streaming/text/TextTracks.js index 6a8ec6114d..baa524ec19 100644 --- a/src/streaming/text/TextTracks.js +++ b/src/streaming/text/TextTracks.js @@ -449,7 +449,7 @@ function TextTracks(config) { if (JSON.stringify(cue1[key]) !== JSON.stringify(cue2[key])) { return false; } - }; + } return true; } @@ -629,21 +629,25 @@ function TextTracks(config) { WebVTT.processCues(window, [cue], vttCaptionContainer, cue.cueID); } else if (cue.isActive && (cue.startTime > time || cue.endTime < time)) { cue.isActive = false; - if (vttCaptionContainer) { - const divs = vttCaptionContainer.childNodes; - for (let i = 0; i < divs.length; ++i) { - if (divs[i].id === cue.cueID) { - vttCaptionContainer.removeChild(divs[i]); - --i; - } - } - } + _removeManualCue(cue); } }) } } } + function _removeManualCue(cue) { + if (vttCaptionContainer) { + const divs = vttCaptionContainer.childNodes; + for (let i = 0; i < divs.length; ++i) { + if (divs[i].id === cue.cueID) { + vttCaptionContainer.removeChild(divs[i]); + --i; + } + } + } + } + function disableManualTracks() { const activeTracks = _getManualActiveTracks(); @@ -755,20 +759,33 @@ function TextTracks(config) { } function cueInRange(cue, start, end, strict = true) { + if (!cue) { + return false + } return (isNaN(start) || (strict ? cue.startTime : cue.endTime) >= start) && (isNaN(end) || (strict ? cue.endTime : cue.startTime) <= end); } function deleteTrackCues(track, start, end, strict = true) { - if (track.cues) { - const cues = track.cues; + if (track && (track.cues || track.manualCueList)) { + const mode = track.cues && track.cues.length > 0 ? 'native' : 'custom'; + const cues = mode === 'native' ? track.cues : track.manualCueList; + + if (!cues || cues.length === 0) { + return; + } const lastIdx = cues.length - 1; for (let r = lastIdx; r >= 0; r--) { if (cueInRange(cues[r], start, end, strict)) { - if (cues[r].onexit) { - cues[r].onexit(); + if (mode === 'native') { + if (cues[r].onexit) { + cues[r].onexit(); + } + track.removeCue(cues[r]); + } else { + _removeManualCue(cues[r]); + delete track.manualCueList[r] } - track.removeCue(cues[r]); } } } From ff6884e342230d8bb6c9fddb425cb8e7a67e5cbd Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Wed, 12 Jul 2023 16:01:15 +0200 Subject: [PATCH 06/28] Define target "web" and "es5" for webpack to make build files ES5 compliant (#4225) --- build/webpack.base.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/webpack.base.js b/build/webpack.base.js index cf117ffa99..b44781e4dc 100644 --- a/build/webpack.base.js +++ b/build/webpack.base.js @@ -5,6 +5,7 @@ const out_dir = '../dist'; const config = { devtool: 'source-map', + target: ['web', 'es5'], output: { path: path.resolve(__dirname, out_dir), publicPath: '/dist/', From 3e1356f1e4402a62193b5d38a0f5e9a0d23a4555 Mon Sep 17 00:00:00 2001 From: Minhui Zhao Date: Fri, 14 Jul 2023 17:16:53 +1000 Subject: [PATCH 07/28] Fix init value for storeLastSettings (#4221) * Use `lastMediaSettingsCachingInfo` as default value of `storeLastSettings` * Remove useless function param * Add `noSettingsSave` flag to MediaPlayer.setCurrentTrack * Add new setting `saveLastMediaSettingsForCurrentStreamingSession` * Add test suites to cover new settings flag * Add missing jsdoc * Update index.d.ts --- index.d.ts | 3 +- samples/dash-if-reference-player/app/main.js | 10 +++ samples/dash-if-reference-player/index.html | 6 ++ src/core/Settings.js | 8 +++ src/streaming/MediaPlayer.js | 5 +- src/streaming/controllers/MediaController.js | 12 ++-- .../streaming.controllers.MediaController.js | 63 +++++++++++++++++++ 7 files changed, 99 insertions(+), 8 deletions(-) diff --git a/index.d.ts b/index.d.ts index 10a53f8a1b..a6ccba87d9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1042,6 +1042,7 @@ declare namespace dashjs { enabled?: boolean; ttl?: number; }; + saveLastMediaSettingsForCurrentStreamingSession?: boolean; cacheLoadThresholds?: { video?: number; audio?: number; @@ -1344,7 +1345,7 @@ declare namespace dashjs { getInitialMediaSettingsFor(type: MediaType): MediaSettings; - setCurrentTrack(track: MediaInfo): void; + setCurrentTrack(track: MediaInfo, noSettingsSave?: boolean): void; addABRCustomRule(type: string, rulename: string, rule: object): void; diff --git a/samples/dash-if-reference-player/app/main.js b/samples/dash-if-reference-player/app/main.js index 1e8885c9dc..b06fd6b6c0 100644 --- a/samples/dash-if-reference-player/app/main.js +++ b/samples/dash-if-reference-player/app/main.js @@ -302,6 +302,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors' $scope.scheduleWhilePausedSelected = true; $scope.calcSegmentAvailabilityRangeFromTimelineSelected = false; $scope.reuseExistingSourceBuffersSelected = true; + $scope.saveLastMediaSettingsSelected = true; $scope.localStorageSelected = true; $scope.jumpGapsSelected = true; $scope.fastSwitchSelected = true; @@ -669,6 +670,14 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors' }); }; + $scope.toggleSaveLastMediaSettings = function () { + $scope.player.updateSettings({ + 'streaming': { + 'saveLastMediaSettingsForCurrentStreamingSession': $scope.saveLastMediaSettingsSelected + } + }); + }; + $scope.toggleLocalStorage = function () { $scope.player.updateSettings({ 'streaming': { @@ -2125,6 +2134,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors' $scope.scheduleWhilePausedSelected = currentConfig.streaming.scheduling.scheduleWhilePaused; $scope.calcSegmentAvailabilityRangeFromTimelineSelected = currentConfig.streaming.timeShiftBuffer.calcFromSegmentTimeline; $scope.reuseExistingSourceBuffersSelected = currentConfig.streaming.buffer.reuseExistingSourceBuffers; + $scope.saveLastMediaSettingsSelected = currentConfig.streaming.saveLastMediaSettingsForCurrentStreamingSession; $scope.localStorageSelected = currentConfig.streaming.lastBitrateCachingInfo.enabled; $scope.jumpGapsSelected = currentConfig.streaming.gaps.jumpGaps; } diff --git a/samples/dash-if-reference-player/index.html b/samples/dash-if-reference-player/index.html index 84e2aa299d..ae78f5c2cb 100644 --- a/samples/dash-if-reference-player/index.html +++ b/samples/dash-if-reference-player/index.html @@ -188,6 +188,12 @@ ng-checked="reuseExistingSourceBuffersSelected"> Reuse SourceBuffers + + +