Commit Graph

133 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 1507b1e844 chore: Update URLs after moving projects (#4008) 2022-03-03 14:34:40 -08:00
Joey Parrish f1c1585afb fix: Add explicit release() for FakeEventTarget (#3950)
Before, we would count on all event listeners for FakeEventTargets to
be cleaned up by the object that listens.  Now, FakeEventTarget
implements IReleasable, so that all listeners are removed when owners
call release().

For objects extending FakeEventTarget and also implementing
IDestroyable, the destroy() methods will call out to super.release()
to clean up listeners then.  The owner should use destroy() in those
cases.

Issue #3949 (memory leak in DASH live streams with inband EventStream)
2022-02-15 12:06:26 -08:00
Theodore Abshire dd3748d599 fix: Enforce string-format of event data keys.
Previously, many events were being defined with a data dictionary
that used variable-type keys (e.g. {key: value}). This worked fine
in uncompiled mode, but in compiled mode it lead to those properties
being obfuscated.
This changes the FakeEvent constructor to take a map rather than an
object, so the compiler will force the keys to be strings.

Closes #3710

Change-Id: I67b1a391540a5ee21f0aaf940ae054d26f4c10a4
2021-10-25 12:40:32 -07:00
Aidan Ridley 16c1810b03 Feat(player): Add updateStartTime method to play (#3491)
This provides a way to decide on a start time after the manifestparsed event,
but before the load process ends.
2021-08-09 18:11:25 -07:00
Álvaro Velad Galván 84b9a89f04 feat: Add goToLive method (#3527) 2021-07-14 08:35:27 -07:00
Álvaro Velad Galván 160e36be46 feat: Add chapters support (#2972)
Add the following methods:
 - addChaptersTrack
 - getChapters
 - getChaptersTracks

The following formats are supported: WebVTT and SRT
2021-06-22 14:50:09 -07:00
ismena 1125184bfe feat: Add public access to more drm members.
Change-Id: I41d1916b583cf20038633b77f4a78f9b672e9972
2021-06-07 20:04:14 +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
Joey Parrish 0a62396ae4 fix: Fix new method missing from cast proxy
PR #3392
Issue #3389

Change-Id: I425ccf7036416c185be141a181fabd26aa92e41e
2021-05-11 13:55:17 -07:00
Álvaro Velad Galván 463b1b6886 Remove support for IE 11 (#3309)
Issue #2339
2021-04-16 13:59:35 -07: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
Joey Parrish ecbeae0ecb fix: Avoid setting global Cast hook
For applications that want to handle Cast on their own, we should
avoid setting the global Cast hook.  Now it will only be set if the UI
is configured with a Cast receiver ID or if the application uses
CastProxy explicitly (with or without the UI).

If an application tried to use our Cast features after installing
their own hook, but before the Cast SDK is ready, we will now issue a
warning to alert the application developer of the issue.

Closes #3167

Change-Id: Ic3f57ff257652c057f8322811c8db1d5ad3a8463
2021-02-26 22:12:43 +00:00
Jacob Trimble a6078bf9f6 feat(player): Add getKeyStatuses to Player.
This will help in debugging so apps can know which keys are know and
which may be missing.

Change-Id: Ice932718da870de3573ce424e030ecd8095d1efe
2021-02-24 20:32:25 +00:00
ismena 6addf76c16 test: decrease the frequency of updates for some cast methods.
This should help with the recent test failures.

Change-Id: I605e96917fe5c22eba98bc4cea81358d8b78992e
2021-02-23 14:37:05 -08:00
Joey Parrish 7544670ee5 chore: Upgrade eslint
The new eslint found many style errors which have now been corrected.

It also complains a lot about atomic update issues that do not seem to
exist, so that rule has been disabled.

This upgrade will allow us to adopt eslint's "id-denylist" instead of
the older "id-blacklist" rule, the name of which violates new Google
guidelines about respectful language.

Bug: 178203011

Change-Id: Ia65581b96e4dd1331f720fa396183dca020b9caf
2021-02-01 23:36:12 +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
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 f86e7208ee style: Re-enable the prefer-spread eslint rule
The prefer-spread rule to prevent use of apply() was disabled, but we
had another custom rule that also prevented the use of apply().  This
re-enables the standard rule.

Issue #2639

Change-Id: Ic3778d7267deb6cd5ed49282ea43bb84ad076060
2020-06-15 23:53:39 +00: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 0df39c62b6 Add content metadata methods to CastReceiver
This change adds the following methods on CastReceiver:
 - setContentMetadata(metadata)
 - clearContentMetadata()
 - setContentTitle(title)
 - setContentImage(imageUrl)
 - setContentArtist(artist)

These should be called from the CastReceiver's app data callback.

The title, image, and artist methods cover all the Cast content
metadata fields that have an effect in the Google Home App as of June
2020, and setContentMetadata can be used to set one of several object
formats with many more fields defined in the Cast SDK docs.

See https://developers.google.com/cast/docs/reference/messages and the
definitions of GenericMediaMetadata, MovieMediaMetadata,
TvShowMediaMetadata, and MusicTrackMediaMetadata for details.

This also uses these methods from our cast receiver demo, so our demo
will now set all possible metadata when casting our content library.

Closes #2606

Change-Id: I6386276449dbddd2501cd6e3e52206f7fb30b8fd
2020-06-04 20:59:08 +00:00
Joey Parrish 732b6895f1 Report support for all commands in cast receiver
There is not a separate message for skip forward or skip backward, and
we already support seek.  So there's no obvious reason to claim we
can't support skip forward and skip backward.

Related to #2606

Change-Id: If9a931afa2d6a0d323b561ed9f6500f79fb0d1bd
2020-06-02 19:57:34 -07:00
Joey Parrish b3996ad98b Slight improvement to media info messaging in Cast
The docs for the Cast messages say that duration is optional, so it
seems better to omit it for live content, rather than send back an
absurdly-large number.

Note that this does not seem to affect seeking in live streams.
Seeking in live streams seems to be disallowed by the Google Home app
either way.

Related to #2606

Change-Id: Id7d3911b410489b56643afaaee12102b5d6929a1
2020-06-02 19:57:34 -07:00
Joey Parrish 8c3775ce5e Fix Google Home app scrubber for casted VOD
When we get a GET_STATUS request, we are supposed to send back media
info.  That field is only optional for other requests.

This fixes the scrubber in the Google Home app for VOD content.

Issue #2606

Change-Id: Iceec95f18cf15325b7ee2350a0f30f31edc90560
2020-06-03 00:42:25 +00:00
Joey Parrish c8942ba250 Minor cleanup in cast_receiver.js
Set default value for requestId, to make the call sites look cleaner.

Related to #2606

Change-Id: Ia3527b0bba4395f0f49a354c7002b96dfa57ffc1
2020-06-03 00:42:25 +00:00
michellezhuo e74dfde811 Revert "Fix playback rate display in UI"
This reverts commit 604a33d7b9.
Instead of adding another another getter method, we can change the
current behavior of the existing getPlaybackRate() function.

Reopens #2526.

Change-Id: Ic8e60220191ef89fbb2fb242aa7b8263e0409c4b
2020-05-06 15:19:00 -07:00
michellezhuo 604a33d7b9 Fix playback rate display in UI
1. When the video hasn't started playing and is buffering, display
playback rate as 1x.
2. When the video is buffering and the playback rate gets updated,
display the newly selected playback rate.

Closes #2526.

Change-Id: Idf074e402ef8fdd2905dee84dcd5f084f217342e
2020-05-06 19:17:56 +00:00
michellezhuo 562168a1f6 Set UITextDisplayer as TextDisplayFactory in default config
In player, SimpleTextDisplayer was set as the default TextDisplayer. In
our UI, it changes the configuration to use the UITextDisplayer, and
UITextDisplayer gets constructed with the player. Later in our demo, it
resets the config, so an extra SimpleTextDisplayer gets constructed.
This introduces an extra TextTrack created by SimpleTextDisplayer.

This change sets the UITextDisplayer as the default TextDisplayer in
player's default config.

Closes #2516

Change-Id: I3f653be9fad8b2edbc2fb9de84e8abb327dcfc51
2020-05-04 20:40:18 -07:00
Joey Parrish 4dc2c65578 Add type assertions for Errors
In many places, we check error codes on shaka.util.Error.  But the
compiler doesn't know that what is caught in "catch" is that type, so
we add type assertions.

In some cases, we know that other types may also be thrown, so there
are also some runtime checks.  Some of these had to be refactored to
allow the compiler to correctly infer types.

Change-Id: I053bd7e96213c689aae3889315052dd402124690
2020-04-29 10:11:21 -07:00
Joey Parrish ea3ff2bf6a Quote property access in CastProxy
When CastProxy refers to a proxy object, the type is necessarily
merely "Object".  This isn't specific enough for the compiler to check
access to this.videoProxy_.paused, so we convert this to use square
brackets.

Issue #2528

Change-Id: Ic51fa9fdd20b8ac494fea1e844a945fba319f3c8
2020-04-28 21:40:42 +00:00
Joey Parrish f0caf4067c Fix serialization of Error objects over Cast
When the Cast receiver throws an Error or rejects a Promise with a
non-Shaka Error, we need to represent it to the sender in a reasonable
way.  Otherwise, it can be very difficult to debug.

Related to the investigation of #2487

Change-Id: Ia58dd1e1e56ee93bea9afc9d368084d53c381db3
2020-04-17 21:41:01 +00:00
Joey Parrish 2f6ed0eb77 Recover from timed-out Cast connection
When a mobile device goes idle, the Cast connection can be terminated
without explicitly closing it.  When this happens, the Cast session is
unusable and throws exceptions.

This changes CastSender to correctly detect and recover from such a
problem by disconnecting explicitly and dispatching an Error to the
application.

This also fixes the disconnection process so that playback can be
correctly resumed on the local device.

Closes #2446

Change-Id: I59f51a1e911199eee22693e7db4ab39855de0298
2020-04-13 18:30:43 +00:00
Jacob Trimble 3fa7472086 Add non-nullable modifier to return types.
This is a copy of the internal CL: cr/299901617.

Change-Id: I49abbde9563f08819ec99dbc9deb99b66dd8053b
2020-03-11 15:46:06 -07:00
Jacob Trimble c49f24b31b Remove remaining deprecated features for v2.6.
Change-Id: I2199e3c960fe6319eb9ab342291dfd9a62d9090e
2020-02-24 15:57:05 -08:00
Theodore Abshire 8e69a011fa Fix bug with changing cast app id to empty string
If that method was called with an app id that was an empty
string, it would destroy the cast receiver, and then not make a
new one.
This lead to the ChromeCast callbacks all pointing to a destroyed
cast sender, which would then spew out errors whenever session
availability changed.
Normally, changing the app id to empty string doesn't make sense,
but it can happen if someone configures the UI thoughtlessly.
This changes the API callbacks provided to be static, and only
forward the calls to live senders.

Change-Id: I88593532791b3448be3ebdf7ef4df4d38c1bc6e4
2020-02-13 20:40:55 +00:00
Theodore Abshire 78756198dd Add enum for player event names.
By having an explicit enum, we can make sure there are no typos in
FakeEvent creation calls. This change also allows the cast proxy and
receiver to proxy events based entirely on the enum; that way, they
do not need to maintain their own independent list of events, that
can potentially fall out of sync (see #2318).

Change-Id: I08fa6653f35d86e87efda7fc822c8988688cfcff
2020-01-07 21:35:23 +00:00
Jacob Trimble 011749e95f Standardize argument comments.
This changes the eslint rule to enforce a strict pattern for the
argument comments.  The comment must appear before the argument and
must be /* foo= */.  This still ignores line comments.

Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
2020-01-06 19:40:52 +00:00
Joey Parrish 26583c5787 Add missing events to CastProxy Player
There were several events missing from the proxied event list.  This
adds all of them.

Closes #2318

Change-Id: Iaba752adcf8dbe1c1a9f28bfe36fd3084221bb98
2020-01-03 10:53:52 -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
Sandra Lokshina a70676826a Add a method to select variants by label.
This also addresses an old TODO about switching
variants and text separately.

Closes #924.

Change-Id: I46644ca04dfc8b36696696078c4f14ee15774356
2019-11-07 18:31:41 +00:00
Sandra Lokshina 7afac89bc2 Restructure AdManager to be owned by Player, not UI.
This will allow Ad functionality to be available for apps
with custom UI.

Change-Id: I3911cb6d764b7aef94166b5f6de3a0a7fa8bb8d9
2019-10-18 18:42:13 +00:00
Sandra Lokshina 1e746e6551 Keep a mapping of compiled to extern player method names in cast proxy.
In compiled mode, UI calls player methods by their compiled, renamed names.
The proxy object doesn't know those, so an error used to be thrown while
casting in compiled mode. This change adds a map from compiled to extern
names that cast proxy can use.
It also cleans up proxy code a bit and points the demo to the nightly
build of cast receiver.

Closes #2130.

Change-Id: I39b83c6a1e050a68d70e7923d1a07ad8929daeeb
2019-09-11 11:20:30 -07:00
Jacob Trimble 18b59c5294 Disallow using new Uint8Array with BufferSource.
Using "new Uint8Array" with a TypedArray creates a copy of the buffer;
this is unnecessarily expensive for large buffers.  This adds a rule
to disallow using it in favor of a new utility that correctly creates
a new "view" on the same buffer.

Note it is fine to pass an ArrayBuffer to "new Uint8Array" and it won't
copy; but there there are many cases where the type is BufferSource,
so it could be a TypedArray.  Unfortunately, there are many other cases
where we explicitly pass an ArrayBuffer; but the compiler rules don't
allow us to whitelist this case (since ArrayBuffer is part of
BufferSource).

Change-Id: I58696a85a9cbcc188c0b16919c9eeb63e56edca1
2019-08-21 20:40:59 +00:00
Sandra Lokshina 5aefcc7fc1 Clear up the fix for enabling Chromecast.
Change-Id: Ib39f1d7a73890e5174724f05cb0d2ba465a470e6
2019-07-17 19:58:20 +00:00
Jacob Trimble 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00
Jacob Trimble e2fa4626b5 Decrease time it takes to run tests.
- Reduce times for "short delays".
- Remove backoff delay from networking tests.
- Avoid hard-coding delays in the library.
- Move Storage tests to integration tests since they use indexedDB (and
  take over 200ms each to run).

This reduces the time it takes to run unit tests (with --quick) from
50 seconds to about 6 seconds.  Now all but one unit test finish <100ms.

Change-Id: I88461472a87c4cf750a36d07d07422818e069a4d
2019-06-12 20:53:08 +00:00
Joey Parrish 44d5ec18b7 Fix reading customData from standard Cast LOAD message
In my previous fix, I misread the Cast SDK docs and read this field
from the wrong part of the message.  I did not (and still do not) have
any way to test this feature request from @bojant987.  My mistake was
pointed out to me in this comment:

https://github.com/google/shaka-player/commit/bc91f6c9#r33913938

Closes #1989

Change-Id: I97bff23faae897e08fc270a7aa694ddf48076080
2019-06-12 09:35:45 -07:00
Joey Parrish bc91f6c966 Fix ignored customData from standard Cast LOAD message
Closes #1989

Change-Id: Ifac4874d0fb6a8f2b3aa471a7e81357ff8361284
2019-06-11 19:41:31 +00:00
Jacob Trimble 3da809019b Enable additional ES6 linter rules.
Change-Id: I6861541b27153ba034364a5972a9b086de581cef
2019-06-11 18:35:09 +00:00