Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow requests to be modified in an async manner #4024

Conversation

littlespex
Copy link
Contributor

@littlespex littlespex commented Aug 11, 2022

Possible solution for #3758 & #3957. The modifier can be applied via:

player.extend('RequestModifier', () => {
  return {
    modifyRequest: async (request: any) => {
      // wait for an async process
      await new Promise(resolve => setTimeout(resolve, 1000));

      // modify the request;
      const url = new URL(request.url);
      url.searchParams.append('TESTING', '1234');      
      request.url = url.toString();
      request.headers.TEST = '1234';
    }
  };
});

NOTE: Disable white space in "files changed" tab for a clearer view of what's changed.

There are a few open questions:

  • I'm not sure an optional function fits with the rest of the architecture. Maybe add a separate config option?
  • Should the modifyRequest function mutate the given request object, or return a it's own request?
  • How does this effect timing stats? The modifier is applied before requestStartTime is recorded, so the download stats should function as they did before, but will any extra delay in the async function mess with any other calculations? If so, does it matter, or can we add a note in the docs like: "If you use async modifiers, stats may be adversely effected".

@dsilhavy dsilhavy added this to the 4.5.0 milestone Aug 12, 2022
@dsilhavy dsilhavy self-requested a review August 12, 2022 10:48
modifyRequest(httpRequest, requestModifier)
.then(() => {
// Variables will be used in the callback functions
const requestStartTime = new Date();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little odd that the request timer starts after the asynchronous modifications complete, but before synchronous. I would think this should be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to keep requestStartTime specific to the HTTP transaction. I can see valid reasons for either approach.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @littlespex here, prefer to do the modification before starting load . This would align with modifyRequestURL

modifyRequest(httpRequest, requestModifier)
.then(() => {
// Variables will be used in the callback functions
const requestStartTime = new Date();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as fetch loader, should the requestStartTime include asynchronous modifications?

@@ -31,20 +31,43 @@

import FactoryMaker from '../../core/FactoryMaker';

export function modifyRequest(httpRequest, requestModifier) {
if (!(requestModifier && requestModifier.modifyRequest)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a small performance and timing impact here by always calling modifyRequest. This gaurantees the rest of the code will occur on nextTick even when no requestModifier is supplied. Do you think it would be better to avoid this impact or are you ok with this slight change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has been updated to only apply the async modifier if it exists.

@@ -9,6 +9,7 @@ import {
}
from '../../src/streaming/vo/metrics/HTTPRequest';
import Settings from '../../src/core/Settings';
import { sleep } from './helpers/Async';

const expect = require('chai').expect;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test should be added to verify that an optional modifyRequestURL function is supported. Once this ships and people are supplying a requestModifer without this method it shouldn't regress.

Copy link

@ElasticPencil ElasticPencil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this is a good solution and would allow me to use this for solving the async authorization.

@dsilhavy
Copy link
Collaborator

@littlespex @ElasticPencil Apologies for the delay here. I am currently finishing the first implementation of content steering and I will look into this afterwards.

@dsilhavy
Copy link
Collaborator

dsilhavy commented Sep 5, 2022

Thanks @littlespex @ElasticPencil looks good to me. I added some minor comments above. One more request: Can you please modify the sample plage samples/advanced/extend.html to include this new function. Thank you

Comment on lines -41 to +58
}
},
modifyRequest(request) {
/* Modify the entire request. Allows for async modifications */
var url = new URL(request.url);

if (!/\.mpd$/.test(url.pathname)) {
return;
}

return fetch('https://time.akamai.com')
.then(function (response) {
return response.text();
})
.then(function (text) {
url.searchParams.set('now', text);
request.url = url.toString();
});
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added example

@dsilhavy dsilhavy merged commit e6b71ea into Dash-Industry-Forum:development Sep 12, 2022
grabofus added a commit to DiceTechnology/dash.js that referenced this pull request Nov 8, 2022
* Fix/cmcd (Dash-Industry-Forum#3745)

* Remove last comma in the CMCD string

* Remove quotes from CMCD token fields

* Only show values in CMCD demo page that have been reported

* Feature: buffer robustness (Dash-Industry-Forum#3743)

* Refactor PlaybackController.js

* Refactor BufferController.js

* Refactor SourceBufferSink.js

* Reset MSE after MEDIA_ERROR_DECODE and blacklist the segment that caused the error

* Fix unit test

* Account for SegmentBase content when blacklisting segments

* Add missing information about errorSettings to index.d.ts and Settings.js

* Fix availabilityTimeOffset for live MSS (Dash-Industry-Forum#3746)

* Fix/cmcd nor (Dash-Industry-Forum#3747)

* Add unit tests for Utils.js

* Use relative url for CMCD nor attribute

* URI encode the CMCD nor url

* Only check if the stream is completed if no request could be generated. Otherwise we stop buffering to early after a transition from dynamic to static manifests (Dash-Industry-Forum#3748)

* Allow for registering a custom function to select the intial track (Dash-Industry-Forum#3672)

* Move ESLint check to prod config

* Added function that allows using a custom initial track selection mode, added unit test for said function.

* Removed leftover console.log

* Add setCustomInitialTrackSelectionFunction to MediaPlayer.js

* Add sample for custom initial track selection

* Fix JSDoc

Co-authored-by: dsilhavy <daniel.silhavy@fokus.fraunhofer.de>

* [MSS] fix issue when selecting new audio track and new text track simultaneously on live streams (Dash-Industry-Forum#3749)

* Add track selection mode based on selectionPriority attribute (Dash-Industry-Forum#3751)

* Add track selection mode based on selectionPriority attribute in the manifest. Make this the default mode and fallback to TRACK_SELECTION_MODE_HIGHEST_BITRATE and TRACK_SELECTION_MODE_WIDEST_RANGE in case no selectionPriority is given.

* Fix wrong timing calculation for client/server clock drift. (Dash-Industry-Forum#3759)

* Fix wrong timing calculation for client/server clock drift.

* Remove clientServerTimeShift from _calcAvailabilityTimeFromPresentationTime and use it in getClientReferenceTime() instead before requesting a segment.

* fix, complete types definition file (Dash-Industry-Forum#3755)

* fix, complete types definition file

* Fix javascript errors on reset (Dash-Industry-Forum#3757)

* Fix live playback on WebOS (Dash-Industry-Forum#3750) (Dash-Industry-Forum#3754)

* Fix live playback on WebOS (Dash-Industry-Forum#3750)

Reverts some of the changes made in:
a66913f (Timeline and multiperiod optimizations (Dash-Industry-Forum#3413), 2021-04-23)

* [Settings] Add enableSeekDecorrelationFix

Allows disabling the workaround for live playback start (Dash-Industry-Forum#3750)

* Stream: do not reset() on protection error (Dash-Industry-Forum#3756)

* Feature enable low latency (Dash-Industry-Forum#3684)

Enable low latency streaming automatically if availabilityTimeComplete is set to false

* Change JSDoc description, remove outdated setAutoSwitchQuality

* Fix outer period seek to 0 (Dash-Industry-Forum#3767)

* Fix: Dash-Industry-Forum#3769 - Handle all 2XX status codes on license request  (Dash-Industry-Forum#3770)

* Update onload response status

* Fix failing license response on 2xx HTTP codes

Co-authored-by: Pavel Zablockij <pavel.zablockij@teliacompany.com>

* Disable enableSeekDecorrelationFix by default

* Fix a bug in the GapController.js when unregistering events

* Fix/media fragment needed (Dash-Industry-Forum#3772)

* WiP: Fix seek into gaps

* Add settings parameter to enable/disable seekGapFix

* WiP: Unit tests

* WiP: Optimizations for getValidSeekTimeCloseToTargetTime using unit tests

* Optimizations for getValidSeekTimeCloseToTargetTime using unit tests

* Deactivate seek gap fix by default

* Increase gap seek threshold

* Disable seekGapFix

* Test suite live delay (Dash-Industry-Forum#3714)

* test suite live delay

* live delay approx assertion

* percentage assertion and disable abr start with lowest bitrate

* Activate gap jumping when seeking close to the end of a period. (Dash-Industry-Forum#3775)

* Activate gap jumping when seeking close to the end of a period.

* Add missing parameter to JSDoc

* Adjust logic to check for _getNextStreams

* Fix wrong link to docs in package.json

* Add version 4.1.0 dist files

* Avoid creating one HTTPLoader instance per request (Dash-Industry-Forum#3779)

* Increase version number to 4.1.1

* [MSS] Do not update manifest if already updating at tracks switching for live streams (Dash-Industry-Forum#3780)

* Do not update manifest if already updating (for example when MSS audio and text tracks are changed simultaneoulsy)

* [MSS] Do not update manifest if already updating at tracks switching for live streams

* Fix exception in GapController.js when enableSeekFix is set to true

* Check for stableBufferTime larger than 0 in MediaPlayerModel.js

* Fix issue on text track selection (Dash-Industry-Forum#3783)

* Fix scheduleWhilePaused not working  (Dash-Industry-Forum#3785)

* Fix scheduleWhilePaused not working

* Update README.md

* Fix seek with null value in PlaybackController.js (Dash-Industry-Forum#3789)

* TextTracks: check video size only for html rendering on 'loadedemetadata' event (Dash-Industry-Forum#3791)

* Avoid uncaught exception on SourceBuffer.abort() in buffer already removed from the parent MediaSource (Dash-Industry-Forum#3799)

* Refactor/protection (Dash-Industry-Forum#3793)

* WiP: Refactor content protection

* Refactor some functions in StreamController.js

* Refactored the DRM workflow

* Fix a bug when registering events in the ProtectionController.js

* Rename variables in ProtectionController.js

* Do not call requestKeySystemAccess when creating a new session with an existing key system

* Clear all mediaInfos in ProtectionController when MPD is updated

* Import FactoryMaker in ProtectionController.js

* Fix unit tests for Protection

* Adjust index.d.ts

* Add missing JSDoc for ProtectionController.js

* Add support for dashif:laurl

* Add laurl example MPD

* Add warning to DRM samples if not using https protocol

* Check for isNaN when setting the seek target in the StreamProcessor.js

* Enable/Disable UTC sync via settings flag (Dash-Industry-Forum#3802)

* Add example for fastswitch

* DVR Window Refactoring (Dash-Industry-Forum#3809)

* Do not update currenttime when manifest update is in progress to avoid using a wrong DVR window

* Remove unnecessary DVR window update

* Refactor protection and fix key rotation (Dash-Industry-Forum#3805)

* Refactor protection module in order to fix key rotation to be based on key id updates (and not init data updates)

* Remove unuseful ProtectionController::_getSessionType()

* fix unit tests

* update index.d.ts

* Fix protData in _getKeySystemConfiguration()

* Do not check for key id and initData in _initiateWithExistingKeySystem(), already checked in _initiateWithExistingKeySystem()

* Update SessionToken.getSessionId()

* Show warning in case location.protocol is http when accessing the reference client

* Rename event STREAM_SWITCH_STARTED into PERDIO_SWITCH_STARTED

* Add dynamic attribute for calls to getAverageThrougput (Dash-Industry-Forum#3814)

* Add dynamic attribute for calls to throughputHistory.getAverageThroughput

* Refactor variable name

* Check for video element readystate in PlaybackController.updateCurrentTime (Dash-Industry-Forum#3815)

* Do not filter ks if no protData is given, otherwise player fails silently (Dash-Industry-Forum#3816)

* Increase version number to 4.2.0

* Fix scheduleWhilePaused in demo page

* Remove unavailable stream

* Add resolution to monitoring example

* Add dist files for 4.2.0

* Fix error in JSDoc in ProtectionController.js

* Increase version number to 4.2.1

* Fix/3808 (Dash-Industry-Forum#3823)

* Adjust time check in TimelineSegmentsGetter.js. We also need to consider if the requiredMediaTime is larger than the start time of the segment.

* Account for seek to 0 in _noMediaRequestGenerated

* Fix race condition when using "autoplay" in the reference UI (Dash-Industry-Forum#3825)

* Update sources.json (Dash-Industry-Forum#3827)

Added set of new test vectors (12 in total)
4x non-encrypted
4x cbcs encrypted
4x cenc encrypted

* Wait for video element ready state to change to HAVE_METADATA before triggering STREAM_INITIALIZED (Dash-Industry-Forum#3824)

* Update Unified Streaming URL

* Add demo page to load stream via query parameters

* Fix typo

* fix SessionToken typings

* Adding AACH in the list of supported codecs for mssparser (Dash-Industry-Forum#3830)

* adding AACH in the list of supported codecs for mss

* adding AACP in list of supported codecs for mss

* feat: Preserve cdata on manifest parsing and expose on dash event messageData (Dash-Industry-Forum#3811)

* Enable gap seek fix by default (Dash-Industry-Forum#3832)

* Add an example how to use parsed MPD objects instead or urls

* Fix typo

* Fix typo

* Apply a minor offset when using MPD anchors with #t=0 for dynamic streams when calcFromSegmentTimeline is enabled (Dash-Industry-Forum#3833)

* Add sample for MPD anchors

* Fix title in sample page

* Add dist files for release 4.2.1

* Throw new error in case of invalid settings (Dash-Industry-Forum#3843)

* Increae version number to 4.3.0

* Fix live seeking (Dash-Industry-Forum#3837)

* Fix: Load the last remaining segment when the user seeks to end (Dash-Industry-Forum#3847)

* Fix: Load the last remaining segment when the user seeks to the very end of the timeline: currentTime = duration

* Return NaN in getContinuousBufferTimeForTargetTime if adjustedTime is equal to targetTime

* Fix events without presentation time and id (Dash-Industry-Forum#3851)

* Fix a memory leak in the EventController.js. For events without id and presentationTime the list of outdated events was not cleaned up

* Default to id null for inline events

* Close comment header in ControlBar.js

* chore: bump version

* Fix SourceBufferSink reset process (Dash-Industry-Forum#3854)

* Exclude text StreamProcessor when checking buffer level for initial playback (Dash-Industry-Forum#3857)

* Change regex that checks for valid license server url in reference UI

* Set default fragment request timeout to 10 seconds

* Improve special character escaping in CMCD string values (Dash-Industry-Forum#3866)

* Add types definition for custom initial track selection function (Dash-Industry-Forum#3867)

* Add types definition for set/resetCustomInitialTrackSelectionFunction

* Do not reset custom initial track selection callback when new stream is loaded

* Add support for multiple system strings for a single key system (Dash-Industry-Forum#3859)

* Add support for multiple system strings for a single key system

* Add default system string priority

* Change description text of system-string-priority.html

* Fix wrong link in Playready DRM demo

* Update Clearkey sample

* Update log output for selected system string

* Add DRM stream to list of DRM smoke vectors

* Fix issue in GapContoller when reset playback (Dash-Industry-Forum#3868)

* BufferController: fix issue in adjustSeekTarget after a track switch (Dash-Industry-Forum#3874)

* Fix VideoModel currentTime and seeking (Dash-Industry-Forum#3872)

* VideoModel: fix returned current time and seeking state according to current seeking value

* VideoModel: fix returned current time and seeking state according to current seeking value

* VideoModel: fix returned current time and seeking state according to current seeking value

* Adjust error message in GapController.js

* Remove getNormalizedTime (Dash-Industry-Forum#3876)

- The original issue Dash-Industry-Forum#2796 no longer occurs
- The function leads to incorrect `currentLiveLatency` calculation with
  streams where AST is small but non zero.

* Fix/positive ept delta dynamic manifest (Dash-Industry-Forum#3878)

* Account for gaps in SegmentTimeline and adjust buffering target for live streams

* Adjust the error message in the unit tests

* Add unit tests for getValidSeekTimeAheadOfTargetTime

* Account for buffering times larger than period boundaries when handling _noMediaRequestGenerated

* Do a seek if there is a gap at 0

* Add Akamai Controlbar to npm package

* divide browserstack sessions and run tests parallel (Dash-Industry-Forum#3880)

* Fix calculation of thumbnail timestamp for multiple periods (Dash-Industry-Forum#3881)

* Remove isValidUrl check from ReferenceUI as it caused license servers to not be added

* Feature/settings url (Dash-Industry-Forum#3865)

* Building min files for master release

* adding dist files.

* Pushing dist files to master

* "here" links are evil

Changed the link text for the v2.0 migration documentation

* removed extra space. Added period.

* pushing dist files to master

* Adding dist files to release.

* adding dist files to master

* dist files for release

* dist files for master release

* dist files

* addind dist files for release

* dist files for v2.5.0 release

* adding dist files to master for release v2.6.0

* Add dist files to master for release v2.6.1

* Add v2.6.2 dist files

* Update version to 2.6.2

* Add v2.6.3 dist files

* Add v2.6.4 dist files

* Add v2.6.5 dist files

* Update dist files to v2.6.6

* Add v2.6.7 dist files

* Add v2.6.8 dist files

* Add v2.7.0 dist files

* Add v2.8.0 dist files

* Add v2.9.0 dist files

* Add v2.9.1 dist files

* Add v2.9.2 dist files

* Add v2.9.3 dist files

* Add v3.0.0 dist files

* Add v3.0.1 dist files

* Move ESLint check to prod config

* [MSS] fix text track switch for live streams (Dash-Industry-Forum#3698)

* Initial Commit settings URL

* Added view-updating for textboxes and radio buttons

* Fixed utcsync url when copying, added query length check

* Added dist folder to gitignore.

* Removed dist folder

* Adjusted gitignore

* Fixed Error caused by double & in URL, added PopUp noification when URL is copied.

* Add callout box for new feature

* Add missing DRM today parameter to export

* Fixed Errors with handling MPD- and Licenseserver URLS containing their own Query-string

* Fixed Errors with handling MPD- and Licenseserver URLS containing their own Query-string

* Fixed Errors with handling MPD- and Licenseserver URLS containing their own Query-string

* Remove isValidUrl

* Adjust export settings text

Co-authored-by: Dan Sparacio <AkamaiDASH@users.noreply.github.com>
Co-authored-by: Dan Sparacio <dsparaci@akamai.com>
Co-authored-by: Anders <smedegaard@users.noreply.github.com>
Co-authored-by: J. Oliva <jesus@epiclabs.io>
Co-authored-by: dsilhavy <daniel.silhavy@fokus.fraunhofer.de>
Co-authored-by: Bertrand Berthelot <bertrand.berthelot@orange.com>

* Corrected ServiceDescription handling (Dash-Industry-Forum#3879)

- minDrift should not be set from SD as there is no direct mapping to any SD parameters
- maxDrift is set if present and larger than SD target

* Only show console error instead of error when invalid setting is provided

* Remove hardcoded value in reference client

* Remove console.log

* Bugfix/settings url (Dash-Industry-Forum#3885)

* Fixed DRM priorities not being correctly reflected in View

* Fixed multiple clearkeys not updating in view, Fixed 'no settings parameter d' error when having only an mpd in the query-string

* Fixed Clearkey setting overwriting Widevine, removed console.log

Co-authored-by: ShikiSeiren <yamitepes@gmail.com>

* Remove non available sample streams

* Remove non available sample streams

* Revert default key system string order for Playready as we saw multiple invalid state errors with "com.microsoft.playready.recommendation"

* Version 4.3.0 dist files

* Increase version number to 4.3.1

* JSON stringify the license request payload to Clearkey servers (Dash-Industry-Forum#3894)

* Update SessionToken typings (add getUsable()) (Dash-Industry-Forum#3892)

* feat: Update manifest source url without re-initialising player (Dash-Industry-Forum#3900)

* DVB Metrics Reporting 'withCredentials' (Dash-Industry-Forum#3898)

* Add way to set withCredentials for DVB Metrics Reporting

* Use constant for request type

* Fix BOLA rule on track switch (Dash-Industry-Forum#3884)

* BOLA rule: reset placeholderbuffer on empty buffer only for concerned media type

* BOLA rule: if audio buffer runs empty (due to track switch for example) then reset placeholder buffer only for audio (to avoid decrease video BOLA quality)

* Remove non-standard `t` metric from HttpList reports (Dash-Industry-Forum#3883)

* Remove erroneous `t` metric from HttpList reports

- The `t` metric was renamed to `_t` to indicate it should not be
  included in the reported HttpList metrics as it is not part of the
  MPEG-DASH specified set of reported metrics

* Renamed t -> _t as part of httpList reporting fix

* feat: Trigger event when AdaptationSet is removed due to all representations being incompatible (Dash-Industry-Forum#3910)

* fix: prevent duplicate captions

* 4.3.0-doris.1

* Feature/service description (Dash-Industry-Forum#3831)

* Wip: ServiceDescription cleanup

* Wip: Move catchup to CatchupController.js

* Move catchup logic to separate CatchupController.js

* Add ServiceDescriptionController and corresponding unit tests

* Add unit test to streaming.controllers.ServiceDescriptionController.js

* Only apply ServiceDescription settings if no value specified via Settings.js

* Fix unit tests

* Fix linting error in ServiceDescriptionController.js

* Fix typo in JSDoc

* Remove minDrift and latencyThreshold parameter for low latency streaming

* Fix unit tests

* WiP: Remove lowLatencyEnabled from Settings.js

* Calculate the live delay only in PlaybackController.js and remove from MediaPlayerModel.js. Once settings are updated trigger recalculation in PlaybackController.js

* Use live delay from PlaybackController.js in MediaPlayerModel.js

* Wip turn catchup on/off automatically

* Deactivate catchup when user seeks

* Fix unit tests

* Fix linting errors

* Remove outdated low latency samples

* Add a keymap to dispatch specific events once a setting is updated

* Remove lowLatencyEnabled and lowLatencyEnabledByManifest

* Cap the live delay to the DVR window size

* Add playbackrate to reference UI

* Move custom ABR rules to MediaPlayer.js similar to custom capabilities

* Move all custom filters to CustomParametersModel.js. Prepare MediaPlayerModel.js to be used as a logical proxy between Settings.js and other classes

* Fix linting issues

* Use MediaPlayerModel.js as a proxy to Settings.js for everything that requires additional logic. Do not overwrite settings coming from ServiceDescription elements.

* Remove unused function

* Do not update catchupModeEnabled setting in PlaybackController.js.

* Increase version number

* Change log level

* Remove unused attribute from low latency demo page

* Remove falsely added controlbar

* Remove reference to lowLatencyEnabled in InsufficientBufferRule.js

* Add missing customParametersModel for ProtectionController

* Fix linting error

* Fix unit tests

* CMCD: whitelist HTTP headers (Dash-Industry-Forum#3893)

* add whitelist for cmcd http headers

* add reference player compatibility

* add whitelist for cmcd http headers

* add reference player compatibility

* fix issue with initial load on ref player

* fix typo

* unit tests for enabled keys

* Update package-lock.json

* Add CMCD whitelist for query parameters

* Adjusts Settings.js to merge values that are provided as an array

* Add enabledKeys to CMCD demo

* PlaybackController: fix concurrent internal seeks (Dash-Industry-Forum#3903)

* Adjust liveDelay directly in PlaybackController.js if fetch API with streamreader is not supported

* Update scheduled CircleCI cron job: Trigger on Sunday and Wednesday

* feat: downgradePlayReadyPSSH

* fix: accessing byteLength of undefined

* 4.3.0

* 4.3.1

* chore: update gitignore

* feat: supportedCodecs

* fix: support array type config options

* fix: compare codecs lowercase without spaces

* chore: added example codec

* 4.3.2

* Fix error in Settings.js JSDoc

* feat: replaceCodecs

* fix: replaceCodecs after parsing

* 4.3.3

* chore: remove named touples

* ProducerReferenceTime (Dash-Industry-Forum#3895)

* Calculate and apply time offsets from ProducerReferenceTime when setting liveDelay from ServiceDescription

* Calculate and apply time offsets from ProducerReferenceTime when setting liveDelay from ServiceDescription

* Clearer variables and function names

* Add collection of PRFTs from Representations

* Calculate and apply time offsets from ProducerReferenceTime when setting liveDelay from ServiceDescription

* Clearer variables and function names

* Add collection of PRFTs from Representations

* Check for PRFT over all periods and factor in presentationTimeOffset already being divided by timescale

* Corrections and additional test

* Apply offset to all latency values

* Calculate and apply time offsets from ProducerReferenceTime when setting liveDelay from ServiceDescription

* Clearer variables and function names

* Add collection of PRFTs from Representations

* Check for PRFT over all periods and factor in presentationTimeOffset already being divided by timescale

* Corrections and additional test

* Integrate ProducerReferenceTime offset calculations with ServiceDescriptionController

* Revert tests changed in merge

* Fix StreamController formatting

* Feature/lint enforce indent (Dash-Industry-Forum#3921)

* Enforce specific indent in linting config

* Fix linting errors

* Fix linting errors

* Fix linting errors

* Fix regression from PR Dash-Industry-Forum#3831 in MssParser (Dash-Industry-Forum#3925)

* [MSS] Fix start FragmentInfo requests on seeking event (Dash-Industry-Forum#3924)

* [MSS] Fix start FragmentInfo requests on seeking event

* [MSS] Fix start FragmentInfo requests on seeking event

* fix: Prevent exception when PlayReady CDM returns UTF-8 unwrapped message (Dash-Industry-Forum#3926)

* Adjust linting config for quotes and fix corresponding errors

* Change precedence of ServiceDescription elements (Dash-Industry-Forum#3923)

* Change precedence of ServiceDescription elements

* Correct case for checking ServiceDescription applies to all clients

* Add additional unit test for ServiceDescriptionController

* chore: Add detectPlayreadyMessageFormat to settings type (Dash-Industry-Forum#3927)

* fix: playback stalling for no reason (Dash-Industry-Forum#3888)

* Feature/reduce settings url length (Dash-Industry-Forum#3918)

* Initial commit; Added functionality to copyQueryUrl that reduces the exported string to 'externalSettings' + actually changed settings

* Removed hardcoded defaultSettings.js, replaced with dynamic method

* Changed externalSettings to also only reflect changed settings; Switched from using 'debug' as the delimiter between external and internal settigns to '+' as debug is no longer guaranteed in the string

* Fixed settings who are NaN by default not being filtered out of the URL

* Only copy array values in "copy settings url" functionality if an entry has changed

* Removed NaN check

* Added code to prevent cmcd array being part of the url if default was not changed

* Fixed error in function order, shortened array handling line

* Adjust description text for export settings

* Add missing fields to index.d.ts and JSDoc in Settings.js

* fix: replace strings before support check

* 4.3.4

* Use getValidTimeAheadOfTargetTime for static manifests when no valid seek target was found. Otherwise we are stuck in a loop if this is the last segment and there is a gap at the end of the period.

* Fixed text-role not appearing in url, fixed drm-changes not being ref… (Dash-Industry-Forum#3930)

* Fixed text-role not appearing in url, fixed drm-changes not being reflected in UI

* Fixed last letter of the MPD being cut off

* Fixed + being added to priority of last active drm

* Remove console logs

* Add example for keeping DRM MediaKeySessions in DRM section (Dash-Industry-Forum#3934)

* Fix regression in key system selection based on priority (Dash-Industry-Forum#3935)

* ProtectionController: abort license request on stop/reset (Dash-Industry-Forum#3937)

* Fix deleting all cues from text tracks (Dash-Industry-Forum#3938)

* Fix deleting all cues from text tracks

* Fix deleting all cues from period

* Fix textual description on ref client landing page

* Add dist files for version 4.4.0

* Increase version number to 4.4.1

* Check for keyPairs in clearkeys object before updating the key session (Dash-Industry-Forum#3939)

* Fix/clearkey from ref UI: Check for initData in protData before overwriting  (Dash-Industry-Forum#3942)

* Check for keyPairs in clearkeys object before updating the key session

* Check for length of clearkeys in protData before overwriting init data

* Fix SegmentTimeline's  segment getter from requested time (Dash-Industry-Forum#3928)

* Fix SegmentTimeline's  segment getter from request time

* TimelineSegmentsGetter: fix floating number precision error when applying timescale

* TimelineConverter: fix DVR range calculation from timeline

* Fix wrong value in ReferenceUI for abrBOLA

* Fix/abandon request (Dash-Industry-Forum#3944)

* Remove abort request from AbrController as this is handled in the StreamProcessor. Triggering an abort here will lead to inconsistencies in the StreamProcessor and immediate start of schedule controller

* Enable abandonRequestRule per default and increase default fragment download timeout

* Add some more comments to the StreamProcessor.js

* Use lastBitrateCachingInfo.enabled and lastMediaSettingsCachingInfo.e… (Dash-Industry-Forum#3953)

* Use lastBitrateCachingInfo.enabled and lastMediaSettingsCachingInfo.enabled

* Fix unit tests

* Fix text track enabling for MSS live streams (Dash-Industry-Forum#3966)

* JSDoc cleanup (Dash-Industry-Forum#3968)

* Adjust layout of JSDoc output

* Dispatch volumechange from the native video element via dedicated MediaPlayerEvent (Dash-Industry-Forum#3969)

* Fix _checkPortalSize and initialRatio caluculation for unsorted Representations in an AS (Dash-Industry-Forum#3970)

* fix: seeking live streams when missing mediaSource.setLiveSeekableRange (#26)

* fix: set media source duration when setLiveSeekableRange is not available

* feat: added config.streaming.buffer.enableLiveSeekableRangeFix

* fix: set enableSetLiveSeekableRangeFix to true by default

* fix: remove debug code

* refactor: guards

* chore: update setting name

* chore: remove debug code

* 4.3.5

* Fix wrong description of PLAYBACK_LOADED_DATA event (Dash-Industry-Forum#3978)

* Fix a bug that lead to undefined customParametersModel after calling Mediaplayer.reset() (Dash-Industry-Forum#3979)

* Do not trigger inline and inband events multiple times after a manifesh refresh (Dash-Industry-Forum#3980)

* 4.4.1

* chore: eslint

* Fix for a rounding error not allowing BUFFERING_COMPLETED to get fired (Dash-Industry-Forum#3985)

* Fix for a rounding error not allowing BUFFERING_COMPLETED to get fired

* Try to fix periodBuffered rounding error using a threshold instead of rounding

* Undo commented out code

* Account for events defined in different periods in the EventControlle… (Dash-Industry-Forum#3984)

* Account for events defined in different periods in the EventController.js

* Add missing period information for inband events

* Fix linting errors

* Fix a bug when adding events

* Remove outdated objects from list of events as part of the interval function

* Extends the License Request Complete event to include the original server response when DRM errors are reported (Dash-Industry-Forum#3963)

* Add example for multi audio tracks with initial track selection

* Overwrite manifest mediaPresentationDuration if duration mismatch (Dash-Industry-Forum#3971)

* Overwrite manifest mediaPresentationDuration attribute with the sum of all period durations if there is a mismatch between the two

* Created config option to disable automatically overwriting mediaPresentationDuration when there is a mismatch between it and the sum of all period durations in a multi-period manifest

* Changed type from number to boolean for settings flag

* Corrected settings type in typings file and added setting to example jsdoc

* Add check for isNaN in enableManifestDurationMismatchFix

* Add support for specifying the start time of the stream as part of th… (Dash-Industry-Forum#3988)

* Add support for specifying the start time of the stream as part of the initialize or the attachSource call

* Support for posix notation in attachSource and initialize call to define start time

* Remove non required semicolon

* Add missing JSDoc

* Fix wrong description in JSDoc

* Fix 'd' trace httpList metric reporting (Dash-Industry-Forum#3986)

- Ensure 'd' (Measurement period duration) trace httpList metric reflects that used by ABR
- Limit use of throughput metric to FetchLoader
- Remove throughput metric from trace object
- Simplify ThroughputHistory rules

* Divide duration of inband events by timescale (Dash-Industry-Forum#3991)

* Parse to float instead of int when calculating start time

* Add missing vectors with "//" in url to functional tests (Dash-Industry-Forum#3997)

* Add missing vectors with "//" in url to functional tests

* Missing .url

* Fix multitrack captions sample: lang values in manifest have changed

* Run functional tests by groupname (Dash-Industry-Forum#3998)

* Fix multi audio drm sample

* If play is failing I suspect some attributes such as isDynamic to be wrong making wrong assumptions in the functional tests. Query dynamic state directly via player API.

* Add dist files for release 4.4.1

* Increase version number to 4.5.0

* Pass url to RequestModifier.modifyRequestHeader (Dash-Industry-Forum#3995) (Dash-Industry-Forum#3996)

* Add hashtag mechanism to sample menu selection (Dash-Industry-Forum#4002)

* Implement new catchup seeking/pausing logic as discussed during F2F (Dash-Industry-Forum#4003)

* Implement new catchup seeking logic as discussed during F2F

* Refactoring of some of the new functions

* Fix linting errors

* Use getOriginalLiveDelay in StreamController.js

* Adjust targetLiveDelay when user triggers play

* Fix attribute in index.d.ts

* Adjust LL testplayer sample

* Fix wrong link to controlbar in Low Latency testplayer

* Add popup to low latency testplayer and fix catchup mechanism "enabled" checkbox

* Remove console.log from sample index page

* Add missing library to sample section

* Fix stalling when using buffer.fastSwitchEnabled setting (Dash-Industry-Forum#4004)

According to the docs in Settings, the value used by StreamProcessor was wrong.
The problem occurred on an environment with high latency and low bandwidth, where segments' length was 3s, which is significantly longer than previously hardcoded 1.5s.

* Fix wrong call to _abortBeforeAppend (Dash-Industry-Forum#4019)

* Add ua-parser-js to enable reliable browser name and version parsing (Dash-Industry-Forum#4001)

* Lower minPlaybackRateChange for non Safari browsers depending on the maximum catchup rate. Otherwise the target live delay is not reached for low catchup rates. (Dash-Industry-Forum#4020)

* Fix/initialize drm from manifest (Dash-Industry-Forum#4023)

* Adjust flow in ProtectionController.js. Account for different robustness levels specified by the application when calling requestMediaKeySystemAccess

* Add missing field in index.d.ts

* Fix wrong boolean value in _selectKeySystemOrUpdateKeySessions when being called from pssh

* Remove check in getValidTimeAheadOfTargetTime that caused stall in st… (Dash-Industry-Forum#4025)

* Remove check in getValidTimeAheadOfTargetTime that caused stall in stream with gaps in previous period and upcoming period

* Replace "+" and "/" with "-" and "_" when generating B64 representation of KID to be compliant to EME spec (Dash-Industry-Forum#4026)

* Add an example how to define robustness levels for DRM playback (Dash-Industry-Forum#4028)

* Feature/content steering (Dash-Industry-Forum#4031)

* Move ServiceDescriptionController.js to dash controller folder

* WiP: Parse content steering information

* Add initial request to content steering server

* Load steering data according to ttl and queryBeforeStart

* Fix unit tests

* Fix linting errors

* First working steering implementation

* Fix JSDoc

* Move content steering selection to dedicated class ContentSteeringSelector.js

* Fix linting error

* Add settings flag to enable/disable content steering

* Add support for RELOAD-URI specified absolute and relative

* Add API endpoint to trigger steering request

* Content steering demo page for local steering server

* Minor changes to the steering demo page

* Add support for proxy server url

* Add unit tests for Content Steering in DASHManifestModel

* Add flag to enable/disable content steering to reference UI

* Revert change to getLocation

* Revert change to getPatchLocation

* Remove unnecessary parameter in call to contentSteeringController.loadSteeringData()

* Formatting changes

* Stop steering requests when playback has ended

* Allow requests to be modified in an async manner (Dash-Industry-Forum#4024)

* Allow requests to be modified in an async manner

* Update unit test to account for async delay before checking results

* Update unit test to account for async delay before checking results

* Update modifyRequest to act more like modifyRequestUrl and modifyRequestHeader

* Refactor duplicate code to a utility function

* Modify util function to bail early if no modifier is provided

* Ensure modifier is applied before internal fetch headers are constructed

* Only run request modification if the function was provided

* Remove default implementation of modifyRequest so that it does not introduce an async step

* Update extend sample page to demonstrate the use of the modifyRequest function

* Revert loader tests

* Revert test

* Remove unused test utility function

* Feature/deployment adjustments (Dash-Industry-Forum#4041)

Workflow to deploy nightly to Akamai CDN

* Use hash to compare files when pushing to Akamai CDN

* Add content steering to sample view

* Stschr/lang matcher dash parser (Dash-Industry-Forum#4036)

* Implemented a 'matcher' to sanitize all @lang attributes parsed from manifests into a bcp-47 complinat format.
Added unit tests to check correct operation of 3-letter code to 2-letter conversion for both AdaptationSet@lang and Label@lang.

* make language matching more robust (Dash-Industry-Forum#4015)

* make language matching more robust
* adding BCP-47 module
* use BCP-47 extended filter in settings matcher

* remove commented code

* downgrade version of bcp-47 modules to v1 as they are compatibel with CommonJS (not ESmodule only); add differentiation between string and RegExp in settings.lang

* enhancing language selection tests, making them more sensitive, adding case with 3-letter code, using RegExp object instead of string with RegExp

* refine documentation of possible data types with langValue in setInitialMediaSettingsFor API

* WPE fix: Avoid pruning buffered ranges already enqueued for playback (Dash-Industry-Forum#4039)

In WPE WebKit, the buffered range of the currentTime has high chances to
have been internally enqueued for playback (an action that can't be
undone, there's no way to unenqueue other than flushing the whole playback
pipeline). If that range is pruned, an internal flush is triggered, but
in order to keep playing from the currentTime onwards, the needed samples
must be enqueued again at least since the previous sync sample. This
can cause a lot of stress to the video decoder and generate stuttering.

This patch solves the problem by avoiding pruning (deleting) ranges
belonging to the same buffered range where the currentTime (or seek
target) is.

This behaviour is protected by the streaming.buffer.avoidCurrentTimeRangePruning
setting, which is disabled by default and only triggers the new behaviour
when enabled on purpose by the webpage embedding dash.js.

* Add missing parameter avoidCurrentTimeRangePruning to index.d.ts

* Fix wrong matching of lang attribute for embedded texttracks (Dash-Industry-Forum#4047)

* Check if track.lang is not an empty string otherwise extendedFilter causes an exception

* Improve matchSettings function in MediaController.js to account for empty strings

* Add missing streamId to DroppedFramesHistory.js (Dash-Industry-Forum#4048)

* Only consider buffer replacements in the GapController.js for audio and video (Dash-Industry-Forum#4051)

* Fix a bug in the StreamController.js that caused call to play() multiple times when autoplay is not possible

* Add dist files for version 4.5.0

* fix: customParametersModel undefined after reset called (#30)

* fix: customParametersModel undefined after reset called

* 4.4.2

* 4.5.1

Co-authored-by: dsilhavy <daniel.silhavy@fokus.fraunhofer.de>
Co-authored-by: Bertrand Berthelot <bertrand.berthelot@orange.com>
Co-authored-by: ShikiSeiren <37026695+ShikiSeiren@users.noreply.github.com>
Co-authored-by: FuriousBoar <lukasz.kinasiewicz@schange.com>
Co-authored-by: Pavelas <epavelas@gmail.com>
Co-authored-by: Pavel Zablockij <pavel.zablockij@teliacompany.com>
Co-authored-by: Vinay Rosenberg <62697976+vrosenberg@users.noreply.github.com>
Co-authored-by: Chanh Tran <minhchanhbkit@gmail.com>
Co-authored-by: mesikapp <mesikapp@axinom.com>
Co-authored-by: Sandeep Kumar Vemula <vsandeep414@gmail.com>
Co-authored-by: vodlogic <matt@vodlogic.com>
Co-authored-by: Casey Occhialini <1508707+littlespex@users.noreply.github.com>
Co-authored-by: Piers O'Hanlon <42040737+piersoh@users.noreply.github.com>
Co-authored-by: Dan Sparacio <AkamaiDASH@users.noreply.github.com>
Co-authored-by: Dan Sparacio <dsparaci@akamai.com>
Co-authored-by: Anders <smedegaard@users.noreply.github.com>
Co-authored-by: J. Oliva <jesus@epiclabs.io>
Co-authored-by: ShikiSeiren <yamitepes@gmail.com>
Co-authored-by: Matt Juggins <32675386+mattjuggins@users.noreply.github.com>
Co-authored-by: Evans Owino <9787512+eowino@users.noreply.github.com>
Co-authored-by: Benjamin Wallberg <me@bwallberg.com>
Co-authored-by: jensenn <neilgithub@jensenet.com>
Co-authored-by: Helicos <wilhelm.faber@online.de>
Co-authored-by: Alex <alex@walkeralex.com>
Co-authored-by: stschr <92983372+stschr@users.noreply.github.com>
Co-authored-by: Enrique Ocaña González <eocanha@igalia.com>
Co-authored-by: Hongfei Huang <83795629+hongfeih-es@users.noreply.github.com>
@littlespex littlespex deleted the issue/3758-aysnc-request-modifier branch May 11, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants