Commit Graph

3152 Commits

Author SHA1 Message Date
Jacob Trimble ac4fdfd0cd Make the reader types more permissive of inputs.
Now the EbmlParser and DataViewReader types can accept BufferSource
objects to avoid the caller having to convert it at each callsite.

Change-Id: I527fbc638485214bfe976d7da89b79b6098033a8
2019-08-20 22:08:27 +00:00
Jacob Trimble a2bcf7278d Move some utilities to BufferUtils.
Change-Id: Ifb3c4348cc912640b99ff53f7cac59a63480c68e
2019-08-20 22:07:35 +00:00
Sandra Lokshina fdd2602acd Release old ui.Elements on controls.configure() calls.
The calls to controls.configure() deleted the old layout
in terms of the html elements, but the ui.Elements
owning the html still survived.
This CL fixes that. It also switches ui.Element from
IDestroyable to IReleasable to make the release synchronous.

Fixes #2089.

Change-Id: Ic4ce70e91a1b028ef4d971ac3fb9281d8a667ea8
2019-08-20 21:09:15 +00:00
Jacob Trimble 596c80a949 Refactor handling of ArrayBuffer.
This changes the network API to use BufferSource instead of ArrayBuffer,
which allows plugins to return a "view" on a buffer instead of the
whole buffer.  This also adds some utilities for changing between
views and buffers.

Lastly this forbids the use of the "buffer" property of TypedArrays
since it doesn't work with partial "views".  This audits and fixes the
usages of the "buffer" property to ensure correct usage.

It should be noted that both MSE and EME accept a BufferSource as input,
so we don't need to convert a "view" into an ArrayBuffer before passing
to it.

Change-Id: Iaa417773f8ce5304424e43c7372ce10ebf540d2a
2019-08-20 20:17:33 +00:00
Jacob Trimble 4fdf8f7a1c Allow running tests without Babel.
This greatly speeds up startup time when running tests on a modern
browser.  This change also fixes a bug in one of the tests that only
worked with Babel running.

Change-Id: I1493ef30388c5043dcdf8350bec7817ab5d28d55
2019-08-20 20:10:02 +00:00
Sandra Lokshina 5646184030 Add a SettingsMenu class for settings menus.
This extracts common code in our overflow menu settings
menus.
Text, Audio Language and Resolution selections now inherit
from this class. It also makes it easier to create new
overflow menu items.

Closes #2091

