We declare shaka.util.Error to extend the native Error, but only supplied a message field in uncompiled and debug modes. This broke the Jasmine test framework when it tried to extract error message information from a compiled-mode shaka.util.Error object.
Now we always supply a message object, and merely skip the fancy enum formatting in compiled mode.
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
This adds extra context to 3015 (MEDIA_SOURCE_OPERATION_THREW) errors, by attaching
the error on the media element. This is helpful because, in some situations, media source operations
can have very unhelpful exception strings like:
`Error: Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null`
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.
Now that we support AES-128, some older AES-128 code paths in the HLS
parser have become obsolete. This cleans up those unneeded code paths
and adds a test to ensure that the correct failure handling is used
when AES-128 cannot be supported by the platform.
Now that #2337 has been implemented, the error code HLS_INTERNAL_SKIP_STREAM
is no longer used anywhere in the code.
This retires that error, and also cleans up the code that previously
was responsible for handling that error being fired.
Pre-work for #1936
addChaptersTrack() was already an async method, but it did not wait
for the chapter data to be loaded by the browser. The solution is to
wait for the `load` event on the `<track>` element we create.
To accomplish this, some cleanup and refactoring was done in how
tracks are managed. Summary of changes:
- The `addtrack` event, which triggered management of tracks in src=
playback, is now used for all types of playback. In src= mode, it
manages all tracks, and in MSE mode, it only manages chapters
tracks (which are added to the video element as in src= mode).
- `processChaptersTrack_()` has been renamed to
`activateChaptersTrack_()`, since its only job is to set the
track's mode field to make the browser load it.
- `activateChaptersTrack_()` is now only ever called via the
`addtrack` event.
- `activateChaptersTrack_()` no longer loops over all chapter tracks
on a timer, and instead only touches the single track it was
called for.
- `addSrcTrackElement_()` now returns the HTML `<track>` element it
creates.
- `addChaptersTrack()` now awaits a `load` or `error` event to
complete (or fail) the operation.
- Existing tests for addChaptersTrack had long delays to work around
this issue; these delays have simply been removed.
Fixes#4186
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
Add support for HLS com.apple.streamingkeydelivery through MSE/EME implementation.
Close#3346
## Tests
Tested on:
- Mac 11.6 Safari 15.2
- iOS 15.2 Safari 15.2
- Mac 11.6 Chrome 96 (for potential regressions on Widevine keySystem)
| Mode | DRM API | TS | CMAF (mono-key and multi-keys)
|---|---|---|---|
| file | EME | ✅ | ✅ |
| file | Legacy-prefixed | ✅ | ✅ |
| media-source | EME | **mux-js**: `encrypted` never fired<br />**real MSE**: `encrypted` event received, but with incorrect `sinf` initData (*1) | ✅ |
| media-source | Legacy-prefixed | **mux-js**: `webkitneedkey` never fired<br/>**real MSE**: TBD | 🔴 fails to append media segment to SourceBuffer (init segment ok) `(video:4) – "failed fetch and append: code=3015"` |
## Support table
| Mode | DRM API | TS | CMAF (mono-key and multi-keys)
|---|---|---|---|
| file | EME | ✅ | ✅ |
| file | Legacy-prefixed | ✅ | ✅ |
| media-source | EME | 🚫 `4040: HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED` | ✅ |
| media-source | Legacy-prefixed | 🚫 `4041: HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED` |🚫 `4041: HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED` |
⚠️ Use EME APIs with multi-keys CMAF makes the video stalling with the audio continuing alone after a short time (~3 minutes in the stream, could be shorter, could be longer). Didn't find an explanation to that yet. I've observed the same behaviour with hls.js code so I don't think this is a player issue.
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
This site has an easy search function for all Microsoft error codes,
which is better than the two other links.
Change-Id: I4a2d67e3412c43200e38b7abf3086b6b14de778b
When downloading content for storage, it's useful to know how much storage space
will be needed before storing. This is extremely important for mobile devices
that have limited space. See google/shaka-player-embedded#167.
Use the info in the manifest and make HEAD requests to determine the
size of the content we're downloading.
Add a downloadSizeCallback that will be called with the size once we know it.
The callback determine if the content can be downloaded due to its estimated
size.
Closes#3049 .
Some platforms seem to ignore EME if the first init segment appended
at the MSE level does not indicate encryption. To work around this,
we will detect such platforms, and if EME is set up, we will insert
fake encryption metadata into the init segment to convince the
platform to be ready to decrypt.
Closes#2759
Change-Id: Iccf6b8589cf9265ac9bef0d083f4a72f6f2dd628
1. Add support for multiple layers of nested cues.
2. Add support for anonymous span.
Closes#2623Closes#2761
Change-Id: I10a253b1a965606fc2db49c3168e92bcf4a95fa1
This new method can make a HEAD request to the server to determine the MIME type. The old method (addTextTrack) is now deprecated and will be removed in v4.
Data URIs can have additional parameters other than just the MIME type
and encoding. While working on TTML fixes, I was debugging by
inserting data URIs as TTML text tracks. But the data URI encoder I
used was inserting a "charset" parameter into the URI, which was
rejected by Shaka Player.
This fixes the data URI parser to understand these extra parameters.
While researching this fix, I also found that only the base64 encoding
is specified for data URIs. So now only that specific parameter is
supported as an encoding, and the UNKNOWN_DATA_URI_ENCODING error code
has been retired.
Change-Id: I7022529b0931e80a77a1120fc86c25b42e1fb3d9
This is an MP4 Parser which extracts CEA-708 packets from Fragmented MP4 streams.
The Closed Caption Parser (shaka.media.ClosedCaptionParser) will own this MP4 Parser, and will initialize it and call it as shown. As data comes in, the parser will parse this data, and the caption packets data then be returned in a callback (on708Data), as shown. Here, a theoretical decoder (future pull request, mentioned as a Todo comment) will decode and extract the parsed captions from these packets.
Issue #2648
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
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
In the process, this removes the in-progress flag, which should fix
issues where the storage instance can't be re-used after an error.
Closes#1432Closes#2432
Change-Id: I51018e170fb9ab262b5c70125a03d979c8ccfb08
This creates a new utility used by DashParser and old offline DB
formats to combine Streams across Periods. This allows multi-Period
DASH content to be played without period-specific structures in the
manifest format, StreamingEngine, or Player. This also makes the
Tracks stable across Periods.
Closes#1339 (flatten periods)
Closes#1698 (rapid period transitions issue)
Closes#856 (audio change causes bitrate change)
Change-Id: Icb04c8e47e36eacf7ac024a5063130d85a115e54
This removes periods from the internal manifest structure and cleans
up code and tests accordingly. This leaves us unable to play
multi-period DASH & offline streams until the main period-flattening
algorithm is completed in shaka.util.Periods.
Three test cases have been disabled for the moment.
Multi-period playback will be restored in a smaller, more focused
follow-up commit, with disabled tests re-enabled.
Issue #1339 (flatten periods)
Issue #1698 (rapid period transitions issue)
Issue #856 (audio change causes bitrate change)
Closes#892 (refactor StreamingEngine)
Change-Id: I0cbf3b56bfdb51add15229df323b902f0b2e643a
This PR ads initial logic to enable support for IMA DAI streams.
Ad-containing streams can now be requested from the IMA stream manager and played.
Integration with the ad UI will follow in a separate CL.
This adds some links to where users can find error codes for some of
the browser errors that can happen.
Change-Id: I8ce94307159afb2df9e06813b07593920dcbac1e
Raw, containerless streams can't be played yet (#2337), but our logic
for skipping or rejecting them was broken. This broken logic affected
the whole v2.5.x series of releases up to and including v2.5.8.
This fixes the logic and improves it in several ways:
- Skip streams that can't be played, instead of rejecting the whole
master playlist
- Handle raw AC3 and EC3, in addition to MP3 and AAC
- Handle and skip WebM+HLS in the same way
- Add the playlist and segment URLs to
HLS_COULD_NOT_PARSE_SEGMENT_START_TIME errors
This allows us to re-enable the Apple HLS+TS asset as video-only.
Change-Id: Ia00857d87b085aa7e2b810b0b949993cebabe4ba
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