Commit Graph

3764 Commits

Author SHA1 Message Date
Theodore Abshire 44ba84e0b8 docs: Update Manifest Parser tutorial
This updates the Manifest Parser tutorial to match the new v3.0
manifest structure.

Closes #2634

Change-Id: I645f82624ae68193e80c28a7ec45c7a4316c7654
2020-06-09 22:30:18 +00:00
Jacob Trimble 705fae7908 refactor: Clean AbortableOperation and add tests
Change-Id: I2e0aee32c20bd009cb56ab58070b960f6b19b4b2
2020-06-09 22:20:45 +00:00
Joey Parrish f76afcc853 fix(ui): Set an explicit font size for icons
We depended on this font size being set in the font server's CSS, but
did not realize we had this implicit dependency.  This makes our
desired font size explicit.

This protects us from applications which happen to use the same font
and class name with a different default size.  Note that applications
which intend to change our icon size can still do so explicitly in
their own styles.  This is meant only to protect against accidental
conflicts.

Closes #2633

Change-Id: I0a2993c8b2e39596b47eb59b7e1a4a6373633c0b
2020-06-09 19:16:23 +00:00
Joey Parrish d60cb13c47 fix(ui): Apply upstream styles for icons font
When we changed the font for the icons without changing the class
name, we lost upstream styles from the font server.  This was not
obvious in our demo, but was more obvious in other apps where the font
size was different.

By using the same class name as used by the font server, we get those
upstream styles applied correctly.

Issue #2633

Change-Id: I615c1dfd86e5b9802d03050c5db0154ac196c2ef
2020-06-09 19:16:23 +00:00
michellezhuo 6d373eb631 Add config for low latency mode
Issue #1525

