Commit Graph

3484 Commits

Author SHA1 Message Date
Joey Parrish e018aaaaba Fix potential memory leak in SegmentIndex
SegmentIndex has had a destroy() method for a long time, but it has
never been called.  Now that SegmentIndex has a timer which adds new
references for DASH SegmentTemplate live streams, it is more important
than ever to properly stop this active part of SegmentIndex.

This change replaces async destroy() with synchronous release() and
calls it from Player when the manifest is being disposed of.  This
will ensure that SegmentIndexes don't grow out of control after
content is unloaded.

This would not have affected v2.5, since we didn't have this
timer-driven growth of DASH SegmentTemplate live streams in that
release branch.

Related to #1339 (fixes issues introduced for period flattening)

Change-Id: I419a06a62eaa507d92132e20d4cc2d6e45c83ff2
2020-03-23 10:21:13 -07:00
Joey Parrish 1ab3f9c6db Remove position from SegmentReference
As part of Period-flattening, I'm trying to remove our dependence on
the "position" field of SegmentReference.  With that eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.

 - Make SegmentIndex iterable
 - Add specialized seek() and current() methods to SegmentIterator
 - Remove position from SegmentReference
 - Make positions in SegmentIndex API stable without field in
   reference
 - Remove brittle hard-coded positions in tests (except SegmentIndex
   tests, where they would be hard to avoid in testing methods
   separately)
 - Use SegmentIterator in StreamingEngine to track the next segment
   between switches

Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)

Change-Id: I666cc21249c34ee6cbc138a59109d9f1159fa127
2020-03-23 10:09:35 -07:00
Joey Parrish 6202b9372e Revert "Move next-segment tracking to SegmentIndex"
This reverts commit 235e4e11ad.

The effort to remove SegmentReference's position field will be handled
in a different way.

Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)

Change-Id: I62b115137abc89f498b30467e574b0401dcad05d
2020-03-23 10:09:35 -07:00
Joey Parrish 88ebd5bcd7 Add translations for tier 2 languages
These are not compiled into the library by default, but can be with
the --locales option to either build/build.py or build/all.py.  They
can also be lazy-loaded on-demand, as in our demo app.

There are still some missing translations for Finnish ("fi"), Hebrew
("iw"), and Indonesian ("id").

This also corrects the list of tier 1 default languages in the build
scripts.

Change-Id: I992d7bebbb4e04d55b7992ecaee1d85bb6c1c5da
2020-03-23 16:56:37 +00:00
Joey Parrish b7b0456136 Update tier 1 & metalanguage translations
This updates the translations for all tier 1 languages and
metalanguages (ar-XB, en-XA).

Change-Id: Iea6b5b23f74fedacbf03284d514ede11a187496d
2020-03-23 16:56:37 +00:00
Jacob Trimble 113884ee34 Fix UTCTiming tests.
This removes the tests added by #2412 since they didn't test what
was wanted.  This also fixes our existing tests to ensure they work
with autoCorrectDrift.  Lastly this adds a new test to ensure the
UTCTiming is ignored when autoCorrectDrift is true.

Change-Id: If511fca5d3f360cdf373229961b2a01fdbda31bb
2020-03-20 11:41:09 -07:00
Joey Parrish 817c2157a8 Fix test flake in very large MPD test
While fixing cherry-picks for v2.5.x, I found that the test for
parsing very large MPDs would fail on that branch because it referred
to segments that do not exist locally.  This changes the MPD to refer
to local segments which can be loaded, which is important on v2.5.x
where the load() call can fail if the first segment fails.

This tweak makes the test work universally on both branches.

Change-Id: I97284aa964034bf5768abdb97f06b2a1e371d865
2020-03-18 15:41:49 -07:00
Theodore Abshire a993fd6b0c Resize ad after 'loadeddata' event.
Before, we depended on the 'loadedmetadata' event to know when to resize
an ad. However, on Safari, that event would sometimes fire before the
video element had changed to its final size. This would result in the ad
being the wrong size.
This changes the ad manager to instead wait for the 'loadeddata' event,
which happens later in the loading process.

