Commit Graph

2241 Commits

Author SHA1 Message Date
Á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
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 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
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
Sandra Lokshina 43b9567b5b Propagate UI locale changes to ad manager.
Change-Id: I4de1a8a5d16c9b2d8efb71eb94df70ae73fc0c3f
2020-05-26 15:29:10 +00: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 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
Joey Parrish 754f16ab80 Fix subtitles in the center of the video
The margin: auto style centers the element both horizontally and
vertically.  We don't want vertical centering, and we already get
horizontal centering when appropriate through other styles.  So
removing margin: auto is the best fix.

Closes #2524

Change-Id: Icff74e49b3917b50141d1205232ebb0856fbcf16
2020-05-21 16:19:44 +00:00
Oren Me 7e1bb94ef6 Fix PlayReady key ID endianness for TiVo (#2582)
For Tivo Box with Opera browser and Opera Devices SDK inbuilt (Virgin Media STB in UK)
2020-05-20 21:04:00 -07:00
Álvaro Velad Galván 8648a3e0fc Add option to customize the polling of expiration time (#2579)
A large value effectively disables use of the expiration time

Closes #2252
2020-05-20 14:58:35 -07:00
michellezhuo ed0d718ea1 Rename fetchPartialSegment to fetchStartofSegment
In HlsParser, fetchPartialSegment_() is meant to fetch the starting part
of the segment to get the segment's start time, so we don't have to
download the full segment if possible.
PART_SEGMENT_SIZE is the default size of the starting part of the
segment we fetch.

Low Latency HLS introduces 'Partial Segment' as a smaller part of
a regular segment, such as CMAF chunks, and a regular segment might be
divided into many partial segments.

Renaming the original function and field to improve code readability and
avoid any future confusion.

Issue #1525

Change-Id: I593497f6e99e9ffe6128d6976eb7886bbd79679c
2020-05-20 04:18:42 +00:00
Sandra Lokshina 26d2e98959 Add a util for handling media readyState related logic.
Fixes #2555.

Change-Id: I735064952bc425bfb18d6c5681921ae1691eb348
2020-05-19 22:43:13 +00:00
Joey Parrish 48749210b0 Fix shaka.log in debug builds
This fixes the missing shaka.log in debug builds by exporting it
explicitly with the Closure Library API if goog.DEBUG is set.

Closes #2565

Change-Id: I4edd3220997f890058b693cec3bdf295ab5c171c
2020-05-19 18:41:29 +00:00
Sergei Gridasov 2fdbd5b676 Add new option manifest.hls.useFullSegmentsForStartTime (#2575)
If true, forces HlsParser to use a full segment request for determining
start time, in case the server does not support partial requests.

Closes #2556
2020-05-19 08:24:04 -07:00
Joey Parrish 7bce3f452b Add support for null TS packets in HLS
The timestamp parser in our HLS parser should not fail on null TS
packets.  These are indicates by a packet ID of 8191 (0x1fff), and
according to the spec, should be skipped by any receiver.

We will not skip such packets and continue through the segment to find
a PES packet with a timestamp.

In addition to the comments in #2546, I found this document helpful:
https://www.mikrocontroller.net/attachment/27265/mpeg2ts.pdf

Closes #2546

Change-Id: Id9dc16160bbde03969199150ca50122f12de77f4
2020-05-15 20:35:34 +00:00
Álvaro Velad Galván a7d46ee3d1 Add locale setting to AdManager (#2563) 2020-05-15 12:57:32 -07:00
Joey Parrish b9f07f6883 Fix overlapping nested cues in UI text display
The position: 'absolute' style should only be set when other
positioning attributes (left, right, top, bottom) are being set.
Otherwise, the natural layout flow is disturbed, without anything to
replace it.

Closes #2524

Change-Id: I4062c68253218a0f4ace6560a8847381d80c48d5
2020-05-13 21:41:38 +00:00
michellezhuo 8ad0f48939 export shaka.polyfill
@exportInterface is used by the extern generator, but ignored by the
compiler. @export should be used for shaka.polyfill.

Closes #2549 .

Change-Id: I400db152ec8ca222a45a598ab58ddfbe44552443
2020-05-12 17:27:33 -07:00
Joey Parrish ca81d553de Fix text track change after enabling text display
Setting text track visibility to true may, in some cases, require us
to choose a text track.  But we should not do this if one has already
been chosen.

Closes #2553

Change-Id: I53bf1b624b59baae774ffaeb0f0e9eb5467984fc
2020-05-12 19:06:31 +00:00
Joey Parrish 82dc707579 Default cue size to 0, meaning "auto".
When no specific size has been set on a Cue object, the default will
now be 0, which means "auto" size to the text displayer.  If a cue has
no specific width, the background will fit to the text.  If a cue has
an explicit width of 100%, the background will fill the entire
horizontal space of the text container.

This fixes the 100%-width background introduced in Change-Id
I4500b8f637f3f43f48d019d14ef527e75d960fec in #2524.

Fixes #2524

Change-Id: I98caeb89d3da640a8175560810c8ccf2de27a2bb
2020-05-12 17:46:52 +00:00
Álvaro Velad Galván 6f9b36f755 Allow OPUS on Tizen 5 or higher. (#2564) 2020-05-11 15:07:04 -07:00
Joey Parrish 29ed83c180 Add missing export on compatibility method
The destroy method on SegmentIndex is needed for backward
compatiblity, so it should definitely be exported in v2.6, as it was
for v2.5.

Change-Id: Id29faea5ae1719f1ea9201808aa9ce674574afc7
2020-05-08 23:40:57 +00:00
Sandra Lokshina 285cc73b1d Fix period flattening matching by role.
Matches for all streams. Пусть никто не уйдет обиженным!

Closes #2542.

Change-Id: I5cfa25c426c40125ab6532ad62ef08dbe2dc9f81
2020-05-07 19:40:27 +00:00
michellezhuo 252c41dbc3 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: I2e8764cfabdcc675a94e26bd9cd18cbc056a35f9
2020-05-06 16:52:26 -07: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
Joey Parrish 80f53221fd Correct minimum supported Safari version in README
Also add a note to the MSE polyfill about restrictions being applied
in Player as well.  We used to restrict Safari versions only in the
polyfill, and I had forgotten about the other version check.

Closes #2548

Change-Id: I4d2f319939c3a079e7f0ec7134876d91fc425bf4
2020-05-05 14:47:08 -07:00
Sandra Lokshina 9f43011e0b Prefer original source stream when matching for period flattening.
When we construct final streams in period flattening, we start them
off original streams and then combine streams from each period that
best matches the characteristics of the original stream.
The original stream also participates in the matching process, but
it was possible for it not to get selected as the best match if
there were other streams with similar characteristics.
This change adds logic to always prefer the original stream if
it's encountered.

Also, this change adds a bandwidth comparison for audio
streams to ensure the closest streams get matched bandwidth-wise.

Issue #2537.

Change-Id: I5d99a452a12ea1c4bb70fa8aba4bec479ff9d27b
2020-05-05 21:19:20 +00:00
Joey Parrish 77f483b374 Update changelog for v2.5.11
Change-Id: I8f3bc86157c52b7ea505336f5f5aebb2deb2d482
2020-05-05 17:11:22 +00:00
Joey Parrish 5f62f4e779 Clean up use of "self" in arrow function
There is no need to use "self" to capture "this" with arrow functions.

Change-Id: I8d4c2251292d7e27952770b2d45f34fbdfceceb6
2020-05-05 09:13:43 -07: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 74d3dc08fc Add backward compatibility for SegmentIndex release
We changed SegmentIndex from IDestroyable to IReleasable since v2.5.x,
so this adds compatibility for the v2.6 release to avoid breaking
existing apps.

Change-Id: I3a12eec98c9af58fe08f0aec7e499266b70e9b48
2020-05-02 14:56:00 +00:00
Joey Parrish aeaa285916 Fix export annotation on abstract IReleasable
It does not make sense to truly export an abstract interface.  This
should always have used the exportInterface annotation.

Change-Id: If170b41b89728dd549669cee0c606de492b79ad9
2020-05-02 14:55:55 +00:00
Álvaro Velad Galván 46c8ed49bc Add roles in text and audio tracks (src mode) using the kind parameter (#2543) 2020-05-01 10:42:48 -07:00
michellezhuo dc32bd88ba Remove extra text track generated by SimpleTextDisplayer in src= mode
When SimpleTextDisplayer is constructed, a TextTrack is created,
and that cannot be removed. This introduces an extra TextTrack when the
content is played in src= mode.

This is the straight-forward solution to filter the extra TextTrack out
by the label in src= mode.

Issue #2516

Change-Id: I8c417f837e4ad2f90ec779b533c8484de9e22b11
2020-05-01 16:48:04 +00:00
Joey Parrish 1076b78465 Unfork Closure base and update the compiler
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
2020-04-30 19:32:30 -07:00