Commit Graph

247 Commits

Author SHA1 Message Date
Álvaro Velad Galván 42f491f782 feat(DASH): Add support for Content Steering (#5710)
Related to https://github.com/shaka-project/shaka-player/issues/5704
2023-11-09 08:34:09 +01:00
Álvaro Velad Galván c2c8320251 fix(Offline): Fix download of some HLS manifests (#5861) 2023-11-06 20:38:49 +01:00
Álvaro Velad Galván 508e5cfbba feat(DASH): Add initial support for "urn:mpeg:dash:ssr:2023" (#5762) 2023-11-03 14:57:15 +01:00
theodab 4425dca283 chore: Remove state engine (#5752)
The state engine mechanism, designed for the player class, was
over-engineered. The structure of the class makes debugging player
errors unnecessarily annoying, by obfuscating the code-path the error
followed, and in general
has created a significant amount of technical debt.
This changes the player to use an async-await setup for the top-level
operations, laying things out much more cleanly
and linearly.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-10-30 23:59:08 -07:00
Álvaro Velad Galván 81fc82b6b2 feat(HLS): Add support for REQ-VIDEO-LAYOUT (#5809)
Also add preferredVideoLayout config
2023-10-26 09:25:45 +02:00
Álvaro Velad Galván 8b7141f923 fix(DASH): Fix manifest update time for LL-DASH (#5736) 2023-10-11 11:34:15 +02:00
Dave Nicholas 0078137d1b feat: Enable codec switching (#5470)
Closes: https://github.com/shaka-project/shaka-player/issues/1528
Closes: https://github.com/shaka-project/shaka-player/issues/1567
Closes: https://github.com/shaka-project/shaka-player/issues/4379
Closes: https://github.com/shaka-project/shaka-player/issues/5306

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-10-04 08:37:14 +02:00
Álvaro Velad Galván 0bbb47025e feat(DASH): Add new config to prevent mixing of audio representations from different adaptation sets (#5620)
Closes https://github.com/shaka-project/shaka-player/issues/5461
2023-09-13 22:38:00 +02:00
Álvaro Velad Galván de19884dd1 fix(HLS): Fix external subtitles out of sync in HLS (#5491)
Fixes https://github.com/shaka-project/shaka-player/issues/5458
Fixes https://github.com/shaka-project/shaka-player/issues/5443
2023-08-21 09:00:07 -07:00
Joey Parrish ffafacfb84 test: Disable power-saving features on both Chrome and Edge (#5508)
Power-saving features on Chrome and Edge were subtly interfering with
playback tests. Timers could be throttled, and both video-only media and
media in occluded windows could be paused by the browser.

This was discovered only after awaiting play() Promises in all tests.
These Promises were being rejected with useful error messages that led
to these discoveries.

Awaiting play() requires us to disable stall detection during playback
tests. This is because on some platforms, stalls get resolved by calling
pause() and then play(), which would cause the original awaited play()
Promise to be rejected.

Finally, some Player tests created additional Player instances that were
unnecessary. Removing those allowed me to centralize most of the
configuration to disable stall detection.
2023-08-18 18:45:05 -07:00
Wojciech Tyczyński f53349fc93 feat: Add originalLanguage to the Track structure (#5409)
Shaka in most of places normalizes tracks' language code to be compliant with ISO 639-1 when possible. However, it does not do that all the time (i.e. normalization is missing in MSS parser) and there is no way to get value that has been explicitly set in a manifest. Moreover, documentation is misleading, as it claims that value is taken directly from a manifest.
Normalization should take place, specifically to easify PeriodCombiner algorithm and also to not break existing applications.
However, original value can be desired for some implementations.
This PR introduces new field to get original language value from the manifest.
2023-07-18 02:09:17 -07:00
theodab 654a0281d9 feat(DASH): Expose accessibility purpose in track (#5216)
Closes #5211
2023-05-08 17:13:06 -07:00
Vincent Valot cc97da167f feat: allow reuse of persistent license sessions (#4461)
Add capability to re-use persistent license sessions across sessions.

DrmEngine will now always:
- try to start stored persistent sessions before trying to fetch a
license, as-to be able to check if all needed keys are already loaded.
- ask for a new license when the persistent session doesn't have the
needed keys for playback,

Given the flag `persistentSessionOnlinePlayback` is true, DrmEngine:
- won't remove the persistent session from the device at the end of the
playback,
- won't throw an error when the persistent session isn't found on the
device,

For now, it needs Shaka's users to persist session information by
themselves (localStorage, IndexDB, ...) before giving it back for the
next session. Still, it lays foundation to develop the feature to fully
handling it on Shaka's side.

Related to #1956
2023-04-19 15:18:34 -07:00
theodab d4d37407c8 fix(offline): Add storage muxer init timeout (#4566)
In some cases, indexedDB.open() can end up calling neither callback.
When this does happen, according to my initial testing, it happens
consistently when reloading the page, so it's not a one-off fluke but
presumably some sort of implementation or browser install problem. If
that does happen, the init promise of the storage muxer hangs forever,
potentially blocking other operations from happening. This adds a
timeout to the invocation of indexedDB.open(), after which the operation
fails with a new error.
2022-10-13 15:35:55 -07:00
Joey Parrish c97768bfe0 test: Fix playback timeouts on ChromeMac (#4520)
Shorten a StreamingEngine integration test to work around an issue with
ChromeMac where playback doesn't always occur at 1x. This is an issue
with Selenium or Chrome itself (unknown) that is out of our control. By
making the test somewhat shorter, we can have it complete on time, even
when this issue is present on a device.

Also increase timeouts on offline playback tests.
2022-09-28 08:19:44 +02:00
Joey Parrish 87e91874ee test: Disable offline for Xbox One (#4232)
Xbox One tests have been failing often for some time now, so it went
unnoticed that offline was not working.  It seems that IndexedDB is
not working properly on Xbox, and the platform throws `UnknownError`.

This restricts offline so that it is not triggered on Xbox One, and
this also fixes the filtering of our offline tests to respect the
offline storage muxer's support method.
2022-05-17 11:18:59 -07:00
Álvaro Velad Galván 73f6de3e01 feat(offline): improve the speed of offline downloads (#4168)
Add the possibility to configure the number of downloads in parallel per stream. If you put a higher value the download time can decrease.

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

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2022-04-28 11:30:52 -07:00
Joey Parrish cc351a3d91 test: Add debug info to failure messages in test waiter (#4137)
This should help debug flakiness and failures in StreamingEngine tests
on Safari and Firefox.
2022-04-18 19:50:24 -07:00
Joey Parrish ac5acc80cb feat!: Remove deprecated features, update upgrade guides (#4089)
Below are the changelog entries for each deprecated feature removed by this commit.

-----

feat(config)!: `manifest.dash.defaultPresentationDelay` has been replaced by `manifest.defaultPresentationDelay` (deprecated in v3.0.0)

feat(config)!: Configuration of factories should be plain factory functions, not constructors; these will not be invoked with `new` (deprecated in v3.1.0)

feat(player)!: `shaka.Player.prototype.addTextTrack()` has been replaced by `addTextTrackAsync()`, which returns a `Promise` (deprecated in v3.1.0)

feat(ui)!: `shaka.ui.TrackLabelFormat` has been renamed to `shaka.ui.Overlay.TrackLabelFormat` (deprecated in v3.1.0)

feat(ui)!: `shaka.ui.FailReasonCode` has been renamed to `shaka.ui.Overlay.FailReasonCode` (deprecated in v3.1.0)

feat(offline)!: `shaka.offline.Storage.prototype.store()` returns `AbortableOperation` instead of `Promise` (deprecated in v3.0.0)

feat(offline)!: `shaka.offline.Storage.prototype.getStoreInProgress()` has been removed; concurrent operations are supported, so callers don't need to check this (deprecated in v3.0.0)

feat!: `shaka.util.Uint8ArrayUtils.equal` has been replaced by `shaka.util.BufferUtils.equal`, which can handle multiple types of buffers (deprecated in v3.0.0)

feat(manifest)!: `shaka.media.SegmentIndex.prototype.destroy()` has been replaced by `release()`, which is synchronous (deprecated in v3.0.0)

feat(manifest)!: `shaka.media.SegmentIterator.prototype.seek()`, which mutates the iterator, has been replaced by `shaka.media.SegmentIndex.getIteratorForTime()` (deprecated in v3.1.0)

feat(manifest)!: `shaka.media.SegmentIndex.prototype.merge()` has become private; use `mergeAndEvict()` instead (deprecated in v3.2.0)

feat(plugin)!: `AbrManager` plugins must implement the `playbackRateChanged()` method (deprecated in v3.0.0)

feat(plugin)!: `shaka.extern.Cue.prototype.spacer` has been replaced by the more clearly-named `lineBreak` (deprecated in v3.1.0)

feat(plugin)!: `IUIElement` plugins must have a `release()` method (not `destroy()`) (deprecated in v3.0.0)
2022-04-11 17:11:40 -07:00
Joey Parrish fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -07:00
Joey Parrish 1507b1e844 chore: Update URLs after moving projects (#4008) 2022-03-03 14:34:40 -08:00
Michelle Zhuo 36d0b5484f feat(HLS): Containerless format support
This adds code to allow Shaka Player to play media in sequence
mode, an alternate playback mode that makes the browser ignore
media timestamps, when playing HLS media.
This is important for containerless media formats, as they do not
contain such timestamps.
Changing HLS to not require timestamps also means that we no
longer need to fetch media segments in order to get the start
time, which should lower bandwidth usage and startup delay.
In initial tests, on a simulated 3G network, load latency went down
from an average 3.16s to 2.61s on the HLS version of "Big Buck Bunny:
the Dark Truths of a Video Dev Cartoon"; an improvement of about 17%.

Issue #2337

Change-Id: I507898d74ae30ddfb1bddf8dce643780949fbd9b
2022-02-08 09:34:03 -08:00
Álvaro Velad Galván 74c491d2e0 feat: Add separate audio and video MIME types to Track API (#3892)
Fixes: #3888
2022-01-24 15:28:17 -08:00
Theodore Abshire db8ad31bfb feat(offline): Load init segments first for keys
It is unlikely that we will be able to load DRM sessions inside
the service worker for BG fetch. However, sometimes we have to get
the DRM keys from the init segments.
This changes Storage.downloadSegments_ to download the init segments
first if it looks like they will contain needed init data to create
license requests.
This also fixes a typo that was preventing us from getting init data
from segments, and adds a test that would catch that issue.

Issue #879

Change-Id: Ide859ed0eb2d9208150787f14d915135df681d96
2021-08-12 21:03:04 -07:00
Theodore Abshire 5215f5319f feat(offline): Changed store order of operations.
This changes the order that things happen when the offline storage
mechanism stores a manifest, so that the manifest is made and the
segments are downloaded in separate steps.
This is in preparation for adding background fetch support.

Issue #879

Change-Id: I4451db839b654f6134f06a58c240a9ca98d31a4e
2021-08-10 23:23:13 -07:00
Álvaro Velad Galván 2a4083bab8 feat: Add support to HLS Image Media Playlists (#3365)
Close: #2429
2021-06-02 10:53:32 -07:00
Michelle Zhuo 9709086e98 refactor(MediaCap): Remove MediaCapabilities config
Remove "useMediaCapabilities" configuration in the code base.

Issue #1391

Change-Id: I5fc74e31666840828e9dc04a5733db3eaed0d21a
2021-05-21 20:39:06 +00:00
Vincent Valot 9b4502cc5d feat: add serverCertificateUri in DRM advanced config (#3358)
Fixes #1906
2021-05-03 10:53:31 -07:00
Michelle Zhuo 2f65b97b79 feat(MediaCap): Use MediaCapabilities for offline storage
Issue #1391

Change-Id: Ifdf4477d3798ddacf77036f7d85d9cb29438becc
2021-04-07 19:50:51 +00:00
Vincent Valot 4574a5dd92 feat: make drm sessionType configurable in advanced DRM config (#3301)
Prerequisite for issue #1495 (com.microsoft.playready.recommendation key system)
2021-04-01 16:32:51 -07:00
Álvaro Velad Galván b9b3cc8098 feat(dash): Add support for thumbnail tracks (#3145) 2021-03-02 13:36:09 -08:00
Álvaro Velad Galván f067ae10ac Parse spatial audio from manifest (#3148) 2021-02-24 09:28:33 -08:00
Joey Parrish 04003a3891 fix: Fix offline storage after a failure
When we started deduplicating storage by caching download results for
identical init segments, we mistakenly also cached download failures
or aborted operations.

This moves the cache to the stack so that Storage does not cache
content across store() calls.

Closes #2781

Change-Id: Ia02ca72c3da3132ae6c55a3832bafc67613df810
2021-02-18 00:34:42 +00:00
Joey Parrish 2fdbd6d942 test: Skip Axinom-based tests on Xbox One
Axinom will not issue licenses to Xbox One, so the tests that use
Axinom for PlayReady testing must be skipped on that platform.
Ideally, we would switch providers for the license, so I've added a
TODO for that.

Change-Id: I93da03b19ec5e28c1f50a40edca8563d92917555
2021-02-03 18:59:19 +00:00
Álvaro Velad Galván 71372869de feat: Extract HDR metadata from HLS manifests (#3116)
In our isTypeSupported polyfill for Cast, we use the HEVC profile ("hevc1.2") as
an indication of the HDR transfer function, which is not always accurate.
The polyfill should stop assuming that 10-bit color HEVC means HDR, and remove
the extra eotf="smpte2084" parameter. Instead, the manifest parser should
extract HDR profile information from the DASH manifest and pass that info along
through the Stream object.

Issue #3116 .
2021-01-31 23:36:57 -08:00
Álvaro Velad Galván 01998f3b99 Parse forced subtitles from manifest (#2938)
Issue #2122
Issue #2916
2020-10-27 14:00:48 -07:00
michellezhuo 56a53db33f build: add goog.require for compiler upgrade (Part3)
Change-Id: I08044eaefa12a7871664085026ff73ee0bebd5c4
2020-10-09 15:49:39 -07:00
Michelle Zhuo 093103e646 build: test util refactor for compiler upgrade
Refactor the test util and relevant files for compiler upgrade.
In test files, a few files depending on each other formed a
dependency loop.
For example, test/Util has a few methods for waiting/delay that
uses Waiter, and those methods should be in Waiter.
This changes helps to break the dependency loop, and helps to
unblock the compiler upgrade.

Change-Id: Ie5ece145748bf2eafe3fa065b79cf2a81b1637e1
2020-10-09 22:49:11 +00:00
Theodore Abshire 509e7b046a fix(manifest): Fix embedded captions vanishing.
Previously, on manifest updates, embedded captions would vanish in
single-period live DASH streams.  The problem was based on the
specific point in the load order that we added dummy text streams
to indicate the presence of embedded captions.
This modifies the PlayerInterface for manifest parsers to add a
new method passed in, makeTextStreamsForClosedCaptions, which
must be called by manifest parsers for new video streams.
This also completes an unfinished feature, where new video streams
which add new closed captions would not get corresponding
text streams.

Closes #2811

Change-Id: Iee7499ec950b363cf6839765cc2bd2d01743467d
2020-08-26 15:05:40 -07:00
Joey Parrish 53b6e40c6d fix(offline): Fix progress callbacks in release mode
This works around an apparent compiler bug that caused the invocation
of our progress callbacks to be removed from the compiled output.  To
test for this, the existing progress tests now use the compiled
library.

Closes #2652

Change-Id: I5698cfe0a833696e9cd5c8f8851698e1e66ef901
2020-06-16 00:09:39 +00:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish aba5e2583c Rename v2.6 to v3.0 and v2.7 to v3.1
We have decided to bump the major version number instead of the minor
number, based primarily on the fact that this release breaks
compatibility with our previous manifest structure.

Change-Id: I67e4c8267c6e103cfc7278e09daac186ae5cbbc6
2020-05-29 17:50:22 +00:00
Joey Parrish 4eefaa44cb Correct type info in tests
In many places in the tests, we used "Object" or "*" or just no type
at all for various fakes.  These were all flagged by the new Closure
Compiler version we are adopting.

In some other places, we mixed up similar types or had the wrong
nullability on a type.

In still others, types were missing fields.

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I324e0b28f7e30a4102aa26ec2c9901fa9732211b
2020-04-30 16:00:17 +00:00
Joey Parrish f15f371d20 Fix issues with nullability of strings
Various issues with the nullability of string types led to various
fixes, including:
  - adding an assertion or runtime check that something is not null
  - moving an existing null check to before a calculation
  - converting a test expectation into an assertion that the compiler
    understands (which will still fail the test if the assertion
    fails)

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I11da091c9e7974c8bea84b3b584cbd29d1e320e2
2020-04-29 22:40:49 +00:00
Joey Parrish df213d8c1d Fix usage of Storage API in tests
We recently updated the Storage API to return AbortableOperation
instead of Promise.  These tests did not get updated at that time.
The runtime backward compatibility kept the tests from failing.

This was caught by a compiler upgrade.

Issue #2528

Change-Id: I05f75a5e4443b111c63d7969950777db78133626
2020-04-29 21:08:40 +00:00
Theodore Abshire 087c1ba247 Allow offline downloads to be aborted.
You can either abort downloads one at a time, using the
AbortableOperation interface, or you can implicitly abort them all at
once by destroying the storage instance.

Closes #2417
Closes #1362
Issue #1301

Change-Id: I0ba102e5bf60a063f0e2f6ecd3f135445226996f
2020-04-24 20:43:54 +00:00
Joey Parrish 023827f7f6 Fix skipping of offline tests
Some tests in test/offline/storage_integration.js would manipulate
StorageMuxer to test what happens when storage is unsupported.  The
support was overridden in beforeEach and restored in afterEach.

However, all of this was wrapped in filterDescribe, which shims
jasmine's methods to run support checks and abort those methods if the
support check fails.  This meant that the test itself could be skipped
by filterShim onec beforeEach ran.  In fact, the shim would check for
support again before running afterEach.  So the cleanup in afterEach
was also skipped, leading to all future offline tests being skipped.

This, combined with the recently-fixed test bug where tests would run
in a random order, meant that in some cases, none of the storage tests
were actually running.

With the random ordering bug fixed, we were still skipping 25 tests on
the Linux version of Chrome, 19 of which were storage tests that
shouldn't have been skipped.  With --random, we were sometimes
skipping 30-45 tests in the same environment.  With the fix, we are
always skipping exactly 6, 3 of which are disabled for everyone and 3
of which require Widevine persistent licenses not currently available
on Linux.

Change-Id: I22f76d47b89ce52997278f5fe402af056c89f4c0
2020-04-21 15:50:12 -07:00
Joey Parrish 05d1db50af Fix hung storage test
The test was blocking a network request, then letting it continue.
However, another change that landed around the same time introduced a
request cache inside Storage.  So the blocked request was cached and
shared between the test's two storage operations, leading to both
operations being blocked.

This was missed because the test order was accidentally randomized,
leading to an as-yet-unfound bug that caused this buggy storage test
to get skipped in some cases, and timeout or disconnect in others.

Fixed: 154522761

Change-Id: I657b0d4d4edb5142bd159f567e7bd2a80e1687f2
2020-04-20 17:35:09 -07:00
Joey Parrish bca35edbe5 Fix Storage integration test failures
In Change-Id If885e828b4761528e40abdbc601a11cf13849a1e, I fixed a
memory leak, but broke offline storage.

In Change-Id I88b86d250b4407cc0740d35eaf4a7ef3d5a67798, I fixed some
of the test failures, but not others.  The tests passed on Chrome on
Linux, but later failed on other platforms.  It is not clear why they
passed some of the time.

When I changed offline storage to keep the parser alive until after
the storage operation is complete, this broke some test assumptions.
For example, the tests assumed that overriding manifest parsing would
be sufficient to make the URI irrelevant.  That is not true any more,
since the parser is created earlier in the process.

This changes the Storage integration tests to always invoke the fake
parser by using its registered MIME type, rather than relying on an
override of the parsing step.

The Storage integration tests are now passing on all supported
platforms.

Change-Id: I1ec0b186516d35156c761554ec2e610f784e254d
2020-04-13 21:05:59 +00:00
Álvaro Velad Galván 2807971e4e Add creationTime to offline assets (#2406) 2020-04-10 09:58:45 -07:00