Commit Graph

209 Commits

Author SHA1 Message Date
Álvaro Velad Galván ff7cea5b96 fix(net): Avoid duplicate progressUpdated in HttpXHRPlugin onload (#9726) 2026-02-18 12:28:29 +01:00
Álvaro Velad Galván 20c0758e11 refactor(net): Improve DataUriPlugin parsing logic (#9724)
- Replace split(':') with startsWith('data:') for scheme validation
- Use indexOf(',') instead of split(',') to avoid unnecessary
allocations
- Remove window dependency from decodeURIComponent
- Normalize base64 detection using toLowerCase()
2026-02-17 13:44:56 +01:00
Álvaro Velad Galván 5abd49cd82 feat: Add requestType and context to download events (#9723)
Close https://github.com/shaka-project/shaka-player/issues/9408
2026-02-17 12:43:26 +01:00
Álvaro Velad Galván ef361ed039 feat: Add MoQT draft-14 + WARP/MSF draft-1 experimental support (#9409)
Spec: https://datatracker.ietf.org/doc/draft-ietf-moq-transport/14/
Spec: https://datatracker.ietf.org/doc/draft-ietf-moq-warp/01/

Note: this is experimental and not included in the default builds

---------

Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-01-14 09:27:10 +01:00
Álvaro Velad Galván c920ecd4fa chore: Move createSegmentRequest to shaka.net.NetworkingUtils (#9363) 2025-11-05 21:05:49 +01:00
Álvaro Velad Galván 4bc2518e29 feat!: Remove LRC, SBV, SSA support (#9330)
Related to https://github.com/shaka-project/shaka-player/issues/9321
2025-11-04 20:07:02 +01:00
Álvaro Velad Galván e85b648ef0 feat!: Remove MSS support (#9329)
Related to https://github.com/shaka-project/shaka-player/issues/9321
2025-11-04 20:06:44 +01:00
Julian Domingo 1ad34975ac feat(HLS): Add a mediaTypes field to shaka.extern.DrmInfo (#9198)
Close https://github.com/shaka-project/shaka-player/issues/9197
2025-10-14 12:53:25 -07:00
Álvaro Velad Galván 7ccb20a641 feat(HLS): Add support for com.apple.hls.chapters (#9195)
Spec:
https://developer.apple.com/documentation/http-live-streaming/providing-javascript-object-notation-json-chapters

Add disableChapters config
Update the UI to show chapters if there is only one language Add support
to download chapters

---------

Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2025-10-14 15:20:51 +02:00
Álvaro Velad Galván 6235b66004 chore(Ads): Some renames to accommodate the changes to integrate SVTA2053-2 (#9169) 2025-10-07 11:44:24 +02:00
Álvaro Velad Galván e6dfa903ef feat(Ads): Add support for tracking urls (#9144) 2025-09-29 21:27:41 +02:00
Wojciech Tyczyński 6d04f7f225 feat(net): Allow request filters to be called multiple times (#9129)
This change allows to execute request filter on every request attempt.
It can be useful i.e. to update credentials when first request fails.

New field `attempt` has been added to `shaka.extern.Request` which
informs which attempt is currently ongoing. This is needed to not do the
unnecessary work multiple times.

HTTP 401 Unauthorized and 403 Forbidden are no longer treated as
immediate critical errors, as tokens can be updated during retry
process.
2025-09-24 11:55:47 +02:00
Álvaro Velad Galván 180c2e7e40 chore: Use the same getExtension function in all code (#9081) 2025-09-11 13:47:59 +02:00
Wojciech Tyczyński 57f69807e1 fix(net): Throw HTTP_ERROR if request header is not valid (#8990)
`Headers` class and `XMLHttpRequest.setRequestHeader` throw an error if
added header is not a valid byte string, so we should take an advantage
of it instead of throwing an incompatible error.
2025-08-19 15:01:36 +02:00
Joey Parrish 7c1e31d4e6 chore: Add trailing commas to all record types (#8820)
Now that jsdoc supports this, it will make future diffs cleaner. See
#8819 and #1236.
2025-06-30 13:36:04 -07:00
Juan Manuel Gonzalez 2420cc90ab feat(CMCD): Add response mode for CMCDv2 (#8782)
# CMCD V2 - Response Mode
## PR Description
This PR focuses on the implementation of Response Mode functionalities
for version 2 of the Common Media Client Data (CMCD v2) specification
within the Shaka Player project.

Key changes made in this pull request include:
- **Response Mode**: CMCD v2 introduces "Request Mode" "Response Mode"
and "Event Mode". Request Mode aligns with the default delivery mode in
CMCD v1. Response Mode, which this PR implements, allows clients to send
data to one or more alternative destinations after receiving either a
full response or an error to a media object request. These reports use
one of the defined data transmission modes (Query Mode or Headers Mode)
- **CmcdTarget**: A new configuration type, `shaka.extern.CmcdTarget`,
was introduced. This configuration allows specifying the transmission
strategy (mode=response) since targets can also be configured for
**event mode** (mode=event), whether it's enabled (enabled), if it uses
HTTP headers mode (`useHeaders=true`) or query parameters mode, the
destination URL (url), and specific keys to include (`includeKeys`). For
Response Mode, the mode value includes 'response'.
- **Independent Handling of Transmission Modes**: Request mode and
Response mode can be enabled and disabled independently using the
previously mentioned CmcdTarget config for response mode and the base
config for request mode.
- **Validation and Filtering of Keys**: Allowed keys for Response Mode
were added, and validation for these keys was implemented. The
capability to include (`includeKeys`) and filter specific keys for both
Request Mode and each Response Mode target was also enabled. Also, CMCD
dictionary definitions were moved to a new dedicated section to improve
structure
- **Unit Tests**: Extensive unit tests were included and unified to
validate CMCD v2 functionality in both Request Mode and Response Mode.

Config example with request mode and targets with response mode:
```js
const cmcdConfig = {
	enabled: true,
	version: 2,
	contentId: 'content-id',
	useHeaders: false,
	targets: [{
        	mode: 'response',
        	useHeaders: false,
        	enabled: true,
        	url: 'http://localhost:3003/response-mode'
        }]
}
```

## Keys not implemented in this PR
The following keys are defined in the CMCD v2 specification but are not
calculated or attached to requests/responses in the `cmcd_manager.js`
code:
- **Common & Request Mode Keys:**
	- **`ab` (Aggregate encoded bitrate)**
	- **`tbl` (Target Buffer length)**
	- **`cdn` (CDN Id)**
	- **`bg` (Backgrounded)**
	- **`sta` (State)**
	- **`ts` (Timestamp)**
	- **`tpb` (Top playable bitrate)**
	- **`lb` (Lowest encoded bitrate)**
	- **`tab` (Top aggregated encoded bitrate)**
	- **`lab` (Lowest aggregated encoded bitrate)**
	- **`pt` (Playhead time)**
	- **`ec` (Player Error Code)**
- **Response Mode Keys:**
	- **`rc` (Response code)**
	- **`ttfb` (Time to first byte)**
	- **`ttfbb` (Time to first body byte)**
	- **`ttlb` (Time to last byte)** 
	- **`url` (Request URL)**
	- **`cmsdd` (CMSD Dynamic Header)**
	- **`cmsds` (CMSD Static Header)**

Related to https://github.com/shaka-project/shaka-player/issues/8660

---------

Co-authored-by: Constanza Dibueno <121617928+cotid-qualabs@users.noreply.github.com>
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2025-06-25 10:19:25 +02:00
Wojciech Tyczyński e8a8ad9fab perf(net): Do not parse headers twice in XHR plugin (#8710)
Continuation of #8618
2025-06-06 16:19:54 +02:00
Álvaro Velad Galván c19cbafc10 fix(net): Fix "Payload length does not match range requested bytes" when using open end (#8651) 2025-05-27 18:16:56 +02:00
Álvaro Velad Galván edf5bdcb79 chore(net): Add log about "Payload length does not match range requested bytes" (#8620) 2025-05-20 13:56:49 +02:00
Álvaro Velad Galván cd9c8504a9 perf(net): Avoid parsing headers twice (#8618) 2025-05-20 13:56:39 +02:00
Srikanth Peddibhotla 8e0d45f493 fix: Handle null response body for fetch responses (#8384)
fetch API returning a ReadableStream response body is not supported by
all browsers.
Browser compatibility:
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API If it is not
supported, download the whole segment in one shot

Co-authored-by: Srikanth Peddibhotla <peddisri@amazon.com>
2025-04-03 09:59:34 +02:00
Nick Michael d9b0e857e1 feat: Provide Segment Reference to ABR Manager (via the request context) (#8316)
Provides the Segment Reference to the ABR Manager via the request
context. This allows the ABR manager to get information about the
specific segment being downloaded such as the start and end time (used
to calculate segment duration).
2025-03-24 12:52:26 +01:00
Álvaro Velad Galván 36db472d93 feat(net): Add networking config (#8306) 2025-03-21 10:20:38 +01:00
Álvaro Velad Galván a30f1da2a2 fix(net): Allow preventDefault() on retry event (#8058)
Fixes https://github.com/shaka-project/shaka-player/issues/8041
2025-02-11 19:10:52 +01:00
Álvaro Velad Galván a0ed8da7e2 fix(net): Add 304 as successful request (#7963)
Fixes https://github.com/shaka-project/shaka-player/issues/7925
2025-01-28 12:28:59 +01:00
Álvaro Velad Galván e971a68f35 chore: Stop using "Object" in networking annotations (#7937)
Related to #1672
2025-01-24 10:54:58 +01:00
Álvaro Velad Galván c54b2dee19 chore: Stop using "Object" in plugins annotations (#7933)
Related to https://github.com/shaka-project/shaka-player/issues/1672
2025-01-24 08:29:51 +01:00
Wojciech Tyczyński 6e55a3b21b build: Forbid using dot in generic types (#7904)
Fixes #2643

Happy reviewing!
2025-01-20 09:39:51 +01:00
Wojciech Tyczyński 82f7eafdc5 build: Add new JSDoc rules to ESLint (#7897)
Adds a replacement for removed JSDoc checks from ESLint v9.
Additionally fixes lots of issues found in the JSDoc, such as:
- missing `@param`/`@return` annotations
- bad formatting
- params order
- param name in the same line as type definition (tried to disable it,
but it was causing other issues and we didn't have lots of places with
such formatting)

Minor fixes in code found by Closure Compiler after fixing JSDoc are
also included.
2025-01-17 09:28:19 +01:00
Álvaro Velad Galván b0be77998a fix: Detect mov extension as video/quicktime (#7884) 2025-01-13 20:27:24 +01:00
Álvaro Velad Galván 59c9989e49 feat(net): Add originalRequest to shaka.extern.Response (#7857) 2025-01-09 18:50:13 +01:00
Joey Parrish b153a9c4af fix: Fix SEGMENT HEAD requests, compatibility with Cast SDK (#7851)
The Cast SDK currently assumes that SEGMENT response objects always have
data, however this stopped being true for HEAD requests in v4.3.6.

This PR fixes the behavior of the Fetch plugin so that HEAD requests
will at least have an empty ArrayBuffer for data, as they did in v4.3.5
and earlier.

The Cast SDK will also receive a fix to stop assuming this, fixing
compatibility with v4.3.6+ - v4.12.6.

This incompatibility between the current Cast SDK and these versions of
Shaka Player is only triggered by HLS content whose segment URLs have no
recognizable extension.

Affected Shaka Player versions:
 - v4.3.6 - v4.3.16
 - v4.4.x - v4.8.x
 - v4.9.0 - v4.9.34
 - v4.9.2-caf - v4.9.2-caf4
 - v4.10.x
 - v4.11.0 - v4.11.18
 - v4.12.0 - v4.12.6

Affected Cast Web Receiver SDK versions:
 - <= 3.0.0137

Fixes will be in:
 - v4.9.35+
 - v4.9.2-caf5+
 - v4.11.19+
 - v4.12.7+
 - v4.13.0+

Closes #7600
2025-01-09 09:51:32 +01:00
Wojciech Tyczyński 51765e9693 build: Change spellchecking tool and fix spelling mistakes (#7765)
Fixes #7693
2024-12-20 12:27:05 +01:00
Álvaro Velad Galván 87cbf4d90a fix(Ads): Don't try to play Image and HTML overlay interstitials (#7697)
We don't currently support those types of interstitials, so this PR makes the player properly reject them.
2024-11-29 17:01:54 -08:00
Wojciech Tyczyński 55b7bd0a70 fix: Forbid usage of instanceof ArrayBuffer (#7653)
Fixes #6279
2024-11-26 11:16:00 +01:00
Álvaro Velad Galván c10b796bb6 feat: Add basic support for the Common Access Token (#7651)
Close https://github.com/shaka-project/shaka-player/issues/7649
2024-11-25 09:28:51 +01:00
vlazh 13186bd403 feat: Add 'downloadcompleted' event (#7609)
Closes #7608
2024-11-18 08:41:24 +01:00
vlazh 0fc5316c5a fix: Calculate timeToFirstByte before fire the event 'downloadheadersreceived' (#7605)
Fixes #7604
2024-11-15 15:43:37 +01:00
Álvaro Velad Galván 6716ff00c4 fix: Avoid make HEAD request for image mime type (#7332) 2024-09-17 20:55:16 +02:00
Álvaro Velad Galván f5b78dc88a feat(Ads): Added advanced type to ad requests (#7196) 2024-08-23 12:34:44 +02:00
Wojciech Tyczyński d36ff6553c feat(net): Add minimum bytes for progress events (#7117)
By limiting progress events to only ones with minimal chunk size, we might end up with feeding better default ABR implementation, which should result in more accurate adaptation in case of network throttle.
2024-07-31 05:34:13 -07:00
Álvaro Velad Galván 8bb2d6e11a fix: Exclude fetch polyfill from fetch plugin (#6838)
This fix excludes the use of
https://www.npmjs.com/package/fetch-polyfill because it does not support
a signal to cancel requests in progress.
2024-06-17 11:35:45 +02:00
Wojciech Tyczyński 2f3a1ebf94 feat(DASH): add MPD_PATCH advanced request type (#6787)
Add `shaka.net.NetworkingEngine.AdvancedRequestType.MPD_PATCH` to
distinguish regular MPD requests from MPD Patch requests.
2024-06-11 10:56:14 +02:00
theodab 1cfb53e648 fix(preload): Copy net filters to preload manager (#6709)
Some assets might rely on networking engine filters (request and
response filters) to properly download their assets. However, the
preload manager's need to use a fresh networking engine also caused it
to not use any filters set on the player already. This changes the
process of setting up a preload manager, to make it copy over any
filters defined on the player's networking engine.

Fixes #6698
2024-05-30 12:45:12 +02:00
Álvaro Velad Galván 812163a986 fix: Fix numBytesRemaining when the request is done (#6653) 2024-05-23 04:16:50 +02:00
Álvaro Velad Galván dda713aa71 feat: Optionally force HTTP content URIs (#6649)
This may be necessary on older devices where not all certificates are
present.
2024-05-23 04:16:18 +02:00
Álvaro Velad Galván ed939872e1 feat: Add response URI to BAD_HTTP_STATUS error (#6561)
Closes https://github.com/shaka-project/shaka-player/issues/2969
2024-05-08 20:17:36 +02:00
Álvaro Velad Galván d532bf44c7 feat: Add bytesDownloaded to stats (#6469)
Closes https://github.com/shaka-project/shaka-player/issues/6413
2024-04-23 14:26:58 -07:00
Dave Nicholas 6c4333c565 feat(ABR): Additional request information for ABR Managers (#6313)
This PR makes the following request information available for ABR consideration. Allowing the ABR manager to know about the request latency from the time to first byte and knowing the order order of a packet, as well as the contentType of the request.
2024-03-06 12:15:38 -08:00
Álvaro Velad Galván 48626f2ae0 fix: Change quality only when adding the last partial segment and it is fast switching (#6114) 2024-01-18 08:31:06 +01:00