This corrects/normalizes the license headers in CSS and LESS files.
The LESS tool respects the same "/*!" syntax for forcing the inclusion
of a license header, but will not dedup these licenses. So the LESS
files generally will not use this syntax. Instead, the build system
prepends a license header after compilation.
The exception is for our SVG spinner, which is based on third-party
CSS from codepen. The copyright header for this is forced into the
output to give proper credit to the original author.
Issue #2638
Change-Id: I4c58e2b082f2d5e550a6f0a30feaaf9ebf82a53a
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs. This does not
affect the compiled output, and is only done for consistency.
Issue #2638
Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
Though not part of the library, this corrects/normalizes the license
headers in the demo app to be consistent with those in the library.
Issue #2638
Change-Id: I4546c4c6970d72ff71a37489fd582623bd6e2ca3
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
The Closure Library's base.js, the Closure Compiler, and the Closure
deps-writer are all now loaded via NPM instead of commiting them
directly to the repo. This also updates both the library and compiler
to the latest version: 20200406.
We still have a fork of the Closure Library's URI parser. The latest
upstream version of that has too many dependencies on the rest of the
library to import directly from NPM.
Some internals of the build system have been refactored, and the
"complete" set of files in the build system now includes third_party.
Our forked URI parser does not pass lint checks yet, so the linter
does not run over third_party yet.
A couple of overly-severe sets of compiler checks have been disabled,
since even the latest Closure Library's base.js doesn't pass them.
The script-loader in load.js had to be updated for compatibility with
the new Closure Library. If you don't return "true" now, Closure's
base.js will stop loading subsequent source files.
Some local externs that we had written are now available from the
compiler, so our local copies have been deleted.
A few type-related changes have been made as well, removing casts that
were necessary with the old compiler, but not necessary with the new
one.
Finally, this corrects some type issues in the tests using the new
"typeof" annotation from the compiler. This allows us to type a
variable as a class defined elsewhere. For example, after loading the
compiled library, we can reference compiledShaka.Player, which has the
type "typeof shaka.Player". The compiler can then type-check all uses
of it in the tests.
Closes#2528 (bad polyfill code generated by the old compiler)
Change-Id: I62ec61e82d4edf342b2c576c2d4f89f11562ee65
The receiver app is attached to the window so it can be debugged.
This should use square brackets, since "receiver" is not defined on
"window".
Issue #2528
Change-Id: I8e725bb8292cdcb88ffccd3bc65d6d54181affa6
In many places, the implicit type info was insufficient. For example,
document.createElement returns Element, but the actual return is
always a subclass of Element. In many cases, we need the compiler to
know that a specific subclass is in use, so that it can correctly
check our use of subclass-specific properties. Another common pattern
is confusion between Node and Element (which is a subclass of Node).
Almost all of the changes in the demo and UI are Element-related.
In some places, we referred to HTMLMediaElement, used in the Player
API, instead of the more specific HTMLVideoElement in use in our demo.
Since the demo uses video-specific properties, we must use the more
specific type.
Another case is the use of document.createEvent, which returns Event
according to the compiler, but in reality always returns a subclass,
like CustomEvent.
In one case in NetworkingEngine, correcting the type of an
AbortableOperation led to the discovery that we had been incorrectly
accessing a private method of that type.
In goog.Uri, there were several instances of "*" for a type, which the
newer compiler won't accept. These have all been corrected.
Finally, in some places, we had the wrong nullability on a type.
These were all caught by a compiler upgrade.
Issue #2528
Change-Id: I7f2d070e3da32fe9ff5f444315649f3cbdb5a4a5
This has not had an impact yet because we do not yet make use of the
encryption scheme queries that the polyfill provides. But this
polyfill has been missing from the Cast receiver in all v2.5.x
releases since it was introduced.
The omission was first noticed when loading the Cast receiver in a
debugger in desktop Chrome. This wouldn't normally be an issue with
most polyfills, but this one is outside of the Closure deps system.
Change-Id: I53685f5efe5555979993bf692d8a7cae31305ea9
Some of the files still used the old long license. This increased the
size of the compiled bundle since it had both versions.
Change-Id: Iec137f71547f91369a563145f870eb26ddc96a96
To match Chrome native controls, the default controls for desktop will
now contain the small play/pause button, but default controls for
mobile will now contain the large play/pause button. Mobile controls
will also not contain the volume button.
This removes several CSS-based versions of these things in preference
for configuration.
Apps can still override the defaults, no matter the platform. Apps
can also make their own mobile-based config choices in JS by checking
video.ui.isMobile() or change styles in CSS using ".shaka-mobile".
Change-Id: I4fb8391f7f3727c7086cd3bca2b1d5c93bd9e856
This option will be used in our cast receiver to delay fading the
controls for a few seconds when playback begins.
Change-Id: Ia44c2eb6cd4fc9c40f07b0336556a87762f2ee14
This reverts commits:
- a43f52caf3
"Add "noFade" configuration to UI."
- 08a36e886f
"Add transparency transition cast app controls."
- a6b159ffcf
"Keep controls visible while casting."
Moving the showing/hiding up to the receiver app level can waste CPU
on low-end devices, and puts undue configuration burden on the
receiver app.
We will follow up with a more direct fix for #2314, as well as a
"fadeDelay" option to allow the cast receiver UI to delay fading for a
few seconds.
Related to issue #2314
Change-Id: I0028803432ad028930002b29dd7b94c7d9a0ec56
Beforehand, the controls would fade in and out primarily due to an
unintentional interaction with the UI fade transition effect.
With other changes, though, that interaction is no longer working, so
here is an explicitly-defined transition.
Change-Id: I5ec3ef1ab4267affc348d7ed035586ba8c1abc1a
This allows users to tell the UI to stay visible at all times, even if
there are no mouse events.
This is necessary on ChromeCast, where there is no mouse, or touch
controls, or anything; without this setting, the controls just stay
transparent all the time.
Change-Id: Ie74c689f9bee9f07ffcb68dbacfd7bfe3ad066de
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
Also unified CSS/less style based on that.
This does have to use a forked version of stylelint, since there
is a bug (?) in the globbing library they use that causes it to
fail on our buildbot. I found the simplest solution was just to add
an option to disable globbing, a feature we weren't using anyway.
Closes#1867
Change-Id: I9295b01d5b15d060356e314938b64b551b75de6a
Changes to text styles:
- Default to 20px instead of 18px
- Default to a black background (issue #1955)
- Fix the line height (otherwise set in px by MDL in the demo app)
- Scale font with the window in fullscreen or cast receiver
Fixes#1955
Change-Id: I98da85030f4b5a40ba1be962b3d1b4fc2c34489e
The controls have the cast proxy and the proxied player, so the UI
itself offering direct access to the local player is confusing.
Instead, we will send all requests through the controls, which have
explicit getPlayer() and getLocalPlayer() methods for access to the
proxied and local players.
Closes#1941
Change-Id: I1d6154d76b1b3b5b550e55e39efcbb2c451f7569
This is a fully automated change. The linter will fail because the
extra indentation caused line-length errors. These won't be fixed
automatically. They are fixed in a follow-up to make this one fully
automated.
Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
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 reduces the number of resources we have to load by using LESS to
import them into the compiled CSS bundle.
This also gets rid of a flash of unstyled content in compiled mode by
always including the compiled CSS in HTML directly, regardless of
mode. If the app is running in uncompiled mode, LESS is still loaded
and can override the compiled styles.
Change-Id: I8cde25c15c281029a129225fc85a8baee767f424
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
The cast receiver should not be managing play button state or styles.
Doing this causes the play button to be off-center by interfering with
UI styles.
This also drops all outdated styles that are no longer used with the
new UI.
Reconfiguring the receiver UI controls gets rid of extra elements that
are not used in this context.
Fixes b/131254481
Fixes b/131254837
Change-Id: I25fb34a9b6a3e18fb07f3570181edbbf14a31cd3
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
When we switched to using less for our css, we forgot to update
the cast receiver to point to the compiled css. This corrects that.
Change-Id: Ib5d9336fc1b14233731004be845b819be2b20307
According to @beaufortfrancois, we should no longer be using protocol-
relative URIs. He quotes this passage from Paul Irish:
> Now that SSL is encouraged for everyone and doesn’t have performance
> concerns, this technique is now an anti-pattern. If the asset you
> need is available on SSL, then always use the https:// asset.
> Allowing the snippet to request over HTTP opens the door for attacks
> like the recent Github Man-on-the-side attack. It’s always safe to
> request HTTPS assets even if your site is on HTTP, however the
> reverse is not true.
Source: https://www.paulirish.com/2010/the-protocol-relative-url/
This change was begun with the following command:
git grep -l "'//" | xargs sed -i "s@'//@'https://@g"
Some changes made by that command were false-positives, which I then
reverted manually. Others required additional cleanup to meet style
rules.
I've also just discovered that the "max-len" rule in eslint's Google
style config exempts URIs, so there's no need to disable the max-len
rule on URIs in the assets list. These have been removed in the asset
list where unnecessary.
Finally, testing these updated URIs led to the discovery that two of
our third-party demo assets are no longer available. One URI needed
to be updated. The other had no obvious replacement, so it was
removed.
Closes#1390
Change-Id: I2fe23faec04f1904c1741236b364d5089900092a
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: I270c70f6cda733ca6121d0761b4c1c162104d379
This also modifies the build scripts to produce debug builds of the
demo and the receiver when doing debug builds.
Change-Id: I386a7b8f541332594a5022955a69970ebbe79200
When using the compiled version of the library, use a compiled version
of the demo app, as well. This makes use of the generated externs, so
we now have additional confidence that they are correctly generated.
Refactor the load.js script to use a configurable list of sources.
This enables us to use the same load.js in both the demo and cast
receiver.
This, ultimately, makes it easier to cache demo resources in our PWA.
Issue #876
Change-Id: I274660fe2ea23236ceea3c2d3c97572762d2f785
Since they are old, not being updated, and don't represent the kind of
content we want to support, just drop them. This also avoid extra
work to handle YouTube's custom DRM callbacks.
Closes#1015
Change-Id: Iefa9b7a34cd184549ff0895e96198907cc6c8a51
This simplifies detection of audio-only content and makes the process
a little more obvious.
Closes#942
Change-Id: I89b599fb8c8915c9e1b45d2f9b81a3ac7193e5ef
This makes it easier to compile the demo and receiver apps, which will
make the PWA transition easier.
Issue #876
Change-Id: Iffd335df35c17c7895f763ccf180011dd1d8c14d