Commit Graph

22 Commits

Author SHA1 Message Date
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 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
Wojciech Tyczyński 6e55a3b21b build: Forbid using dot in generic types (#7904)
Fixes #2643

Happy reviewing!
2025-01-20 09:39:51 +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
Á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
Pavelas 27015278cd feat(net): Add response HTTP status to Networking engine responses (#3641)
Closes #3640
2021-09-16 11:50:13 -07:00
michellezhuo e7965fe219 feat(LL-HLS):Set segment availability duration
When starting playback for HLS live, we have the availability window
same as the delay duration from live edge. Thus, the playback start time
is the same as availability window start, and falls behind the window as
the window keeps move forward.
This may cause the seeked partial segments to be unavailable.

To make our system more robust, we can skip checking if the segment fits
in the availability window. Instead, we can send the request anyway. If
the segment is not available, we can handle the 404 error and try to fetch
the segment again.
This would not require us to calculate the segment availability window
in advance.

Issue #1525

Change-Id: Ib9c0eca8e9db2d93404745d87a5171fcb5fdce20
2020-08-20 19:03:34 +00:00
Jacob Trimble dc8b007d56 cleanup: Add missing requires.
This is a port of the internal changes: cr/321495405, cr/321592702,
and cr/321594488.

Change-Id: If6a4c4266ed10a70b01442974dbd19329bb5122e
2020-07-16 10:59:49 -07:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Jacob Trimble 596c80a949 Refactor handling of ArrayBuffer.
This changes the network API to use BufferSource instead of ArrayBuffer,
which allows plugins to return a "view" on a buffer instead of the
whole buffer.  This also adds some utilities for changing between
views and buffers.

Lastly this forbids the use of the "buffer" property of TypedArrays
since it doesn't work with partial "views".  This audits and fixes the
usages of the "buffer" property to ensure correct usage.

It should be noted that both MSE and EME accept a BufferSource as input,
so we don't need to convert a "view" into an ArrayBuffer before passing
to it.

Change-Id: Iaa417773f8ce5304424e43c7372ce10ebf540d2a
2019-08-20 20:17:33 +00:00
Chris Fillmore d846e58af6 Add originalUri as a property on shaka.extern.Response (#1972)
This property tracks the original request uri, which would be
useful to know in the event of a redirect.

Fixes #1971
2019-06-01 13:30:41 -07:00
Jacob Trimble 74918b90ec Convert networking files to ES6.
Issue #1157

Change-Id: Iae83b88881b351c97e8ec020625167f5f700f97e
2019-05-20 17:10:06 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Aaron Vaage bf0d107630 Add Missing "."
Add missing "." after "Array", "Object", and "Promise".

Change-Id: I86f6bd6ea38ce6531b71d22923622ccda07fc6aa
2018-04-11 21:36:44 +00:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Jacob Trimble 0154dbc4d4 Convert 'var' to 'let'/'const' (6 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: I475eba0a477d13cd9201c88ad44899d521ad8991
2018-02-20 11:28:02 -08:00
Chris Fillmore 4ac1a40578 Provide RequestType in error data from HttpPlugin. (#1254)
Closes #1253
2018-02-12 10:01:58 -08:00
theodab b4ca4bf51c Adds an HTTP/s scheme plugin using Fetch
This plugin is preferred over the XHR plugin, if available.
This plugin requires AbortController, which is only present on
Firefox 57 and Edge 16, so this will not be active on every platform.

This also adds a simple mock for the Fetch API for use with Jasmine.

Closes #829

Change-Id: Ifb79d29334fbfcfd175afe0706da5a3d5e452e2f
2018-02-08 23:11:53 +00:00