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
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
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
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
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
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
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
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.
Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
This is an automated change to convert use of "function" functions
to arrow functions. This doesn't change all uses of bind() that
could be converted. This also doesn't remove all "function" functions.
Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
A coming update to the Google eslint config will require using "const"
over "let". This makes that one change to isolate the big changes.
Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
This is a complete replacement for the old demo page, made to be more
modern-looking and easier to maintain. It contains new features such as
remembering the URIs you provide for custom assets, and searching through
the default assets by feature.
This demo page is not quite ready for release yet, but it's getting close.
Change-Id: Iad01d1fc02c3cd238d73b9b9e02dbb4301cb6f2a
This event was added just for the sake of the UI tests, but the video
element's canplaythrough event works in its place.
Change-Id: I6774fdfdfbd2b197cc93eae743829510b61bb0fa
Add a new function called getLoadMode that returns the current load mode
The possible responses are:
DESTROYED, NOT_LOADED, MEDIA_SOURCE and SRC_EQUALS
This function is necessary for #1003 because AirPlay only works with SRC_EQUALS mode,
and the AirPlay events fire even in MEDIA_SOURCE mode.
Add event to notify listeners when abr is being enabled/disabled.
The resolutions menu is listening for variantchanged events to
update itself. It's possible, however, that just enabled abr
will pick the same variant that's currently being played, in
which case, there'll be no variantchanged event. The resolution,
though, still needs to update to reflect the fact that 'Auto'
resolution is selected now and not a specific one.
Adding an event for when the abr state changes helps solve
this.
Fixes b/131099397
Change-Id: I63b218d7423cd0d389dd540c5ed05966e00b861c
Add an event for when the app can safely switch streams without
the request being deferred. This is needed by the UI integration
tests to know when it's safe for them to start.
Change-Id: I49d0ae948fd350d342e6315e0dd62243b92be736
Using JSON.stringify and JSON.parse turns Uint8Arrays into generic
objects, but we need them to be actually be Uint8Arrays.
This adds a special case to CastUtil.serialize and CastUtils.deserialize
to preserve the object type of Uint8Arrays.
Closes#1716
Change-Id: I370711c016c5d5ba21cdbccb3d970c6e074a3edd
Refactor the closed captions support for HLS, using the same approach as
the closed captions support for Dash.
If closed captions are signaled in the manifest, player will create a
text stream for to represent the closed captions, and text engine will
store and append them. We don't need to set 'useEmbeddedText' value for
closed captions any longer.
Issue #1404
Change-Id: I9a5bf4df7e29d6e6982f29fd5e2df07bc78071d7
This fixes typos ("getManiestUri" and "depreciated") and puts more
concise comments around the deprecation of getManifestUri and the
handling of it in CastProxy/CastUtils.
Initially, I thought we had broken compatibility. These fixes make
it clearer that we have not done so.
Change-Id: I0d2ace66a5753475b82d9e042e764d955bb23ae9
Even a small drmInfo() serializes to 1kB, and it's not that useful.
Stop proxying these so that our messages stay reasonable in size
(< 5kB for a full update).
Change-Id: Iea6db214fe06a6bcc2828e8dc36fcd2ac57b63af
As part of the effort to allow storage to be initialized with or
without a player instance, this change moves the offline config
into the player config and changes storage to share a configuration
object with a player instance.
We opted to share the instance between the two classes because if
storage was initialized with player, the initializer is implying a
relationship between the two objects and therefore configuration
changes should be shared.
Issue #1297
Change-Id: I991365255e63c284fbfcf147cf63c9588dd764ab
In preparation to supporting non-manifest assets, let's change
|manifestUri| to |assetUri| as it is a more broad name.
Issue #816
Change-Id: Ibec761caa8acf173571592ce0a7029af0f60de68
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.
This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.
Change-Id: I048b430e4c0bea2ccb9aec572d5e9ec6b606a87a
This adds attach/detach methods to replace the media element in the
Player constructor. Now applications can take back control of the
media element or provide a reference later in the Player's life cycle.
This also allows applications to decide whether or not to set up
MediaSource in advance, through an optional argument on attach and
unload. The default will be to set up MediaSource in advance, which
maintains current behavior. This advanced setup of MediaSource can
improve load latency later.
This change also introduces async/await for the first time in the
project, which required changes to eslint config, Closure build
arguments, Babel & Babel-polyfill setup, and the esprima parser used
by our extern generator.
The use of async/await will improve readability in many places, and
these infrastructure changes to enable async/await should also unblock
issues #1336 and #1337.
Closes#1087
Change-Id: I0d6b4e0e2af27a6520a3d070fa92b7139b2cb8b0
This is part of a change to convert all usages of 'var' with either
'let' or 'const'. This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.
Change-Id: I8f857a24e4c1ad336177d23dfed4f4a29d3262d2
Not all values need to be updated twice a second. This change modifies
the list of player getters so that each value also includes an update
frequency, and only updates that property once in that many updates.
This acts as a configurable way to ensure that some properties update
in different amounts, without having to have multiple update timers or
compose multiple update messages in the same timeframe.
Change-Id: I90e75e3e73f6c633d91b1799307ec2b15587327b
Removes a special case in serialization that is no longer relevant due
to a configuration interface that was removed for v2.3.
Change-Id: I87ed194f42c1c25d86ca45b7ac952d6a45119a26
getManifest() hugely increased the message size when casting, to the
point where we were having message size problems.
This CL stops that property from being proxied.
This also adds an integration test that makes sure update messages do not get
too large.
Closes#1128
Change-Id: I3c4bfabb4d35ee870a603c38f784cb226366a28b
Adding an event right after the player parses the manifest, and before
initiating streaming, so that users can get the manifest information.
Adding manifest getter method in player so that customers can access
manifest information.
Closes#1043Closes#1074
Issue #1036
Change-Id: I0016c312bacdfa86299e5df68b586f90d565cfdc
Beforehand, we stripped out all objects variables in events when
serializing. This was intended to remove complicated DOM objects, and
prevent the error messages from containing large amounts of unnecessary
information. However, this also caused the cast receiver to strip away
the detail variable in error events, thus removing all useful
information from the error event.
This adds a special exception to serialize for the contents of the
'detail' variable.
Issue #1065
Change-Id: Ie291e317cc6e856af20af5df57ecf3b5c81ec8bd
Beforehand, the Chromecast would poll getPlayheadTimeAsDate and
getPresentationStartTimeAsDate for every update message, which are live-only
getters, even on VOD.
This would cause a lot of error messages in the debug output of the receiver;
we didn't notice this before because we mostly run the receiver in compiled
mode.
This also allowed users to poll those attributes for VODs without any error
messages when casting, since the results of the last update were cached.
This change adds a list of getters that require live; such getters are not added
to state update messages, and are set up with asserts in the sender.
This should solve the problem and slim down our update messages a bit at the
same time.
Change-Id: Ifc0b445def2d85b22fcb9af160dec2205d1faace
There was a bug in the cast_utils test that meant that the new members
on Player weren't being detected. The test should fail when we forget
to add a new member to the list in cast_utils.js. This updates the
test and adds the new members to the list.
Change-Id: I27c25d07b409b8350b5709c3ce26696d72a6a11d
The getTracks and selectTrack methods have been deprecated since v2.1
and scheduled for removal in v2.2.
Change-Id: I938b3015262d71683ac871c05a9f4c74c96acf50
Media Playback messages are used by generic Chromecast controllers
(Google Home app and the likes). Supporting them is required by
the Chromecast SDK.
Closes#722.
Change-Id: I3c98fb9d63da81b59c2cc82a3e790332fc9bb56e
This adds a method on Player to get the license expiration times for
the current EME sessions. This also adds the expiration times to the
stored content structure for offline content. This will update the
stored expiration while playing content (e.g. license duration changes
when playback starts).
Closes#727
Change-Id: I18770a79413423695bbb2ed5f31f6b19038a33d2
This add the groundwork for event regions that occur while playing.
When the playhead enters (or plays through) a specified region it will
fire enter/exit events for it. They are not fired when seeking over.
Issue #462
Change-Id: I9e280796bd012ad74d0319aa2056c6f6aa28890d