Commit Graph

172 Commits

Author SHA1 Message Date
Álvaro Velad Galván 6102060028 fix: Fix transmuxer when sample has no video data (#5933)
Fixes https://github.com/shaka-project/shaka-player/issues/5931
2023-11-27 10:28:14 +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 88e4cd4116 feat: Add thumbnails support in src= (#5802)
Closes https://github.com/shaka-project/shaka-player/issues/5778
2023-10-26 07:54:17 +02:00
Álvaro Velad Galván cf5a72bb51 feat(Ads): Add support for AWS Elemental MediaTailor (#5679) 2023-09-28 09:55:26 +02:00
Álvaro Velad Galván 96ae7f2fe6 feat(DASH): Add support for AES-128 (#5656)
Closes https://github.com/shaka-project/shaka-player/issues/5622
2023-09-16 07:34:42 +02:00
Álvaro Velad Galván 3c76f62dbe chore: Rename HLS_AES_128_* to AES_128_* (#5654)
This change is required in preparation for
https://github.com/shaka-project/shaka-player/issues/5622
2023-09-13 20:52:16 +02:00
Joey Parrish a19912e5bf fix: Fix compiled-mode error formatting (#5623)
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.
2023-09-08 13:30:04 -07:00
Cristian Atehortua 7d049eb8cb feat: Include stack trace in errors dispatched from production builds (#5407)
Fixes #5406
2023-07-19 11:44:41 -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
Álvaro Velad Galván f80bf208b1 feat(MSS): Add support for Microsoft Smooth Streaming (VOD only) (#5002)
Closes https://github.com/shaka-project/shaka-player/issues/703

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-03-24 07:47:33 +01:00
Tiago Lopes 67a245129f feat(logs): Add extra logging for 3015 errors (#4932)
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`
2023-01-27 16:30:21 -08:00
Álvaro Velad Galván 61613cf0ee feat: Config to require a minimum HDCP version (#4883)
https://github.com/WICG/hdcp-detection/blob/main/explainer.md

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2023-01-11 21:04:16 +01: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
Álvaro Velad Galván 3582f0a727 feat: Add external thumbnails support (#4497)
JW spec:
https://docs.jwplayer.com/platform/docs/vdh-add-preview-thumbnails

Video.js implementation:
https://github.com/chrisboustead/videojs-vtt-thumbnails

Note: thumbnails with sprites are not supported yet.
2022-09-30 22:25:05 +02:00
Joey Parrish 91003d3170 chore: Clean up unused AES-128 failure paths (#4450)
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.
2022-08-29 12:15:29 -07:00
theodab 3a0e40ee04 chore(HLS): Retired unused error code (#4428)
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
2022-08-19 20:59:13 -07:00
theodab 6194021a3d feat(hls): Support AES-128 in HLS (#4386)
Expands on the original PR (#3880) by adding support for MP4 and key rotation.

Close #850

Co-authored-by: wjywbs <wjywbs@users.noreply.github.com>
2022-08-12 10:50:32 -07:00
Álvaro Velad Galván 5441f932fd feat: Add support for Modern EME and legacy Apple Media Keys for FairPlay (#4309) 2022-06-29 07:13:53 +02:00
Joey Parrish 80e81f1391 fix: Wait for chapters track to be loaded (#4228)
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
2022-05-16 16:10:44 -07:00
Álvaro Velad Galván 14e61a7368 feat(hls): Add support for EXT-X-GAP (#4208)
Related to 42eecc84
Closes #1308
2022-05-10 13:19:46 -07:00
Álvaro Velad Galván 8bb70449d3 feat!: Remove support for Safari 12 and iOS 12 (#4112)
1. Remove support for Safari 12
2. Support modern EME in Safari 13
3. Remove EME Apple polyfill
4. Update documentation
2022-04-11 16:17:51 -07:00
theodab 48dd20562c fix(hls): Support playing media playlists directly (#4080)
Closes #3536
2022-03-30 17:27:50 -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
Vincent Valot 6d76a135e5 feat: add modern EME support for FairPlay (#3776)
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.
2022-02-07 11:17:22 -08: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
Jacob Trimble f16e0265d8 docs: Update PlayReady error links
This site has an easy search function for all Microsoft error codes,
which is better than the two other links.

Change-Id: I4a2d67e3412c43200e38b7abf3086b6b14de778b
2021-06-01 20:41:16 +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 95ba28b5af refactor: Remove IE 11 support
Issue #2339

Change-Id: I80ffa7b04f7afd943aa0f881d2a494dd35def732
2021-04-29 17:47:07 +00:00
Suraj kumar (sk) 77140991f1 fix(hls): Assume MP4 if MIME type can't be deduced (#3325)
Fixes #3142
2021-04-13 13:56:02 -07:00
Álvaro Velad Galván 54b8f6eaee feat: Add downloadSizeCallback before storing offline (#3049)
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 .
2021-02-01 11:45:19 -08:00
Joey Parrish d0da2d49e1 fix: Fix mixed clear/encrypted content on Xbox & Tizen
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
2021-01-21 18:10:02 +00:00
michellezhuo 7e4280fab4 fix: TTML clean up
1. Add support for multiple layers of nested cues.
2. Add support for anonymous span.

Closes #2623
Closes #2761

Change-Id: I10a253b1a965606fc2db49c3168e92bcf4a95fa1
2020-11-04 00:37:04 +00:00
Álvaro Velad Galván faa1e52902 feat(text): Add addTextTrackAsync (#2932)
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.
2020-10-22 09:32:06 -07:00
Álvaro Velad Galván 919e3efe94 fix(text): Add error codes to addTextTrack errors (#2930)
Add new error codes for addTextTrack:
 - CONTENT_NOT_LOADED
 - TEXT_ONLY_WEBVTT_SRC_EQUALS
 - CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS
2020-10-21 10:34:40 -07:00
Álvaro Velad Galván 840aae408d Add SubRip (SRT) subtitle support (#2872)
SRT can be trivially converted into WebVTT, so the SRT parser delegates to the VTT parser.
2020-10-01 09:52:43 -07:00
Joey Parrish 5a0383585f fix: Fix data URI parsing when charset present
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
2020-08-04 21:48:12 +00:00
Muhammad Haris 480d4a801a Parse CEA-708 Packets from Fragmented MP4 streams. (#2660)
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
2020-07-05 16:29:17 -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 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
Álvaro Velad Galván e246855c63 Add variable substitution support to HLS parser (#2509)
Resolves #1561
2020-04-24 12:37:11 -07:00
Theodore Abshire a2a988d876 Allow for multiple concurrent storage operations.
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 #1432
Closes #2432

Change-Id: I51018e170fb9ab262b5c70125a03d979c8ccfb08
2020-04-10 04:33:11 +00:00
Joey Parrish e24fec4b08 Flatten periods
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
2020-04-09 19:22:16 +00:00
Joey Parrish 99de217c23 Remove periods from manifest structure
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
2020-04-09 19:22:16 +00:00
Sandra Lokshina f4a2b858d7 Refactor player out of SS ad manager.
Issue #2367

This also accidently fixes showing seek bar on ad end for
SS content.

Change-Id: I52241df9861f27d50976f0ce7309c7c14092463a
2020-03-26 17:13:26 +00:00
Álvaro Velad Galván 697a6ff785 Add initial DAI support (#2382)
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.
2020-02-18 14:11:51 -08:00
Jacob Trimble 59b47651ca Add some documentation/links for Error.
This adds some links to where users can find error codes for some of
the browser errors that can happen.

Change-Id: I8ce94307159afb2df9e06813b07593920dcbac1e
2020-02-13 21:59:23 +00:00
Álvaro Velad Galván 32e81c0e79 IMA: disambig between CS and DAI (#2375)
IMA has two separate SDKs for CS and SS ad insertion.
This PR makes sure people don't try to init CS ads when they only have SS SDK
included.
2020-02-06 10:40:35 -08:00
Joey Parrish 1ee32849e4 Fix skipping of raw format streams in HLS
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
2020-01-17 12:28:08 -08: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