Change-Id: Ib68e1fb295ed3ec61cb7a072c039a5c7c4e22183
2019-08-20 17:40:47 +00:00
Jacob Trimble f9a031b086 Fix high playback rate test.
This tests wasn't working properly before since the 'onBuffering'
callback wasn't given to StreamingEngine.  This test was broken on
Edge, but at some point got fixed (or Edge fixed it's behavior).

Fixes #1743

Change-Id: I0af48207f5e8ad1c2e5007967a093f243e1837c9
2019-08-19 17:44:22 +00:00
Jacob Trimble f6f8be3b06 Add a filter for check.py.
This allows only running a specific check to aid in debugging and
fixing problems.  This also refactors the code to avoid having to
have a list of all the checks.

Change-Id: I6381ab563f648124c6b900d7b4a24686baebc4cc
2019-08-19 17:24:23 +00:00
Jacob Trimble 6fa0292cc3 Fix bug with eslint-disable checking.
Change-Id: I49c3994616a36a70bedbe33b0d2a6071a1ec4523
2019-08-19 17:23:46 +00:00
Theodore Abshire 1ea3ca49dc Added more HLS demo assets.
Note that the captions on some of these assets do not display properly
at the moment, due to bugs on our part.

Issue #2035

Change-Id: I5cc8893b824af6ac27f8895565ed1dfbb970b039
2019-08-18 08:51:21 +00:00
Sandra Lokshina 05cb3cf2e8 Add clearBufferOnQualityChange field to UI config.
Resolutions menu calls player.selectVariantTrack() when
a user selects a resolution. SelectVariant track has a
clearBuffer argument that we used to always set to true.
However, an app may want it to be false. This change
makes this behavior configurable.

Closes #1733.

Change-Id: I6a0dbcca99a8322d68abd0151afd66af31530856
2019-08-16 21:33:16 +00:00
Jacob Trimble 32e7665fc1 Updated workaround in MediaSourceEngine.
Chrome has fixed their behavior involving endOfStream(), but both Tizen
and IE11 have the same broken behavior.  Unfortunately these platforms
will likely never be fixed, so we need to keep this forever.

Fixes #1357

Change-Id: Id540170f8c8cb6e0ddf3a30bde5035016fa61df1
2019-08-16 18:35:38 +00:00
Jacob Trimble d44430e66e Fix duplicate resolution entries in UI menu.
Closes #2085

Change-Id: Idfdcd0cf89f43bd6a624afbb88e504d7653c9ae3
2019-08-16 18:32:28 +00:00
Jacob Trimble 568cc46720 Add a custom eslint plugin for private names.
This plugin can be used to write custom eslint rules.  This adds a
single rule to check we name private members correctly.  This plugin
does not get added to NPM, it is only used locally.

Fixes #1553

Change-Id: Ifdf9208d2bd0d09e1adb9c281b0be34266a867c9
2019-08-16 16:15:49 +00:00
Joey Parrish f4536acb7e Fix missing tracks, race on time during startup
During startup, there was a race between the video element's ready
state and seeking to the requested start position.  If the video
became ready before the seek to the start position, there could
briefly be 0 tracks.  Reproducing this required a first period start
> 0 and a start position > 0, such that a lookup of the "current"
period during this brief window would return null.

The problem was more likely to be seen on Chromecast, where the time
between load() and the completion of a seek was much larger than on
desktops.

The bug was caused by Playhead, which both seeks to the start position
and manages the concept of "current time", returning the start
position during startup and the video element's position thereafter.

This fixes the race, making sure that startup is not considered
complete by Playhead until the initial seek is over.  This adds an
appropriate regression test and simulated content that can reproduce
the conditions in the original bug report.

Fixes b/138941217
Fixes #2045

Change-Id: Ie8a57283468d88697619349a29e37a804586e5ef
2019-08-14 18:01:56 +00:00
Jacob Trimble 0f92d8221f Fix use of private tags.
Issue #1553

Change-Id: I8c0412eda3d68f2ad475bf8282afcaeffd80852a
2019-08-13 19:08:48 +00:00
Jacob Trimble 79aae2aeaf Fix protected member names.
According to the style guide, protected members should not end with
an underscore.  This renames them to fix it.  This also marks some
members as private that aren't used outside the class.  Lastly, this
fixes a possible bug with the use of "this".

Issue #1553

Change-Id: I6c7ecdcd228ec4e4aded4af52e2262d0bf5beaf4
2019-08-13 19:08:03 +00:00
Jacob Trimble 2d9285af3c Add <code> tags to Player extern docs.
This also adds a mentions the 'largegap' event.

Fixes #2097

Change-Id: I2ecf9f40a12f16741c1a01a455e70f3aaac62a5c
2019-08-13 19:06:48 +00:00
Theodore Abshire 37bc58d638 Still load tabs in noinput mode.
In noinput mode, we avoided loading the tabs, since they were unnecessary.
However, it turns out that we did need to load them if we wanted to load
custom assets, since they can only be loaded properly if the custom tab
exists.
This changes the demo to load the tabs, and just hide their contents.

Closes #2098

Change-Id: I2c4702fbaae3c88b44d86c7ac9e383728af42867
2019-08-13 17:27:53 +00:00
Jacob Trimble ce90a932e4 Fix spinner position on IE11.
When setting "position: absolute", you should set the "left" and "top"
properties to ensure it is aligned with its parent correctly.  IE11
apparently defaulted to aligning next to the video element.  This
ensures the spinner is aligned with the play button.

Fixes #2084

Change-Id: I91041813e36dbfd18a00c22af3f3f5d7e7542f40
2019-08-12 19:40:31 +00:00
Jacob Trimble d7fc19ab31 Allow filtering out failed HLS text tracks.
This adds a separate configuration value for this because (a) the HLS
parser can't access the streaming configuration and (b) this behavior
is different in that the streams are removed instead of just not playing
them.

Closes #2065

Change-Id: Ic9b1e0d40b161cd4ba0eb6d7c922882112034626
2019-08-12 18:16:28 +00:00
Jacob Trimble d1498f4968 Don't add Control event listeners multiple times.
Because configure() is called multiple times, we used to add some of
the event handlers multiple times.  For fullscreen, this caused us to
try to toggle fullscreen multiple times.  This changes to only add the
main event listeners one time and the DOM-specific ones have been moved
to be added in the configure() call.

This also moves the fullscreen toggle to the try so we can propagate
any errors from it.  Lastly, this adds an "error" listener to the
tests to fail the test.

Closes #2054
Issue #2089

Change-Id: Ic78417ce52cae1c53133b5a4217004bb91ebcc4f
2019-08-12 18:14:59 +00:00
Jacob Trimble e660667725 Make exported docs better for Player.
- Use <code> blocks.
- Use <p> to separate blocks (since newlines in comments are ignored).
- Use <ul> for lists.
- Give messages for deprecated tags.

Change-Id: I06d5e0e75eb3e498063cf0c291e6031af5d93b2d
2019-08-09 21:50:15 +00:00
Jacob Trimble 8fe79250c1 Fix seek bar coloring when nothing buffered.
You can't use linear-gradient() with one value.  The value will be
silently ignored and we will display the last buffered value.  This
fixes the buffering display to show that nothing is buffered.

This also makes the gradient construction more readable.

Change-Id: I1a93046ef51b70f94b170067b6c5ed2ae43ada1d
2019-08-09 21:18:36 +00:00
Theodore Abshire b8628b5032 Show full name of asset in search page.
Change-Id: I824473102eaf470ded96033f8801808a731c6412
2019-08-08 20:46:53 +00:00
Theodore Abshire f24c4a783f Added stylelint, a linter for our CSS/less files.
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
2019-08-08 18:38:19 +00:00
michellezhuo 1d417ff5ed HLS Refactor: Flatten createPeriod_() logic
Our previous approach:
For every variant tag, find the associated media tags(with the same
group id), create stream info for each media tag, and then create stream
info for variant tag based on that, and create variants.
This approach has duplicate calls for the media tags with the same group
id to create stream infos.

New approach:
1. Get codecs from variant tags
2. Create stream info from each media tag (with the codecs from variant
tags)
3. Create stream info for each variant tag, and then create variants.
This creates stream info for each media tag once, and avoids duplicate
calls to guess the codecs.

Issue #1558
Closes #2066

Change-Id: Icdf3133b1b15d1baf60624ff449e0a61fdb78d8a
2019-08-07 19:28:32 +00:00
Jacob Trimble c5b9d6804f Allow custom content ID in FairPlay.
Now there is a generic callback to transform the init data before
passing it to the browser.  This can be used by apps to use a custom
content ID in FairPlay content.  This also adds some utilities to help
in writing these functions and moves the default behavior to DrmEngine.

Closes #1951

Change-Id: I78ce660c126b53a69d5f55b16775ffcdbbe4d748
2019-08-07 18:38:40 +00:00
Jacob Trimble 438d599804 Parse Accessibility tag into text "kind".
Closes #2060

Change-Id: I916bbaf3357e9cdfbcfbfbafbd6dfc99890d7ebd
2019-08-05 10:27:59 -07:00
Jacob Trimble ad996d6873 Add tutorial for FairPlay support.
Closes #1951

Change-Id: I2dac43117ef444cf0701b2195d4a0e93385e5d52
2019-08-05 17:25:34 +00:00
Jacob Trimble e990da0179 Remove FairPlay formatting.
Now any formatting must be done by the app the same as other key
systems.

Issue #1951

Change-Id: Ifeaa0abdfda462cd457d19f6dce93c5af3a5fdad
2019-08-05 16:52:39 +00:00
Jacob Trimble b12075093e Add sessionId field to network request.
This allows a request/response filter to determine which EME session
made the request.  This also changes the session ID of FairPlay sessions
so they are available too.

Issue #1951

Change-Id: I1a07abae6faf4a87fad7b5d4290a00b25e83da8e
2019-08-05 16:52:11 +00:00
Joey Parrish 625938e2f9 Revert offline PSSH support for manifest that are missing inline init data
This reverts commit 6e5a0797de, #2042.

The PR as it landed broke some test cases and functionality for storing persistent licenses, and it doesn't seem to work even for its intended use case.
2019-08-02 16:56:24 -07:00
Theodore Abshire d85aff1491 Re-add MediaSession API.
This functionality was lost in the new demo page. This CL re-adds it.
This also fixes the MediaSession externs, which were incorrect; we
added demo typechecking after we removed MediaSession in the new demo
page, so we simply never noticed that.

Closes #1934

Change-Id: I177b80af70acd5211b7f39e6399965f3fdc696b6
2019-08-02 16:15:46 -07:00
Theodore Abshire 2765603cfe Fix scroll behavior on page load.
When an asset is loaded, the page scrolls to the top, so you can
see the video. When a tab is shown, the page scrolls to the top of
the tab, so you can browse it.
It turns out that, when you load the page, and it auto-plays an
asset, it loads the asset first, then shows the tab second. This is
because tab loading is triggered by an event, so it happens on the
next interruptor cycle.
This changes the load script to wait one cycle after dispatching the
event that triggers the tabs loading, so that the asset will be
loaded second instead.

Closes #2063

Change-Id: Icfb1a189d1c937afb849e5e584313001498c8c7a
2019-08-02 12:27:42 -07:00
Theodore Abshire ccd53ba170 Change progress bar to a circle.
This looks nicer, as the progress indicator is around the download button,
instead of being on the other side of the asset card.

Change-Id: If44cc39691664b95c05665665260c5938123cc4f
2019-08-02 18:58:12 +00:00
Sandra Lokshina a7716632d2 Don't create a UI if the app already has one.
If an app uses the shaka.ui.Overlay constructor to create
a UI before our auto-detection code runs, they end up with
two UIs one on top of the other.

I personally think anyone should be grateful to get an
extra UI or two, but people complain for some reason.

Closes #2073.

Change-Id: I793b5a7d8b5092a9b65426f5994019fde75bf957
2019-08-01 23:15:44 +00:00
Sandra Lokshina b4ddbd2131 Add mention of the Chromecast SDK to the UI tutorial.
Closes #2061.

Change-Id: I48396b8e5cd9ed821b25f5d87965ed7fd8e86691
2019-08-01 22:50:18 +00:00
michellezhuo 7faee6318a [UI] Fix text display css styles
In mobile fullscreen mode, the captions font size was relatively big,
and the captions overflowing out of video window got hidden.
This was because:
1. In full screen mode the font size was set 4.4% of window height.
Changing it to min(4.4% window height, 4.4% window width) should work
for both portrait and landscape screen.
2. css 'white-space:pre' hides the overflown texts. Should be
'pre-line'.

Closes #2051.

Tested with: Demo app, Angel One, Pixel2 in chrome simulator.
1. Load the video, turn on captions, enter full screen mode.
2. Rotate the screen to see the captions in both landscape and portrait
mode.
Before: The captions font is large, and the screen hides overflown
captions.
Now: The captions font is normal, and if the captions are long, it is
shown in a few lines.

Change-Id: I5c8c3aa900ee3623955b735f93647f1ca54e9a66
2019-08-01 20:43:55 +00:00
Joey Parrish 7fe97b841b Move fields to SegmentReference
To prepare for flattening out the manifest structure to remove
periods, this change moves initSegmentReference and
presentationTimeOffset fields into the SegmentReference object.  This
way, the segments on either side of a period transition or HLS
discontinuity can have different offsets or init segments, eventually
allowing us to create a single array of SegmentReferences for
multi-period content.

Issue #1339

Change-Id: Ic7eff0483789644881247ecf8044c5fb6a48f0e6
2019-08-01 11:04:36 -07:00
michellezhuo 524652f949 Fix hls live test
The variant tag's AUDIO attribute value should match the media tag's group-id value.

Change-Id: Ib942425ea1bdf37b4ff5f5a69158fc7ef5368b45
2019-07-30 13:03:22 -07:00
Shaka Player BuildBot 2ad32aa5b8 Merge remote-tracking branch 'github/master' 2019-07-29 15:57:34 -07:00
Jacob Trimble 5c580e243e Throw an error when FairPlay cert not set.
Fixes #1940

Change-Id: If911986eb70838b1aa81fc85f088c8367f7e1b48
2019-07-29 21:02:21 +00:00
Jacob Trimble 39f0d76a1f Don't enter fullscreen on double click on bottom bar.
Fixes #2053

Change-Id: I4779547ae2116d9cc4394c27aab33366ad36a6a6
2019-07-29 21:01:40 +00:00
Jacob Trimble 3b0367ec3a Exit PIP on unload in the demo.
When unloading content (e.g. when closing or when deleting offline
content), we should exit the PIP window and fullscreen.  This moves
these actions to the unload() method so they affect other sources of
unloads.

Fixes #2055

Change-Id: Ie1b5ac0f7cb814ff6bae3b08cc4c1fc80967d941
2019-07-29 11:23:17 -07:00
Theodore Abshire 2c51de2574 Re-added hidden 'noinput' param to demo.
Change-Id: I137fdaf04342f20c8e389340473d0994c527998c
2019-07-29 10:38:59 -07:00
Ante Wall 6e5a0797de feature: Offline PSSH support for manifest that are missing inline init data (#2042)
* fix: Reference issue with SegmentReference createUris

* test: Added Segment GetUris Test for timeline

* feat: Get PSSH from segements if not initdata exists

* feat: Get PSSH from segements if not initdata exists

* fix: JSDoc comments and moved drmEngine update to storage

* fix: Remove comments

* fix: Remove unused import

* fix: Lint erros and dedup initData code

* fix: remove no init data test and add check for use persistent license
2019-07-26 11:01:05 -07:00
Sandra Lokshina f33395eb83 Add the addBigPlayButton config to the tutorial.
Change-Id: Ief7c13490954539bf9784f1ecd3c7cc3d6b58e1b
2019-07-25 15:10:18 -07:00
Sandra Lokshina 635acb6ecf Extract the big play button into its own class & make it optional.
Change-Id: I462632c3da5f8ff5a68e111940591086bb395a13
2019-07-25 22:06:37 +00:00
Theodore Abshire 0b9de75617 Made close button on errors easier to click.
This makes the close (X) button on the error bigger.
It also makes the documentation link smaller; specifically, it makes the
link div only the size of the text, rather than the entire width of the
error bar.

Closes #2057

Change-Id: Icb7519daea4831edcc2f42cbb851a34356bc8548
2019-07-25 10:58:34 -07:00