Commit Graph

198 Commits

Author SHA1 Message Date
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
Álvaro Velad Galván 57c73241a0 fix(performance): Eliminate use of ES6 generators (#4092)
See: https://github.com/shaka-project/shaka-player/issues/4062#issuecomment-1077826210

Co-authored-by: @joeyparrish

Issue #4062
2022-04-04 10:58:16 -07:00
Giorgio Gamberoni 0b04aecdd7 fix(dash): Account for bandwidth before filtering text stream (#3765)
We filter out text streams that are duplicates, before persenting
them to the end user. A duplicate is detected by checking if
various values on the streams are the same.
However, we were not checking for bandwidth. This could lead to a
text stream being marked as a duplicate if it had the same language,
label, etc as another, even if they did not contain the same text.
This changes the utility to also check bandwidth.

Closes #3724
2022-03-22 11:29:34 -07:00
Álvaro Velad Galván bdc5ea767e feat(DRM): add initData and initDataType to license requests (#4039)
Adds initData and initDataType field to all LICENSE-type requests.

Based on comments here: https://github.com/shaka-project/shaka-player/issues/4001#issuecomment-1050655197
2022-03-21 09:49:49 -07:00
Álvaro Velad Galván abe846e1a3 feat(DRM): add drmInfo to license requests (#4030)
Adds drmInfo field to all LICENSE-type requests.

Based on comments here: https://github.com/shaka-project/shaka-player/issues/4001#issuecomment-1050655197
2022-03-16 11:10:33 -07:00
Joey Parrish 1507b1e844 chore: Update URLs after moving projects (#4008) 2022-03-03 14:34:40 -08:00
Casey Occhialini f27401cc15 fix: Fix duplicate CMCD parameters in HLS live content (#3875)
Use goog.Uri to append CMCD query data to avoid duplicate query params

Fixes #3862

Co-authored-by: Dan Sparacio <daniel.sparacio@cbsinteractive.com>
2022-01-25 14:42:20 -08:00
Joey Parrish 9c818c4a47 test: Update image filtering tests
This better reflects the code landed in PR #3856

Issue #3845

Change-Id: I301f1d70c7c52454c22c6d0ee7c9d1461d7e7691
2022-01-14 20:47:20 +00:00
Casey Occhialini 922778a5eb fix: Fix CMCD top bitrate reporting (#3852)
The tb (top bitrate) property should honor bitrate/size ABR constraints and only report the top playable bitrate.

The tb property should only report the bandwidth for that segments type (audio, video, muxed).

Fix incorrect top bitrate CMCD reporting by:

Honoring the player's current bitrate/size ABR constraints.
Only reporting the bandwidth for that segments type (audio, video, muxed).

Fixes #3851

Co-authored-by: Dan Sparacio <daniel.sparacio@cbsinteractive.com>
2022-01-11 21:40:04 -08:00
Joey Parrish dfc44cbca6 fix: Fix usage of Shaka without polyfills
Revert "fix: Work around override of MediaCapabilities polyfill in Apple browsers (#3668)"

This reverts commit 31c0cd4b8c.

Fixes #3843 (usage of Shaka without polyfills)
Re-opens #3530 (MediaCapabilities polyfill not working on Safari)

Change-Id: Ib5aff1b38759e1a39200332f3f07d3d6bd3bd2e1
2022-01-11 04:02:38 +00:00
Casey Occhialini fa5932ca8f fix: Fix CMCD property mangling (#3842)
Move CMCD type definition to externs to avoid minifying property names

Co-authored-by: Dan Sparacio <daniel.sparacio@cbsinteractive.com>

Fixes #3839
2022-01-10 15:42:16 -08:00
theRealRobG 1e7f2f3dc8 Pass HDR information when getting decoding info from media capabilities (#3730)
Fixes #3729

If the video variant stream contains information about `hdr`, then we now use that to provide a value for `transferFunction`, when constructing the [`VideoConfiguration`](https://w3c.github.io/media-capabilities/#videoconfiguration) object used to get decoding info from media capabilities API.

The following applies:
```js
switch (video.hdr) {
  case 'SDR':
    mediaDecodingConfig.video.transferFunction = 'srgb';
    break;
  case 'PQ':
    mediaDecodingConfig.video.transferFunction = 'pq';
    break;
  case 'HLG':
    mediaDecodingConfig.video.transferFunction = 'hlg';
    break;
}
```
2021-11-03 14:40:41 -07:00
Casey Occhialini 221637a66c feat: Add Common Media Client Data (CMCD) logging support (#3662)
Add support for including Common Media Client Data (CMCD) in outgoing requests.

Fixes #3619

NOTE: The following fields have not been implemented: rtp, nrr, nor, dl

Co-authored-by: Dan Sparacio <daniel.sparacio@cbsinteractive.com>
2021-10-20 12:22:41 -07:00
Álvaro Velad Galván 31c0cd4b8c fix: Work around override of MediaCapabilities polyfill in Apple browsers (#3668)
See also #3696

Closes #3530
2021-10-12 10:59:06 -07:00
enson-choy 6a775e29a4 fix: Fix CC parsing of EPB and v1 TKHD boxes (#3610)
When unboxing TKHD, the reader read int64 as trackId instead of int32. Thus unable to find matching timescale when doing TFHD unboxing. Therefore when parsing MDAT, the default timescale will be used which is 90000. All CC timestamps will then be incorrect.

This also fixes "Shaka Error MEDIA.VIDEO_ERROR (3,,PIPELINE_ERROR_DECODE: Failed to parse H.264 stream)" error when playing DASH MP4 H.264 streams with CEA-608 CC embedded.  It's likely that the VDA bundled in Chromium-based browsers have already included EPB detection & prevention. If we let the player to remove the byte, VDA will complain about stream conformance.

Closes #3502
2021-09-09 09:44:45 -07:00
Álvaro Velad Galván 233c2bf4d8 Fix: Add support to file type in mediaCapabilities implementation (#3570)
If it's srcEquals, the 'type' element of the input object when querying mediaCapabilities should be 'file'. Otherwise it should be 'media-source' .
Issue: #3530
2021-08-15 23:41:19 -07:00
Joey Parrish ed1563f70d fix: Fix multiperiod without consistent thumbnails
When playing multiperiod content, we should not require thumbnails to
be present in every period.  This fixes this case and adds a
regression test.

Closes #3383

Change-Id: I4403a1b8670cffcc46de32470e2d830dc199c9f4
2021-07-12 20:45:06 +00:00
Joey Parrish 42674bee03 fix: Fix filtering of duplicate image streams
We filter out duplicate streams for all other types, so we should do
this for images, as well.

This also updates all PeriodCombiner test cases to include the
imageStreams property.

Issue #3383

Change-Id: I63355f85d4e12bd25c1cadce29a040d17c4e7d61
2021-07-12 20:45:06 +00:00
Joey Parrish 052e7943b1 fix: Fix failure with multiple thumbnails per period
Matching image streams across periods was not working correctly with
multiple streams per period.  Matching was done on MIME type only,
meaning there was no way to differentiate multiple streams.
Resolution is a better signal, so this uses the same logic as for
video resolution in thumbnail resolution matching.

This also adds extra error logs that helped track down the issue, and
fixes some comment typos.

Issue #3383

Change-Id: I067de59c222a165d58926646f53fa61862853377
2021-07-12 20:45:06 +00:00
Álvaro Velad Galván 0579ee7779 feat(CodecPreference): Improve preferredVideoCodecs & preferredAudioCodecs (#3424)
Currently a full chain comparison is done, but in video and audio codecs, you may want H.265/VP9 with no profile preference, with this change it is possible to do this.
Examples:
'hvc1' instead of 'hvc1.1.2.L123.80' and 'hvc1.1.2.L153.80'
'vp09' instead of 'vp09.00.40.08.00.02.02.02.00'
2021-05-26 10:38:26 -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
Michelle Zhuo 9a706ef90e feat(CodecPreference): Add preferred codecs config
Adding the "preferredVideoCodecs" and "preferredAudioCodecs"
configuration, so that the application can set their own preferences
when choosing a codec.

Issue: #2179
Change-Id: Ib56aec10613dda9b7dce8e465c5f1d81540c34fd
2021-05-21 18:59:04 +00:00
Michelle Zhuo 79d5fd8ca0 feat(MediaCap): Add preferredDecodingAttributes config
We'll allow users to configure the decoding attributes they prefer when
choosing codecs through the configuration. The attributes include
'smooth', 'powerEfficient' and 'bandwidth'.

For example, if the user configures the field as ['smooth',
'powerEfficient'], we'll filter the variants and keep the smooth ones
first, and if we have more than one available variants, we'll filter and
keep the power efficient variants.
After that, we choose the codecs with lowest bandwidth if we have
multiple codecs available.

Issue #1391

Change-Id: Ief3f6d8ff98fabff5ec99bb0365cdc6a36d2ab2d
2021-05-11 23:50:29 +00:00
Michelle Zhuo df1a110c19 fix(MediaCap): Fix VP9 codec unit test
Change-Id: I7d82cb3dcb01be702dcbc9084df55c8db9493b58
2021-04-29 22:51:43 +00:00
Michelle Zhuo bf0644aa4a feat(MediaCap): Patch VP9 codec
MediaCapabilities supports 'vp09...' codecs, but not 'vp9'. Translate
vp9 codec strings into 'vp09...', to allow such content to play with
mediaCapabilities enabled.

Change-Id: Iff7ddae379efb8a9f0766c89a62b85a325f81e93
2021-04-29 20:27:09 +00:00
Michelle Zhuo 95ba28b5af refactor: Remove IE 11 support
Issue #2339

Change-Id: I80ffa7b04f7afd943aa0f881d2a494dd35def732
2021-04-29 17:47:07 +00:00
Theodore Abshire c1e817d1a9 fix(util): Made |MultiMap.remove| clear empty keys
According to the output documentation, |MultiMap.get| is supposed
to return null "if no such key exists".
However, in the case that an object is added to the map and then
removed, |MultiMap.get| will return an empty array instead of null.
This inconsistency could be relevant for code that tests based on
the truthiness of the output, so this CL changes the remove method
to delete the array for a given key if it becomes empty.

This also adds unit tests for MultiMap.

Change-Id: I049fece920883e1cb10c319a3f00156be4ee011b
2021-04-13 16:09:33 -07:00
Michelle Zhuo aca343bf2c feat(MediaCap): get mediaKeySystemAccess via decodingInfo
In StreamUtils, add a MediaCapabilitiesKeySystemConfiguration
for each key system for the encrypted variant passed to the
decodingInfo API, to get the mediaKeySystemAccess as a part of
the decodingInfo results.

We create a list of mediaDecodingConfigurations for each variant,
and call decodingInfo() with each mediaDecodingConfiguration to
get the mediaKeySystemAccess.

Eventually, we'll use the mediaKeySystemAccess from the
decodingInfo results to replace the call of
navigator.requestMediaKeySystemAccess() in DrmEngine. That will be
in the next CL.

Also, adding MediaCapabilties polyfill with mediaKeysSystemAccess.

Issue #1391

Change-Id: Ied4a27dd8a1ade43209bcf07f21f0c9b31c2693c
2021-03-30 20:26:46 +00:00
Michelle Zhuo 966a756578 feat(MediaCap): Support multiplex content with MediaCap
If we have a multiplexd content with audio and video, we combine
the audio and video codecs in the manifest parser.
For example, a multiplexed stream would be with:
mimeType="video/mp4", codecs="avc1.64001e,mp4a.40.2".

When sending the request to MediaCapabilities.decodingInfo(), we
need to have the config for both audio and video to get the result
as "supported".
The video config would be:
contentType='video/mp4, codecs="avc1.64001e"'.
The audio config would be:
contentType='audio/mp4, codecs="mp4a.40.2"'.

Issue #1391

Change-Id: I74a8580c07228e9600dc40c611ebd5d34f8cd7ee
2021-03-23 23:43:01 +00:00
Michelle Zhuo 57ee23812e feat(MediaCap): Use MediaCapabilities for supporting info
In StreamUtils, use MediaCapabilities.decodingInfo() instead of
MediaSource.isTypeSupported() to check if the stream is supported.

MediaCapabilities.decodingInfo() takes an
MediaDecodingConfiguration object as input, and returns a Promise
with a MediaCapabilitiesInfo object. The returned object tells us
whether decoding the media is supported, smooth, and
powerefficient.

Steps:
1. Create a MediaDecodingConfiguration object for each variant as
   the input.
2. Query the decodingInfo API with the config.
3. Get the 'supported' info from the decodingInfo result, to know
   whether the variant is supported.

Issue #1391

Change-Id: I8fc2d3ec6a9868f38269d550d35f45c298faae98
2021-03-12 21:41:53 +00:00
Álvaro Velad Galván b9b3cc8098 feat(dash): Add support for thumbnail tracks (#3145) 2021-03-02 13:36:09 -08:00
Denis Seleznev b75cd4c38d fix: Fix codec choice when resolutions differ (#3072)
Before this change, our codec choice only worked when all codecs had the same resolutions available.

When one codec had a different set of resolutions available, we might end up choosing the wrong one.  This is because our choice was based on the average bandwidth of all resolutions for that codec.  So a "better" codec with higher resolutions available would also end up having a higher average bitrate, and would be avoided.

This fixes the issue by only considering the resolutions that all codecs have in common, then taking the average bitrate among those to choose a codec.
2021-02-24 10:43:48 -08:00
Michelle Zhuo df05d8e8a3 refactor(MediaCap): break down StreamUtils.filterManifest
Breaking the StreamUtils.filterManifest() function into four steps.

Issue #1391

Change-Id: I3badc3662bad12375e38f563af1a78437c23a737
2021-02-09 18:34:47 +00:00
Michelle Zhuo c9ac5d0fc2 fix(period flattening): Check stream codecs when filtering duplicate streams
Compare the codecs of two audio/video streams to decide whether they
are duplicate streams.

b/174040424

Change-Id: Ifde2068ddf9088f653280c013a1f3247cb7d45ba
2020-12-21 16:15:56 +00:00
Álvaro Velad Galván e5bf0277be feat: Config to prefer forced subtitles (#3022)
Closes: #2947
2020-12-17 11:21:33 -08:00
Michelle Zhuo 4238ae07b9 fix(period flattening): Check stream labels when filtering duplicate streams
Compare the labels of two audio streams to decide whether they are
duplicate streams.

Fixes #2884

Change-Id: I08b32586d26368593b0ebcf9459787461cd05c37
2020-12-15 17:46:21 +00:00
Michelle Zhuo cf6aa88ce9 fix(period flattening): Combine the streams with no roles
If two audio streams in two periods have no roles while other audio
streams have, combine those with no roles.

Fixes #2785
b/172605645

Change-Id: I8aa4189c3ddc50257e0dbd72cae4840ae1d446f1
2020-12-14 22:22:35 -08:00
Joey Parrish b105199276 fix(test): Fix test failure on IE11
One subtlety of the filterDescribe() helper in our tests is that it
does not stop the body of the describe() block from being executed.
It only suppresses the execution of the various "before/after" blocks
and the tests in it().  So the new functional unit tests on factory
functions failed on IE, since the various definitions being eval'd for
the tests were set in the describe() body.  Now they are created in
beforeAll(), which is supressed on non-ES6 platforms.

Change-Id: Ia92c7aa33a89e0217bf9a0394b43753f120ec16d
2020-11-10 00:19:53 +00:00
Joey Parrish 9ece285b92 fix: Fix compatibility for plugin factories
In v3.0, we changed our plugin interfaces so that all are factories
that return objects.  We no longer call those with "new" as we did in
v2.5.

We provided backward compatibility and a deprecation warning to alert
applications to update their usage of those interfaces.  However, this
compatibility shim was broken for ES6 classes, which behaved
differently than ES5 constructor functions.

This fixes the shim and adds regression tests.  The tests were tricky
because we use Babel to transpile our tests, but we needed raw,
untranspiled code to define a class to test these features.  So we use
eval and some associated trickery to get exactly the different kinds
of plugin registrations we intend to support.  These tests are skipped
on non-ES6 browsers.

Fixes #2958

Change-Id: Ife8b63c0d89f4ea0aff085d3a4c156c4eb657604
2020-11-03 21:58:44 +00:00
michellezhuo 0eb3b620d3 build: add goog.require for compiler upgrade (Part 5)
Change-Id: I7c001f1c6d68a994342c1184e394f4643fd56ac9
2020-10-16 00:10:07 +00:00
Jacob Trimble f7aacf151c fix(periods): Ignore streams with period-specific codecs
Fixes #2883

Change-Id: Ib9ccc4e7c144e69c264f6dc24fc0cd3397950e07
2020-10-06 22:24:44 +00:00
Vincent Valot 54d48e1a46 feat: deduplicate text streams in period flattening (#2885)
Similar to what was already done for audio streams.
2020-10-01 08:51:05 -07:00
Theodore Abshire a72a1e9102 feat(text): Switch to using TextDecoder for UTF8
Previously, to decode UTF8 content, we used the browser's
decodeUriComponent method.  This worked in most situations, but it
would stop and error the moment it found an invalid UTF8 character.
This meant that a single poorly-encoded character inside a text stream
would cause the entire closed captions to fail to display.
In this CL, we switch to using the newer TextDecoder API, which
will instead replace invalid characters with an "unknown character"
code point, and continue parsing. This should make our text parsers
more robust when faced with bad encoding.

Closes #2816

Change-Id: Ibf2887e143d24d15a127bbcf2961539669580eea
2020-09-09 13:49:28 -07:00
ismena 11ee823b0c fix(period flattening): Ensure the number of variants stays stable when new periods are added.
Our period flattening logic used to keep creating new streams and variants
when encountering a certain type of content (same main content and slightly differing
sequence of ads). In time, this led to a performance drain, where more and more time
was spent processing the variants, leading to all kinds of delays.
This is the last change in the series, addressing the way we set stream properties
when concatinating streams.

Fixes #2716.
Fixes #2736.

Change-Id: I98ae692797d19344601d7a0c51d1e343dfe55e01
2020-08-10 22:43:02 +00:00
ismena 4781129571 fix(period flattening): fix attribute comparison in the period flattening logic.
Issue #2716.

Change-Id: I8931dc31d0208ad9cfa25c9d87fcf3cbf550f423
2020-08-07 14:50:33 -07:00
ismena 49dd504f7f fix: Filter out duplicate streams on period flattening.
Issue #2716

Change-Id: Ib48cab9e84c5ccbca9b7e54531bc11d0b8b9af13
2020-08-05 18:00:23 +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 810f09ff1e fix(DASH): fix failure with identical text streams
The period-flattening algorithm is run even on single-period content
if the manifest is dynamic, because we don't know if another period
will be added later.

As a failsafe, we should create one output per input for single-period
content, and we can ensure that no streams are unused by marking an
input stream as the "best match" for an output if they share the same
ID.  That way, even if all other characteristics for two inputs are
the same, the input-to-output mapping for single-period content will
always be sane.

That ID-based logic was missing for text streams.  This change
corrects that.

Closes #2646

Change-Id: I28c6c63d92bcf710ae0072783911f9e66ed78228
2020-06-17 16:12:00 +00:00
Muhammad Haris e8f24ece6f Created MP4 Box parsers to parse data for common box types (#2649)
Issue #2648
2020-06-15 17:35:38 -07:00