Change-Id: I561ac50b4681036b7675efdceae70937c4b9244d
2020-06-09 17:29:54 +00:00
Álvaro Velad Galván a201be414a fix: export shaka.util.FairPlayUtils and shaka.util.BufferUtils (#2628)
@exportInterface is used by the extern generator, but ignored by the
compiler. @export should be used for shaka.util.FairPlayUtils and
shaka.util.BufferUtils.

Closes #2626 and #2627
2020-06-09 07:32:59 -07:00
Joey Parrish 741424eef6 fix: Correct IMA SDK URLs in service worker and docs
The IMA SDK URLs in the service worker were http, and should have been
https.  This caused an issue when deploying v3.0.0 to appspot.

The IMA SDK URLs in the demo specified no protocol, but that is not
necessary, since https works in all contexts.

The IMA SDK URLs in the docs also specified no protocol, and one of
them was incorrect.

This corrects the mistaken URLs and makes them universally https.

Change-Id: I53dbf25ddb16ec882fcf3c070bcebed726277be1
2020-06-08 20:38:49 -07:00
Joey Parrish 547f1b5cab chore: Update changelog for v3.0 again
Also pushing back release date to Tuesday, June 9.

Change-Id: I863bdff603a390d438caa391854006b4123b1129
v3.0.0
2020-06-09 00:10:48 +00:00
Joey Parrish e6dff67b57 chore: Update receiver app ID for v3.0
Change-Id: Ied0311dcac4730eb4b72bb5404db20263993e9ba
2020-06-09 00:10:48 +00:00
Joey Parrish f692bfe7d6 test: Add regression tests for cue backgrounds
This adds two new layout tests for cue backgrounds, corresponding to
issue #2623 and PR #2624.

Change-Id: I2f07e46c31ac613792471dd8d65fef1676f6b6bf
2020-06-09 00:10:48 +00:00
Joey Parrish 02379d354e fix: Abort pending requests in StreamingEngine.destroy
Closes #2619

Change-Id: I10cc2e9567720c9d021038a4da3c26b6857ec709
2020-06-08 21:28:28 +00:00
michellezhuo e63813c363 fix(HlsParser): Fix HLS live stream playback failure
Since createSegments_() is asynchronous, and we are updating all the streams
in parallel, the global playlistStartTime_ value may get changed when we update
other playlists, rather than the current playlist. This caused the references'
start and end times discontinuous in a stream.

Closes #2605

Change-Id: Ib2dd1161f4075486f79b0122b98e558ea7d05aaa
2020-06-08 19:20:31 +00:00
Joey Parrish 3bf5ed10b7 Fix flaky test results on Chromecast
One of the src= playback tests was failing on Chromecast with an
estimated rate of about 20% when the src= tests are run alone.  The
timeout for playback to start was found to be too short on that
resource-limited embedded device.  This increases the playback timeout
in the test.

Fixes: 157702575

Change-Id: Ib8d5a0d961bc0e99e77c16b93ca63569f3a2cc31
2020-06-08 18:00:22 +00:00
Alvaro Velad c4e6d1c7b2 Background color only should apply to nested cues in UITextDisplayer 2020-06-08 09:32:45 -07:00
Theodore Abshire e050a238f2 Updated and clarified docs on plugin interface.
Issue #2619

Change-Id: I953421ce580d37b382dca36017b221f94824f20a
2020-06-05 12:00:47 -07:00
Theodore Abshire 8d657140f1 Made ManifestParser.PlayerInterface.filter async.
This is a change in preparation for the adoption of the
MediaCapabilities API.

Related to #1391

Change-Id: If0988aedafe15aa3be794fb977fd8e04e91ca10e
2020-06-04 17:42:27 -07:00
Theodore Abshire 39090dfc28 Also check for misspellings in externs.
Change-Id: Ia10e58cc350cd1192b7098134215a659564e20a6
2020-06-05 00:41:38 +00: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
Sandra Lokshina 1fc19510ec Hook up ID3 tag parsing information from mux.js
Issue #2592.

Change-Id: I0b17977b88cf37189d7611254ce14171ba52c54f
2020-06-04 17:12:06 +00:00
michellezhuo ec2674a4d8 Refactor createSegments_() to improve readability
1. We get the start time for either the first segment in the playlist,
or a segment after discontinuity. The logic for getting the start time
in both places is almost the same.
Moving the dupliate code to getStartTime_() function.
2. We create a temporary SegmentReference to get the start time.
Moving creating the SegmentReference into getStartTime_() function.
3. Moving the logic of getting timestampOffset for a discontinuity
segment into a seperate function.

createSegments_() is now 20+ lines shorter.

Change-Id: If484aab56aa169d4a0f9166813d696724230b919
2020-06-03 23:12:24 +00:00
Joey Parrish a132592b20 Add regression test for Google Home scrubber fix
The fix for Google Home scrubber in 8c3775ce (Change-Id
Iceec95f18cf15325b7ee2350a0f30f31edc90560) did not come with a
regression test.  This change covers that fix with an automated test.

I have confirmed that the test fails without the fix.

Issue #2606

Change-Id: I13a2bcfb2fcca059db4e909d7c27fb68b0bfb409
2020-06-03 23:03:13 +00:00
Joey Parrish b48d35f16e Minor refactor and cleanup in cast tests
Details of the cleanup:
 - Don't replace the load() spy with a non-spy
 - Fix an out-of-date comment on an explicit delay in a test
 - Hoist expectMediaInfo helper to make it available for all tests
 - Simulate loading content before the "generic controls messages" to allow the
   use of expectMediaInfo
 - Don't do a substring comparison on a JSON blob, which is inherently
   unreliable, and compare the parsed object structure instead

Related to #2606

Change-Id: Ifb46e223ba800c0e10cbdfa6cb847faa8424cd3d
2020-06-03 23:03:13 +00:00
Álvaro Velad Galván 1568d28686 Wrong pixelAspectRatio population in DASH (#2614)
The current implementation of pixelAspectRatio in DASH is wrong. `@par` in DASH is "picture  aspect ratio" so the correct is populate this field with `@sar`.
2020-06-03 14:46:41 -07:00
Álvaro Velad Galván bafe18fadd Add maxSegmentDuration to stats (#2613)
Resolves #2610
2020-06-03 11:51:59 -07:00
Alex Jones 64557ff82c Add support for nested TTML captions with an offset (#2602)
Closes #2601
2020-06-03 11:49:15 -07: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
Joey Parrish f8399ff0d2 Remove mention of now-dead SegmentIndex.replace()
The replace() method of SegmentIndex was only ever used in HlsParser,
and was never exported from v2.5.x.  We have decided at the last
minute to drop it before v3, so this change removes it from the
upgrade docs.

Change-Id: I0d89745dbeac14e1bf90e8e87f3401a797ea9792
2020-06-02 23:50:39 +00:00
michellezhuo 9584804b6c Fix HLS live stream freezing
When we get a playlist update, we replace the list of SegmentReferences
in the SegmentIndex. However, the position pointer in the
SegmentIterator of the SegmentIndex is not updated, and still points to
the index of the old SegmentReference list. Thus, the current
SegmentReference may be null.
We should merge the new SegmentReference list with the old list, and
mark the offset of the list.

Closes #2605

Change-Id: Ia6740e1173ac48467e7b141257cc9c6148e30a0c
2020-06-02 15:57:37 -07:00
Joey Parrish 1b5ba6d6cd Update changelog and bump versions for v3.0
Change-Id: I6ab88140d03b2aeb238fff5eb54802e4b3e104b7
2020-06-01 15:57:31 -07:00
Joey Parrish 5d2dc2daaf Update deprecation timelines (v3.1 => v4.0)
Since we are getting strict about semantic versioning, we can't remove
features in v3.1.  Any backward compatibility we offer will be
maintained until v4.0.

The exception is explicit IE 11 support, which will still be removed
in v3.1.

To help us follow the rules for removal, the Deprecate utility no
longer accepts a minor version argument.

Change-Id: I4dd94a6084e4ed72eeec410eb9aa0ad974d8dac8
2020-06-01 15:57:31 -07:00
Joey Parrish 926900e97f Mark ads as beta and getManifest() as unstable
Change-Id: I7b7c21e07c0b4d9ada2a3eefe2b83b735152452b
2020-06-01 15:57:24 -07:00
michellezhuo 9bf6aad4b9 Seek an available SegmentReference
In getSegmentReferenceNeeded_(), we get a SegmentReference base on
(presentationTime - maxDrift) time. If no SegmentReference is avaiable,
we wait until next update.
For live edge, if the SegmentReference with the drifted time is always
out of the segment availability start/end time window, we don't append
any segments.
If we can't find a valid segment with the drifted time, we should seek
with the presentation time.

Fixes #2589

Change-Id: I3fedc002ffc5c99f9dd1d1bf9525aca141b9a2be
2020-06-01 13:29:47 -07:00
Joey Parrish aba5e2583c Rename v2.6 to v3.0 and v2.7 to v3.1
We have decided to bump the major version number instead of the minor
number, based primarily on the fact that this release breaks
compatibility with our previous manifest structure.

Change-Id: I67e4c8267c6e103cfc7278e09daac186ae5cbbc6
2020-05-29 17:50:22 +00:00
Joey Parrish c7af8184ad Update changelog for v2.5.12
Change-Id: I9182a29b56fd18391229a404988c86a131903db7
v2.5.12-master
2020-05-29 00:20:56 +00:00
Joey Parrish 21c3d7dc4d Fix language preferences in src= mode
Changes to the load() promise resolution on iOS for #2483 accidentally
broke language preferences in src= mode, and the regression test for
this revealed subtleties in how and when tracks may be selected with
Apple's native HLS.

By waiting for a "change" event on video.textTracks, we can make sure
Apple is ready to accept our own text track selection.

This should now work correctly on all platforms.

Closes #2593

Change-Id: Iec59b89001fbec3779a0f7087ce11efe1be003ef
2020-05-28 10:02:50 -07:00
Joey Parrish bab451e655 Update screenshots
I'm not sure what caused the change, but after some other changes
merged, screenshots on Linux were off slightly and needed an update.
Screenshots in Safari were way off, and a workaround in the screenshot
utility needed to be removed.

Change-Id: Ic28d83dddcd6272b4cbb83aa7a3dcdb5c8fcdad9
2020-05-28 00:06:10 +00:00
Jacob Trimble 654b6cbee3 Fix SegmentTimeline with t attribute missing.
Fixes #2590

Change-Id: I2ac4adb1898b4affea9ee337f1d59fc3dca69ced
2020-05-27 16:48:54 +00:00
Joey Parrish b839340220 Add screenshot-based layout tests for subtitles
This adds our first screenshot-based layout tests and the
infrastructure to use WebDriver for screenshots through Karma.
This new kind of test will be skipped in any non-WebDriver context.

There are many pieces to this system.

First, we update the Karma WebDriver launcher to a newly-released
version that lets us access the client spec object from the launcher.

Second, we build a Karma middleware plugin to respond to HTTP requests
from the tests.  We handle /screenshot/isSupported and return a bool
so tests can be skipped on non-WebDriver launchers.  We also handle
/screenshot/diff to take the screenshot and compare it to a known-good
version.

The screenshot is a full-page screenshot, since element screenshots
don't work consistently across all the browsers in our test lab.  The
screenshot is then cropped to a rectangle specified in the request.
This rectangle is measured to match a specific element, so in
practice, we are screenshotting just one element.

Browsers use sub-pixel rendering, effectively rendering at a scale
larger than the "pixels" seen by JS.  The screenshot comes in at this
scale, so the requested cropping rectangle is scaled to match, then
the cropped screenshot is scaled down to the JS-measured size.

Because of sub-pixel rendering, element offsets can be non-integer
numbers.  Normally, Karma puts the tests in a iframe, above which is a
variable-height banner showing which devices are connected to Karma
and what state they are in.  So this variation and the lack of integer
offsets means we can run into stability issues due to rounding errors.
To make offsets consistent and improve stability of the screenshots,
this banner is now disabled in our Karma config.

The cropping, scaling, and diffing of images is handled Karma-side by
a node module called Jimp.

Before we start the layout tests for UITextDisplayer, we use a node
module in the browser called fontfaceonload to wait for our web fonts
to be fully loaded.  This module is a polyfill that polls on IE and
uses a standard API in modern browsers to wait for our font to load.
This is all wrapped into a new test util called waitForFont.

Screenshots are stored in test/test/assets/screenshots/ and are
organized into folders by platform and browser and named according to
an identifier specified by each test case.  The new screenshot is
written to disk with the suffix "-new", and a diff image is written
with the suffix "-diff".  When a test fails, we can review the changes
in a browser with test/test/assets/screenshots/review.html.  The
known-good screenshots can be updated with the new tool
build/updateScreenshots.py.

Change-Id: Ib477fd3c459de466c6dc91e9a60d3e2579164b12
2020-05-26 22:38:04 +00:00
michellezhuo 7cd12770a2 Add low latency DASH and HLS Live manifest to demo assets
Issue #1525

Change-Id: Ife9855b36436d58e0f1943265c5246b661fb4e32
2020-05-26 17:28:53 +00:00
Sandra Lokshina 43b9567b5b Propagate UI locale changes to ad manager.
Change-Id: I4de1a8a5d16c9b2d8efb71eb94df70ae73fc0c3f
2020-05-26 15:29:10 +00:00
Joey Parrish af206b79db Fix src= test failures
These issues were mostly introduced in "Don't preload data on iOS",
and were not detectable in Chrome.  They came up during a full test
pass in our test lab on all browsers.

Change-Id: Ife6e157a18df84ea30b840615f6d06a22e340a44
2020-05-21 18:42:01 -07:00
Joey Parrish 6b11f1ecdc Don't preload data on iOS
Instead of calling video.load() and waiting for loadeddata for src=,
wait for loadedmetadata.  This should be a safe event to use in most
cases, and calling video.load() causes native HLS to start preloading
an uncontrollable amount of content.

The exception is if the app sets preload='none' on the video element.
If this happens, we will detect it, log a warning, and avoid the
loadedmetadata event which may never fire.  This is not a scenario we
will officially support, but at least we can prevent a hang in
player.load().

Closes #2483

Change-Id: Id64c8f23cb8fa82bb5c301abafb51f2d9d8730f7
2020-05-21 20:01:32 +00:00
Joey Parrish afcbfb968f Fix annotations in MediaReadyState util
For some reason, the new compiler in the master branch let this by,
but the old compiler in the v2.5.x branch complained when I
cherry-picked the utility.

Change-Id: I1e688f72594b74ed7d2a7c2801eb179b8ec13e8c
2020-05-21 20:01:18 +00:00
Joey Parrish 453ab69a11 Add missing goog.require calls in polyfills
Change-Id: Ieb3724fb8e6b29a1b85e73cb249c1bd5a166f732
2020-05-21 11:46:10 -07:00
Joey Parrish ac2a7039b4 Make the controls background gradient proportional
Rather than making the gradient 92px tall, make it 15% of the size of
the video container.  This is consistent with the size of the controls
and the position of the subtitles when the controls are shown.

In this way, the size of the gradient is now proportional and
responsive to the size of the video container.

This was spotted while developing screenshot-based layout tests using
relatively small containers.

Change-Id: I304d99a26be90b9eefa50dc179b924da15dc601d
2020-05-21 16:19:58 +00:00
Joey Parrish 4592a090ae Remove controls container when destroying the UI
Removing the controls container when destroying the UI restores the
DOM back to its pre-constructor state after destroy() is complete.
This allows the video container to be reused.

This became an issue while developing screenshot-based layout tests.

Change-Id: I5aa74e9ef443037ad84ac6c8acf7d09f657d6b5e
2020-05-21 16:19:54 +00:00
Joey Parrish 8a20eb71c1 Work around IE 11 bug in text region positioning
While developing screenshot-based layout tests, it was discovered that
IE 11 did not position VTT/TTML regions in the same way as other
browsers.  This turned out to be caused by a bug in IE's flexbox
implementation in which flex items that are center-positioned can
overflow the flex parent.

This uses the work-around recommended here:
https://github.com/philipwalton/flexbugs/tree/6e720da8#flexbug-2

Closes #2584

Change-Id: I22b9790b8f5798ba757a111d2c502dd5a3415441
2020-05-21 16:19:49 +00:00