Commit Graph
364 Commits
Author SHA1 Message Date
Casey OcchialiniandGitHub 805e55535e Bugfix: use part details to construct CMCD data when available (#6395)
* fix: use part details to construct CMCD data when available
* test: add unit test for part fragment CMCD
Fixes: #6388
2024-05-03 09:52:48 -07:00
Henry McIntyreandGitHub d802d6013c Determine canSkip based on age of last playlist request (#6300) 2024-04-08 10:55:39 -07:00
Rob WalchandRob Walch 03ca1c7b3f Fix audio/subtitles stream controllers restarting on switch after stopped
Update stream controller access specifiers
2024-02-21 11:02:40 -08:00
Rob WalchandRob Walch 7e9447a35a Block audio append queue to keep AV appends in lock-step 2024-02-19 11:39:58 -08:00
Casey OcchialiniandGitHub 763c129aa3 feat: add support for CMCD nor (#6091)
* feat: add support for CMCD nor
* deps: update @svta/common-media-library to version 0.6.2
Resolves #6088
2024-01-29 09:05:16 -08:00
Rob WalchandRob Walch ac26032af2 User unique logger configurations across instances of Hls(js)
Resolves #2461
2024-01-25 12:04:54 -08:00
Rob WalchandGitHub 3a0856c495 Null inline class JavaScript Event callback properties on destroy (#6102) 2024-01-22 17:41:36 -08:00
Rob WalchandGitHub cd120944fc Fix regression where subtitle options with AUTOSELECT and FORCED are enabled at start (#6094)
* Do not enable subtitle options with AUTOSELECT=YES attribute
* Update and add initial selection tests for subtitle-controller
* Only pick forced subtitle option if it is the only one
Add default field to audio and subtitle selection options and forced field to subtitle selection option
* Address TextTrack change event overriding subtitle preference
Fix _TRACKS_UPDATED and _TRACK_SWITCH event order when preference is selected
* Do not auto select subtitle options with FORCED=YES attribute
2024-01-10 15:42:05 -08:00
Rob WalchandRob Walch 8ec72157a3 Use addEventListener for MediaKeySession events
#6034
2023-12-12 20:00:02 -08:00
Rob Walch a1b505106f Recover from media error after MediaSource ended following SourceBuffer update error event 2023-11-30 16:25:17 -08:00
Rob Walch d4d585b3f5 API enhancements for audio and subtitle selection
Resolves #5532
2023-11-26 10:35:41 -08:00
Casey OcchialiniandGitHub f943d31408 Refactor CMCD controller and tests to use the common media library utilities (#5903)
* refactor CMCD controller and test to use common media library
* update build script to transpile the @svta package
* add ability to specify cmcd keys
2023-11-16 14:39:55 -08:00
Rob WalchandGitHub a99be72ddb Use Content Steering Pathways to manage Redundant Streams (#5970)
* Use Content Steering Pathways to manage Redundant Streams and resolve their errors
* Ensure correct Pathway penalization on Playlist loading errors
* Do not reload Content Steering manifest while media is ended or detached
2023-11-15 09:21:58 -08:00
Rob WalchandGitHub 21213d55c9 Fix subtitle track selection when reusing media element with mismatched TextTracks (#5880)
* Use subtitle track name and language to find and match subtitle/captions TextTrack rather than subtitleTrack index
Resolves #4571

* Fix regression in dev where AUDIO_TRACKS_UPDATED is re-dispatched with zero tracks
Allow selection of audioTrack on AUDIO_TRACKS_UPDATED (overriding default selection - Resolves #5831)
Cleanup selection of subtitleTrack on SUBTITLE_TRACKS_UPDATED (overriding default selection)

* Fix TextTrack use with ASSOC-LANGUAGE
Match the initial default/forced/autoselect choice made when playing HLS in Safari
2023-10-10 11:27:55 -07:00
Rob WalchandGitHub ab34a42505 Handle option grouping for EXT-X-STREAM-INF with same URL and attributes (#5855)
Add VIDEO_RANGE and HDCP attriubute values to Redundant Stream grouping
Add channels and characteristics to MediaPlaylist
Resolves #5302
2023-10-04 11:02:09 -07:00
Rob WalchandGitHub a594323a8f Switch on smaller fmp4 segments that align with buffered segment boundaries (#5804)
Fixes #5743
2023-09-08 14:12:21 -07:00
301be58cc4 Add config flag for maximum front buffer frontBufferFlushThreshold (#5761)
Fixes #5479

Co-authored-by: Evan Burton <eburton2@apple.com>
2023-08-31 14:03:52 -07:00
Rob WalchandGitHub 2e40955d0d Use ManagedMediaSource when available with preferManagedMediaSource config option (#5542) 2023-08-24 16:37:51 -07:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>Tom Jenkinson
359197f20b chore(deps): update dependency prettier to v3 (#5646)
* chore(deps): update dependency prettier to v3

* run prettier

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tom Jenkinson <tom@tjenkinson.me>
2023-08-22 11:24:59 +01:00
Rob WalchandGitHub b536883327 Initial selection and level filtering based on preferred codecs and MediaCapabilities (#5704)
* Make initial variant selection based on preferred codec rather than the first variant in the multivariant playlist

* Fix `minAutoLevel` and `ttfb` usage in abandon rules check

* Fix filtering of invalid video-ranges

* Log reason for ignoring start candidates with a particular codec

* Add rendition helper and move SCORE logic into getStartCodecTier

* Add support for MediaCapabilities video configuration filtering
FIxes #5707

* Add support for MediaCapabilities audio configuration filtering
Related to #5704 and #4072

* Add __USE_MEDIA_CAPABILITIES__ build const to remove MediaCapabilities checks from light build

* MediaCapabilities: Assume a framerate of 30fps since decodingInfo will throw with Level default of 0.

* Select variant with alternate video codec on video append error

* Use complete media-parsed codec name when determining if changeType should be appended

* Add `firstAutoLevel` to API.md
2023-08-21 15:24:26 -07:00
Rob WalchandGitHub bc60dbfe12 Base initial bandwidth estimate on first level's bitrate (#5649)
Resolves #2754
2023-07-13 14:10:32 -07:00
Rob Walch 3673ce0471 Handle mixed sourcebuffer errors, up to appendErrorMaxRetry consecutive errors per buffer type 2023-07-03 17:06:24 -07:00
Rob WalchandGitHub 11b11deb34 Error and switch on SourceBuffer append requests for non-existing tracks (#5485)
* Error and switch on SourceBuffer append requests for non-existing tracks
(muxed "audiovideo" append over unmuxed "video" and "audio" SourceBuffer)
Related to #1510

* Handle queued appends for pending source buffers
2023-05-26 18:41:47 -07:00
Guillem CabreraandGitHub 966bd3d08b Fire STEERING_MANIFEST_LOADED event when loading a Content Steering Manifest (#5417)
* Fire STEERING_MANIFEST_LOADED event when loading a Content Steering Manifest

* Use steeringManifest instead of response inside STEERING_MANIFEST_LOADED content

* Fire STEERING_MANIFEST_LOADED between clonePathways and updatePathwayPriority
2023-05-26 13:35:04 -07:00
Rob WalchandGitHub 2105adef43 Always use MediaSource returned by utils module (#5448) 2023-05-03 10:10:00 -07:00
Rob WalchandGitHub f4629d3fc3 Fix Low-Latency part and fragment tracking (#5423)
* Fix Low-Latency part and fragment tracking regression introduced in #5102

* Fix issues with reuse of player instance when loading additional assets
Fixes #5425

* Reset SourceBuffers in `loadSource()` when the asset URL has changed, or buffer-controller setup has begun

* Remove old parts from the fragment tracker on frag buffered

* Remove old parts from the fragment tracker on frag buffered

* Reset eme-controller key format promise on manifest loading
2023-05-03 04:57:34 -07:00
Rob WalchandGitHub a9982f7db9 Only allow large gaps to be skipped if start gap or all fragments in range are partial (#5366)
* Only allow large gaps to be skipped if start gap or all fragments in range are partial
Fixes #5360

* Fix adaptation and fragment tracking after fragment errors (gap tags)
#2940
2023-04-06 09:23:15 -07:00
Rob WalchandGitHub 9cafa433b5 Do not clear subtitle cues or fragment tracking when updated subtitle tracks are identical (#5365)
Fixes #5361
2023-04-04 18:23:42 -07:00
Rob WalchandGitHub c5134d8a2a Relax TTFB timeout on manifest request (#5364)
* Relax TTFB timeout on manifest request
(Add support for LoadPolicy `maxTimeToFirstByteMs` of Infinity and similarly ignore value of 0)

* Add LoadPolicy API documentation
2023-04-04 11:00:34 -07:00
8e6efb1c12 Migrate to Rollup with new ESM target and improved Worker support (#5299)
* Convert build packager to rollup
* Add an es module target (#2910)
* UMD build worker injection (#5107)
* Add ES5 syntax check for UMD builds (#5301, #5288)
* Add common rollup config
* handle `self` not existing (happens in nodejs. The check that makes sure the dist file can be required in node and not throw was failing because of this.)
* Disable coverage in CI
* Add `config.workerPath` option and "hls.worker.js" build output (#5107)
* Include transmuxer-interface id ("main" and "audio") in Web Worker setup and error logs

Co-authored-by: Tom Jenkinson <tom@tjenkinson.me>
2023-03-27 11:03:39 -07:00
Rob WalchandGitHub 3e959c289f GAP Tag/Attribute Support with FRAG_GAP Error (#5257)
* Handle fragments and parts with a GAP tag/attribute
* Improve GAP fragment picking, post gap buffering, and level switching error resolution
* Cleanup FRAG_GAP error creation and inlcude current buffer length in forward gap buffer limit
* Fix gap jump over waiting for data stall when buffer length is larger than maxBufferHole but less than one second
* Warn when observing "seeked" event with empty buffer (Related to #5274)
* Handle forward buffering past GAP tags in alt audio Playlists
* Fix GAP tag handling with Redundant Streams
* Implement penalty box for Redundant Streams
2023-03-23 13:53:30 -07:00
David StreeterandRob Walch 37a2a4048e Updates tests for #5297
Fixes #5292
2023-03-17 10:32:41 -07:00
David StreeterandGitHub 4029b6db30 fix for #5292 - push to filterSubtitleTracks output if kind is captions (#5297)
* fix for #5292 - push to filterSubtitleTracks output if kind is captions

* adding "captions" to all subtitle-track-controller tests
2023-03-17 09:56:21 -07:00
Rob WalchandGitHub 8063580aa0 Error Handling controller and LoadPolicies (#5241)
* Implement ErrorController …
Add Error Handling Integration Tests
Handle missed probe transmux probe with with FRAG_PARSING_ERROR
Handle encrypted init segment and subtitle decryption failure with FRAG_DECRYPT_ERROR
Remove delay when retrying after timeout
Trigger FRAG_LOADING after request is made
ERROR event data type must include an error property
Add stats to network loader error callbacks to allow error handling to use request timing
Remove use of console.warn from mp4-tools
Add missing TypeScript type exports

* Remove console.assert statements
Resolves #5218
Closes #5221

* Remove unused frag buffered monitor

* Add Load Policies and deprecate frag/level/manifest timeout and retry config options

* Switch on FRAG_PARSING_ERROR or continue trying fragLoadPolicy.default.errorRetry.maxNumRetry (6) times
Fixes #5011

* Switch on FRAG_PARSING_ERROR or continue trying fragLoadPolicy.default.errorRetry.maxNumRetry (6) times 2/2
Fixes #5011

* Do not reload level after calling stopLoad() and startLoad()
Warn on currentFrag context reference change and use currentFrag to maintain correct stats ref
Fixes #5230

* Implement ErrorActions and Pathway Switching

* Fix part timeout handling
Cleanup frag stats handoff

* Update retry rules to require http status or timeout error (deprioritizes retry on parse errors)

* Retry audio and subtitle playlist loading after failure on level switch when no alternate is available
2023-02-27 11:31:16 -08:00
Rob WalchandGitHub 766ec37691 Content Steering (#5191)
* Load Steering Manifest

* Make UA check lazy for legacy unsupported MP3 in MP4 container check

* Add Redundant Streams tests

* Add FRAME-RATE to Redundant Stream group key and level sorting
Optimize MANIFEST_PARSED level filtering
Optimize Media Playlist check

* Do not group Variant levels with PATHWAY-ID into Fallback Stream URLs (unless building without Content Steering support)
Store and return seperate LevelAttributes per Fallback Stream URL
Align Level audio and text group ids with Fallback Stream URLs (Level._urlId)

* Content Steering Pathway grouping and selection
#5074

* Support removeLevel and improve capLevelController with level index changes

* Pathway Clone Variants

* Pathway Clone Rendition Groups

* Fix audio track alignment with timescales that differ and smooth switch when attributes do not change

* Always emit LEVEL_SWITCHING on Pathway change to ensure audio and subtitle tracks update as well

* Fix unregister listeners in fps and latency controller

* Unit test clean up

* Update README for Content Steering
2023-02-18 12:20:14 -08:00
Rob WalchandGitHub ab06d97971 Log error and detach if MediaSource 'sourceopen' is interrupted (#5206) 2023-02-07 15:00:39 -08:00
Rob WalchandGitHub 1956cb430e Support partial RENDITION-REPORT URI matches fallback (#5176)
* Support partial RENDITION-REPORT URI matches fallback
Fixes #5174

* Update find Rendition Report match comment
2023-01-20 18:30:33 -08:00
Rob WalchandGitHub 485fe15f08 Replace ESDocs generated api-docs with api-documenter markdown (#5163) 2023-01-20 08:57:20 -08:00
6f6fa2e9bf Implement EXT-X-DEFINE Variable Substitution (#5161)
* Implement EXT-X-DEFINE Variable Substitution
Add support EXT-X-START in Multi-Variant Playlist
Add Content-Steering Multi-Variant Playlist parsing (#5074)

* Return parse error on undefined Variable Reference
Only track/return first parse error
Fix typos

* Use same error handling as FRAG_PARSING_ERROR for LEVEL_PARSING_ERROR

* Minor improvements to esdocs generated docs

* Use logical assignment on playlistParsingError

Co-authored-by: Rob Walch <rob@jwplayer.com>
2023-01-19 16:52:12 -08:00
Rob WalchandGitHub 0f14a22ce7 Improve bandwidth estimation and adaptive switching (#4825)
* Improve bandwidth estimation and adaptive switching with smaller segments and higher TTFB
Fixes #3578 (special thanks to @Oleksandr0xB for submitting #4283)
Fixes #3563 and Closes #3595 (special thanks to @kanongil)

* Load rate and loaded delay calculation fixes

* Convert ttfbEstimate to seconds

* Include main variant init segments in TTFB sampling

* Use ttfb estimate in abandon rules down-switch timing
2023-01-18 10:54:55 -08:00
Rob WalchandGitHub 5265365569 Manage End of Stream state after flushing buffer (#5131)
* Manage End of Stream state after flushing buffer
Fixes #5000

* Check last fragment buffered with contiguous buffered TimeRange for EOS

* Check EOS before resetting ENDED to IDLE near end
#5000

* End stream-controller idle tick on EOS before it can set nextLoadLevel
(prevent ABR switch in ENDED state)

* Use fragment-tracker to determine if last playlist fragment is buffered
(Fixes removal of tracked fragments while loading)
#5000
2023-01-06 10:03:32 -08:00
Gilad NadavandGitHub 9f4b829133 readme: add kaltura player to players list (#5125)
* add kaltura player links

* update svg url

* lint fix

* lint fix

* fix lint

* remove space

* Update README.md
2023-01-03 13:00:06 -08:00
800c35fca5 Multi-DRM Support (#4930)
* Add support for com.apple.fps keySystem

* Improve support for DRM key-systems and key handling
Resolves #2833 #2737 #4318 #4538

* Update README `licenseXhrSetup` example

* Update api-extractor markdown

* Attach CDM on start when even when initial fragments do not have a key associated with them

* Handle expired key status correctly

* Map key-sessions by key ID and log key ID more often than URI

* Support "clear-lead" key-session creation without new config

* Emit and handle FRAG_PARSING_ERROR from transmuxers (#5018)

* Emit and handle FRAG_PARSING_ERROR from transmuxers
Related to #5011
* Switch levels on Key and Fragment parsing errors or escalate to fatal error

* Route all key-system errors to `onFragmentOrKeyLoadError`

* Populate EMEKeyError.err for better demo error logging

* Remove `useEmeEncryptedEvent` and mark `widevineLicenseUrl` as deprecated in API.md

* Add support for EXT-X-SESSION-KEY tags (for key-system access on manifest loaded)
#4927

* Throw before licenseXhrSetup if key was removed

* Make key session promise chain more consice

* Stop on fatal key system errors

* Only request access to key-systems for keys matching those found in the config one at time (to avoid gaining access to WV and PR on Edge)

* Modify key-system helpers so that it's easier to support additional key-system strings

* Add undocumented `generateRequest` ("Content ID") filter

Co-authored-by: Vincent Valot <vincent.valot@bedrockstreaming.com>
2022-12-15 08:23:03 -08:00
Rob WalchandGitHub 542873123e Eagerly match segments without tolerance offset (#5084)
* Eagerly match segments without tolerance offset
Fixes #4919

* Maintain expected `fragPrevious` behavior
2022-12-08 14:40:14 -08:00
Casey OcchialiniandGitHub 4f01724667 Reset the cached clientRect when media is attached (#5070)
* Reset the cached clientRect when media is attached

* Add test for capLevelToPlayerSize event order independence
2022-11-29 12:20:45 -08:00
Rob WalchandGitHub e38d5b7d01 Schedule live reload based on start of last update request (#4961)
* Schedule live reload time base on start of last update request
Use last fragment duration rather than target duration when playhead is less than two target durations from the live edge

* Eliminate JavaScript execution and setTimeout latency from playlist reload interval

* Comment out debug logs

* Reload live stream using last segment length when distance to playlist end is less than or equal to four target durations
(Reload is scheduled on update. With a default live sync of 3 target durations, without interruption, a distance of 3x-4x is most likely.)
2022-10-24 19:56:05 -04:00
b0c70f2a1f Bugfix: Live Playlist Reload Interval (#4940)
* reload playlist at intervals based on target duration, according to HLS spec

* fixed unit tests for reload interval

* revert levelTargetDuration; use targetduration for reload interval

Co-authored-by: Matt Zucker <mattzucker@users.noreply.github.com>
2022-10-07 19:29:47 -04:00
Rob WalchandGitHub 6216ab91fd Fix handling of negative composition timestamps (#4885)
* Fix handling of negative composition timestamps in ts->mp4 remuxing ("PTS < DTS" warnings)
Fixes #4878

* Only set trun version to 1 when track samples contain negative composition timestamps

* Only set trun version to 1 on video track trun boxes

* Do not reload partial fragments. They must be evicted from the tracker to reload.
(prevents loop loading on https://playertest.longtailvideo.com/adaptive/captions/playlist.m3u8 which now presents gaps in Safari)

* Fix for test stream with large DTS gap and bad composition timestamps
2022-09-09 16:57:32 -04:00
Rob WalchandGitHub 551f133266 Fix seek to live start regression introduced in #4864 (#4887) 2022-09-08 10:46:33 -04:00
Rob WalchandGitHub afb38ec9f6 Resume streaming after bitrate test with low max buffer (#4866)
* Resume streaming after bitrate test with low max buffer
Fixes #4865

* Skip bandwidth test with only one level
2022-08-29 14:38:05 -04:00