Closes #2462

Change-Id: Ie0470eb894034e1427a0767c771a01f801d0f9b4
2020-03-17 15:33:16 -07:00
Theodore Abshire d1dce29e89 Added 'doubleClickForFullscreen' config to UI.
This configuration, which is true by default, lets a user optionally
disable the "go fullscreen on double-click" functionality.
This allows a developer to fully disable fullscreen mode, if they so
wish, or to retain the fullscreen button but disable other methods of
entering fullscreen.

Issue #2459

Change-Id: I196602fc9843e0fd799c78703de60f864e906841
2020-03-16 17:03:53 +00:00
Álvaro Velad Galván 935040a3b5 Add ebutts:linePadding to ttml parser (#2443)
https://tech.ebu.ch/docs/tech/tech3380v1_0_1.pdf Section 2.1

Resolves #2407
2020-03-13 11:22:19 -07:00
Peter Nycander 9b08525efe Tizen2.4 bugfixes (#2449)
`'webkitneedkey'` events are fired with the same `event.initData` for the video and audio tracks, and a new session is needed for each.

Closes #813 (duplicate sessions required on Tizen)
Closes #2447 (polyfills broken on Tizen)
Closes #2448 (PlayReady broken on Tizen)
2020-03-13 10:24:41 -07:00
michellezhuo b1d58ceafb Verify presentation delay with 1 decimal point
Fixes b/151237175

Change-Id: Ibdcbfa86290051a0a8242e9e485194af7d4af833
2020-03-12 22:35:05 +00:00
Theodore Abshire a8927828e8 Add search filters to the URL.
Closes #2422

Change-Id: I567ad6b0368badcf1e8e2535a640adc650f4daea
2020-03-12 12:03:09 -07:00
Jacob Trimble 3fa7472086 Add non-nullable modifier to return types.
This is a copy of the internal CL: cr/299901617.

Change-Id: I49abbde9563f08819ec99dbc9deb99b66dd8053b
2020-03-11 15:46:06 -07:00
Sandra Lokshina 9a19821292 Add timeline ad UI tests.
Issue #2367.

Change-Id: I49042992f4462f35e48292e79a09fef779494faa
2020-03-11 18:52:16 +00:00
michellezhuo c82ff51d1f Add a presentationDelay config for HLS live
Closes #2373

Change-Id: I627bbd226ed9cab9bc476e2c2a3257d2e2dbc0e9
2020-03-11 18:41:15 +00:00
Theodore Abshire daa316643a Fix compiled release version of supportsChunkSize.
In the code for supportsChunkSize, we test to see if a given chunk
size is supported by array to string conversion by trying to perform an
operation on a Uint8Array of that size without throwing an error.
However, the result of that operation was only ever referenced inside an
assert. Because asserts are compiled out in release builds, the
result of that operation was not being used... and thus, the entire
call was being compiled out.
This changes the return value of the function to use the result of the
operation, thus preventing it from being compiled out.
This also adds a unit test that will detect this problem in the future.

Closes #2433

Change-Id: If3048531afc460beb16de0dda7f7fcbd5499fdaf
2020-03-11 18:17:31 +00:00
Joey Parrish 235e4e11ad Move next-segment tracking to SegmentIndex
As part of Period-flattening, I'm trying to reduce our dependence on
the "position" field of SegmentReference.  If it can be eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.

SegmentIndex can now track the last reference you asked for and
iterate through the list of references.  This means we don't need the
"position" field of SegmentReference, which means we don't need to
know positions in advance or globally.  StreamingEngine will no longer
use position to request segments.

The old methods find(time):position and get(position):SegmentReference
have been replaced with seek(time), current(), and next(), all of
which return a SegmentReference and maintain an internal pointer to
the "current" reference.  Care has been taken to maintain that pointer
during the evict() and fit() operations.  Recent changes to merge()
made sure that the pointer does not need to change during that
operation.

All test updates are related to the SegmentIndex API change, not
changing expectations or behavior.

Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)

Change-Id: I1682dcc2dd625c6e390711538e46d31e6eb6cea8
2020-03-11 18:14:14 +00:00
Joey Parrish 3cdb9c8e16 Simplify SegmentIndex merge
As part of Period-flattening, I'm trying to reduce our dependence on
the "position" field of SegmentReference.  If it can be eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.

There has long been a comment at the top of SegmentIndex's merge
method stating that we only ever extend the references, but never
interleave them.  The code, however, is structured in such a way that
it could interleave them.  This could cause the offset of a given
SegmentReference in the Array to change, which would be counter to the
comment about only ever extending the list.

This change simplifies merge() so that it can only ever extend the
array of SegmentReferences.  This will guarantee that their offset
within the Array will not change during the merge operation.  This, in
turn, enables further SegmentIndex changes to move "next" segment
tracking out of StreamingEngine (where it is based on the "position"
field of SegmentReference) and into SegmentIndex (where it could be
based on offset into the Array of references).

It removes one test related to PR #838.  This test was about our
ability to update the position of the final segment in a list.  This
doesn't seem to make a lot of sense, and we're going to stop relying
on segment position anyway.

Issue #1339 (period-flattening)

Change-Id: I2067e2266cf2d02c0e6350d6b57d74f9ed1b27d3
2020-03-11 18:14:14 +00:00
michellezhuo 9d2592db17 Avoid getting start time / end time from null newSegment
If the newSegment is null, we should not call getStartTime() or
getEndTime() with it.

Change-Id: Ia1d548cabd33713e02f36176b2b9eab58ce54f94
2020-03-11 17:56:42 +00:00
Sandra Lokshina 30131c3d7c Add more ad UI tests, augment loc string for ad position.
Issue #2367.

Change-Id: I562ef9e6c6a84a4a113792b647a5c663bcd822bf
2020-03-11 16:47:31 +00:00
Joey Parrish 97b4f3d47d Update service worker cache name
In preparation for v2.6, update the service worker cache.  Old caches
will be dropped, which should clean up any extraneous resources cached
by the v2.5 version.

Change-Id: Ief45857ba6033d65e4b267463f0a12a670b71535
2020-03-10 14:51:18 -07:00
Joey Parrish d224fc46a5 Activate service worker updates right away
Instead of waiting for all active pages to be closed and the old
service worker shut down, activate the new service worker right away
as soon as it is installed.

Change-Id: Ia49b6f44d026a934f46cb5cf2a86dc9de9274b0c
2020-03-10 14:51:18 -07:00
Joey Parrish e235a4fcbe Complain about missing resources for compiled-mode PWA
If the demo app is running in compiled mode, the PWA service worker
will now complain about any local resources that are requested by the
app but not marked for caching.  This helps catch missing resources in
the service worker's resource lists.

Change-Id: Ia7f65f8ca6679e5c4ba29a1474a42aa97f33278b
2020-03-10 14:51:18 -07:00
Joey Parrish ebfde6422d Don't cache everything from the demo origin in service worker
Before this change, location.origin appeared in a list of cacheable
URL prefixes in the service worker.  This was a lazy way of making
sure that all node modules, translations, etc. would be cached without
being explicitly listed.  But it also meant that we could wind up
caching the uncompiled sources, which can complicate debugging if they
are inadvertently pulled from cache on reload.

This change adds the missing local resources that can't be listed
explicitly (translations, logos) by using absolute URL prefixes.

Change-Id: I4963516ec392e7607f86bc891bcdcf46c141951d
2020-03-10 14:51:10 -07:00
Joey Parrish 3d3a2c7fb9 Convert relative URL list to absolute in service worker
The URLs of critical and optional resources will now be converted to
absolute URLs.  This will allow the exact URL matching against those
lists to work, which will let me subsequently remove location.origin
from the list of cacheable URL prefixes.  (In a follow-up commit.)

Change-Id: I886d11435c96944f9b50ebf937dd329357f5c257
2020-03-10 14:50:29 -07:00
Joey Parrish f76624545e Fix exact URL lookup for PWA cache
Some of the request URLs in service worker fetch events contain has
parameters, which breaks our exact URL lookups for critical and
optional resources.  This fixes the lookups by removing hash
parameters.

Change-Id: I56b22a2faa42e2f3c28bd82fae4e8feedc83d408
2020-03-10 14:50:26 -07:00
Joey Parrish 25f28f8301 Add missing node modules and IMA SDK to PWA cache
Change-Id: I20d45fd729c487c55b88e695a213cd3955b54241
2020-03-10 14:50:10 -07:00
Joey Parrish 5387bf6f46 Fix missing await in service worker
Without the "await" on timeout, try/catch would not catch a timeout
error, leading to request failures in some cases.

This bug is present in v2.5.x as well as the master branch.

Change-Id: I3a0c8cd46265d41bade8117edd3cb92ac597d4fd
2020-03-10 14:50:00 -07:00
Joey Parrish 928585c151 Fix UI exception joining existing cast session
this.video_.classList is undefined once video_ becomes a proxy object.
UI-related things (CSS, tab indexes, sizing) should always be done on
this.localVideo_ instead.

Closes #2451

Change-Id: Id6b007f3bf089bdf8fd532e2832f7b909c9fdf97
2020-03-10 13:28:12 -07:00
Joey Parrish 09147b1273 Update references to "search" tab to "all content"
Change-Id: I77dcc3055b58216db26de7a003b0fd980c779e76
2020-03-10 17:14:51 +00:00
Sandra Lokshina 6adc977022 Add tests for ad UI (adUIContainer, skip ad button).
This change creates mocks and fakes for ad testing and adds
tests for the ad container and skip button. Skip button
tests found a bug - this CL also fixes it.

Issue #2367.

Change-Id: I36cb293f9611fbc8592bdc32e156f17a7a78e010
2020-03-09 16:33:10 +00:00
Tanya Gelahova d6de4e710d Add support of fontSize in percentages and cell resolution unit for TTML captions (#2442)
Closes #2403
2020-03-06 08:53:24 -08:00
Joey Parrish b0238c3c00 Stop using segment position in HLS parser
As part of Period-flattening, I'm trying to reduce our dependence on
the "position" field of SegmentReference.  If it can be eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.

The HLS parser uses positions to find previously-resolved segment
times when refreshing a live playlist.  What we're really doing is
using HLS media sequence numbers, since we use those to assign the
segment positions in the first place.

This change makes the use of media sequence numbers more explicit, and
adds a per-Stream map from media sequence number to segment start
time.

The only other users of segment positions are StreamingEngine and
various tests.

Issue #1339 (period-flattening)

Change-Id: If970ed2c8722ed5779a51349ca2e64208d78130d
2020-03-05 22:47:09 +00:00
Theodore Abshire ea0131dc80 Remove aliases for BufferUtils in DrmEngine.
That alias was confusing the closure compiler, and causing it to
produce invalid output when making release versions.

Closes #2438

Change-Id: Ic232ce4f29222543b13c2cc725ffefaedea29e3a
2020-03-04 16:31:18 -08:00
Joey Parrish 95a2814e75 Re-enable DASH live sim streams
Now that Dash-Industry-Forum/dash-live-source-simulator#91 is
resolved, we can re-enable these streams.

Change-Id: I958ccdbf48741703d46d00c4e69a0fc3916249b7
2020-03-04 12:04:25 -08:00
Sandra Lokshina 604396cf93 Clear ad breaks from timeline on ad request failure.
Issue #2437

Change-Id: I763dc8f68348d56713d2b6703591ef9a3b93edb6
2020-03-04 19:34:10 +00:00
Joey Parrish 7b80252408 Improved ClearKey Example (#2439)
Improving documentation for DRM-Configuration for ClearKey

Closes #2434
2020-03-04 10:26:07 -08:00
michellezhuo 2223710ac9 Support multiple EXT-X-MAP tags
One playlist may contain multiple EXT-X-MAP tags, and each EXT-X-MAP tag
represents the initalization information for the segments after it,
until the next EXT-X-MAP tag or the end of the playlist.

Issue #1335
Closes #2397

Change-Id: Ibb0b4f5da6a48f0303d205cb6bd3abad278527fd
2020-03-04 18:03:00 +00:00
Joey Parrish 57ce383b38 Add loaded event (#2441) 2020-03-04 09:57:56 -08:00
Joey Parrish 06a44fae8e Fix adaptation event tests in uncompiled mode
These tests failed an assertion because they did not respect the rules
for AbrManager.  In compiled mode, this went unnoticed because asserts
are removed in the compiled bundle.  But when running tests in
uncompiled mode, these would always fail the assertion and therefore
fail the test.

Change-Id: I44700d118f3f45ebcc955d9306deaca4815b902e
2020-03-03 14:42:48 -08:00
Joey Parrish 270a547718 Clean up outdated references to "period-relative"
Segment times and positions are no longer period-relative.

Issue #1339

Change-Id: If2b1b7d56ac49d50439598403f681a2da88ce605
2020-03-03 21:53:11 +00:00
Joey Parrish 8554539299 Update prerequisites script w/ new nodejs versions
Debian stable and Ubuntu LTS now both have usable nodejs packages.
When possible, we will use those.  In older distros, we will still
install packages from nodesource.  The nodesource version has been
updated to v10.

b/150687293

Change-Id: I25f14fbc1751aea1ac1d51cb38f8736d34a601e6
2020-03-03 10:57:24 -08:00
Sandra Lokshina 6d66695075 Clear ad break markers on asset unload.
Change-Id: I83dd90015a591183f36ee34fe25c7591e4fadd56
2020-03-02 15:18:59 -08:00
Sandra Lokshina 3a18f1c087 Add ad markers to the seek bar.
Issue #2367.

Change-Id: I6757ac2195b06a205d298082ea7b3d8e3fcc6d8e
2020-03-02 19:44:14 +00:00
Theodore Abshire 25396ce403 Load pwacompat through npm.
Loading pwacompat off of jsdelivr was flagged as a security issue
through an automated scan. Since Google does not control jsdelivr,
that is theoretically true.
This just loads a local version of pwacompat via npm, and uses that
instead.

Change-Id: Iba9288a1d440dfdfa039a32b530f6da981c5b055
2020-02-28 10:43:14 -08:00
Theodore Abshire 277dd859b4 Replace Live search boolean with a drop-down.
This adds an option for searching for VOD. It also changes the Live
search option to be a drop-down instead of a toggle, so as to prevent
users from trying to search for assets that are both Live and VOD.

Change-Id: Ib03a64128aea6d06baff23fc1d909090fdf7ef79
2020-02-27 21:34:51 -08:00
Theodore Abshire 192cb9d1f7 Replaced "Undefined" with "---" in demo.
"Undefined" was a bit confusing as a search term... does it mean
that you aren't searching for anything, or that you are searching for
things with "Undefined" as a value?
Hyphens are a clearer non-search value.

Change-Id: Ie2a542620265ae1f1ca167f18ca311d15d76acf7
2020-02-27 15:22:52 -08:00
Theodore Abshire bb3994ba53 Renamed the "SEARCH" tab to "ALL CONTENT".
Naming the tab "SEARCH" was potentially confusing to users.
"ALL CONTENT" is probably a more intuitive description of what
the tab does.

Change-Id: I45b6b28fe2d59339c7c6fbf744f587937175d1f1
2020-02-27 15:20:12 -08:00
Theodore Abshire 7a0c41a1d7 Remove the "Unknown" source.
No asset was using "Unknown" as a source, and it was taking up
space in the search drop-downs and being confusing. It was only used
when loading unknown assets from the URL... but then, the source of
an asset loaded from the URL is more or less irrelevant, so that
doesn't really matter.

Change-Id: I1e20c717351aaf66f8a2b3fa25422ed884c7fd80
2020-02-27 14:42:59 -08:00