Commit Graph

1261 Commits

Author SHA1 Message Date
michellezhuo fb0d819f1c Verify period flattening with multiple representations of the same
resolution

Closes #2517

Change-Id: I7102153f2df83b8ad66411e709fdaf5a5a043b53
2020-04-27 18:41:04 +00:00
Theodore Abshire 087c1ba247 Allow offline downloads to be aborted.
You can either abort downloads one at a time, using the
AbortableOperation interface, or you can implicitly abort them all at
once by destroying the storage instance.

Closes #2417
Closes #1362
Issue #1301

Change-Id: I0ba102e5bf60a063f0e2f6ecd3f135445226996f
2020-04-24 20:43:54 +00:00
Álvaro Velad Galván e246855c63 Add variable substitution support to HLS parser (#2509)
Resolves #1561
2020-04-24 12:37:11 -07:00
Joey Parrish db42d7e436 Revert "Fix bogus text track in UI with src= mode"
This partially reverts commit ad3d4604, because that fix seems to have
caused #2523.

This also adds a regression test for #2523.

Reopens #2516
Closes #2523

Change-Id: If3ed5942fff029f522e24048edcb4a04e7cc30e9
2020-04-23 21:33:28 +00:00
Álvaro Velad Galván 9104c1d68e Fix metadata tracks for live server side ad streams (#2500) 2020-04-23 14:09:54 -07:00
Sandra Lokshina 8cb5001984 Replace our skip button with the IMA's default one.
According to the agreement with the IMA team, we will
no longer hide their UI during ads. Instead we will
incorporate their elements into our layout.
(Some of the elements they expose are legally required
or business critical for partners for certain types of
ads).
This change replaces our skip button with the IMA one
and tweaks our layout to make it fit better.
We are keeping our ad counter and the 'Ad X of Y'
element.
Our skip button will stay in the library, and we will
use it for other (non IMA) ad integrations.

Change-Id: I648c6c65a34607685a409a264c2a03d74cc4d461
2020-04-22 21:03:11 +00:00
Joey Parrish 023827f7f6 Fix skipping of offline tests
Some tests in test/offline/storage_integration.js would manipulate
StorageMuxer to test what happens when storage is unsupported.  The
support was overridden in beforeEach and restored in afterEach.

However, all of this was wrapped in filterDescribe, which shims
jasmine's methods to run support checks and abort those methods if the
support check fails.  This meant that the test itself could be skipped
by filterShim onec beforeEach ran.  In fact, the shim would check for
support again before running afterEach.  So the cleanup in afterEach
was also skipped, leading to all future offline tests being skipped.

This, combined with the recently-fixed test bug where tests would run
in a random order, meant that in some cases, none of the storage tests
were actually running.

With the random ordering bug fixed, we were still skipping 25 tests on
the Linux version of Chrome, 19 of which were storage tests that
shouldn't have been skipped.  With --random, we were sometimes
skipping 30-45 tests in the same environment.  With the fix, we are
always skipping exactly 6, 3 of which are disabled for everyone and 3
of which require Widevine persistent licenses not currently available
on Linux.

Change-Id: I22f76d47b89ce52997278f5fe402af056c89f4c0
2020-04-21 15:50:12 -07:00
Joey Parrish 318ca6511f Fix test order stability with xfilterDescribe
When running tests with --random --seed, the test order should be
stable.  However, xfilterDescribe (the version of filterDescribe which
temporarily disables tests) was not actually defining the tests
inside, which led to a change in the order of the tests run.

This makes xfilterDescribe define the tests, but disable them all,
which makes the shuffled order with --seed stable again.

Change-Id: I382f1f719a5b9f846bcb23761cc63f96abf17759
2020-04-21 22:29:31 +00:00
Joey Parrish ad3d4604af Fix bogus text track in UI with src= mode
When the non-UI TextDisplayer is constructed, it creates an extra
TextTrack that can never be removed.  This leads to a bogus text track
showing up in the UI when content is played in src= mode.

This changes the TextDisplayer to disable the extra TextTrack (since
there is no API to remove it) and changes the Player to ignore
disabled TextTracks when generating a track list for src= playbacks.

Closes #2516

Change-Id: I2e651f737445049da5fa46a798a2bc0751de2822
2020-04-21 13:26:14 -07:00
Joey Parrish 05d1db50af Fix hung storage test
The test was blocking a network request, then letting it continue.
However, another change that landed around the same time introduced a
request cache inside Storage.  So the blocked request was cached and
shared between the test's two storage operations, leading to both
operations being blocked.

This was missed because the test order was accidentally randomized,
leading to an as-yet-unfound bug that caused this buggy storage test
to get skipped in some cases, and timeout or disconnect in others.

Fixed: 154522761

Change-Id: I657b0d4d4edb5142bd159f567e7bd2a80e1687f2
2020-04-20 17:35:09 -07:00
michellezhuo 030147c7f4 Avoid displaying duplicate vtt cues
Closes #2497

Change-Id: Ibc4de196f500d8685244217f9a056d8b12c05f8a
2020-04-20 22:58:45 +00:00
Joey Parrish d794b6337b Fix random test execution order
Jasmine 3+ defaults to random test order.  Since we own our own boot
file, we have to explicitly disable this if we want a predictable
order.  The unpredictable order has been uncovering some instability
and possible pollution between test suites lately, but before we can
address that, we need to stabilize our nightly test runs.  Then, when
hunting down these instabilities, we can explicitly use --random and
log the seed we used to get consistent failures once the failure is
identified.

This behavior was introduced to Jasmine in
https://github.com/jasmine/jasmine/commit/e31db20e and we unknowingly
adopted it in Shaka Player in
https://github.com/google/shaka-player/commit/b042a819 .

Bug: 154522761

Change-Id: I1b8b7b7f4e3d64746d61f019b1bd1d928d489f1b
2020-04-20 14:51:48 -07:00
Joey Parrish f0caf4067c Fix serialization of Error objects over Cast
When the Cast receiver throws an Error or rejects a Promise with a
non-Shaka Error, we need to represent it to the sender in a reasonable
way.  Otherwise, it can be very difficult to debug.

Related to the investigation of #2487

Change-Id: Ia58dd1e1e56ee93bea9afc9d368084d53c381db3
2020-04-17 21:41:01 +00:00
Joey Parrish 083099b127 Cleanup DOM after text displayer tests
These tests added a container to the DOM which was never cleaned up.
There is no impact to Shaka Player, and no performance impact to the
tests, but we should clean up after ourselves.

I found this by running the Karma/Jasmine tests in a foreground
browser tab at http://localhost:9876/debug.html .  After the tests
completed, I looked at the "Elements" panel in Chrome's dev tools.

Change-Id: Id81dddcb82b01eeb6445ddd701d2d3907c322a0d
2020-04-16 17:38:08 -07:00
michellezhuo 1f30becf13 Display nested cues in SimpleTextDisplayer
Closes #2263

Change-Id: I18af70e4ff69a1d27ef462678c0c49bacb74553c
2020-04-16 18:59:44 +00:00
Joey Parrish bca35edbe5 Fix Storage integration test failures
In Change-Id If885e828b4761528e40abdbc601a11cf13849a1e, I fixed a
memory leak, but broke offline storage.

In Change-Id I88b86d250b4407cc0740d35eaf4a7ef3d5a67798, I fixed some
of the test failures, but not others.  The tests passed on Chrome on
Linux, but later failed on other platforms.  It is not clear why they
passed some of the time.

When I changed offline storage to keep the parser alive until after
the storage operation is complete, this broke some test assumptions.
For example, the tests assumed that overriding manifest parsing would
be sufficient to make the URI irrelevant.  That is not true any more,
since the parser is created earlier in the process.

This changes the Storage integration tests to always invoke the fake
parser by using its registered MIME type, rather than relying on an
override of the parsing step.

The Storage integration tests are now passing on all supported
platforms.

Change-Id: I1ec0b186516d35156c761554ec2e610f784e254d
2020-04-13 21:05:59 +00:00
Joey Parrish 2f6ed0eb77 Recover from timed-out Cast connection
When a mobile device goes idle, the Cast connection can be terminated
without explicitly closing it.  When this happens, the Cast session is
unusable and throws exceptions.

This changes CastSender to correctly detect and recover from such a
problem by disconnecting explicitly and dispatching an Error to the
application.

This also fixes the disconnection process so that playback can be
correctly resumed on the local device.

Closes #2446

Change-Id: I59f51a1e911199eee22693e7db4ab39855de0298
2020-04-13 18:30:43 +00:00
Joey Parrish b2c4ef5cf3 Fix flaky src= integration test on IE/Edge
For some reason, on Edge and IE, starting this particular piece of
content at time 5 results in playback beginning at 4.9.  It could be
that the number is rounded to a keyframe or something.

This changes the test to expect the start time to be within 200ms of
the requested start time.

Change-Id: I5399a1eaf8a84b57a88359db2584f043e4a11e81
2020-04-10 17:59:44 +00:00
Álvaro Velad Galván 2807971e4e Add creationTime to offline assets (#2406) 2020-04-10 09:58:45 -07:00
Theodore Abshire a2a988d876 Allow for multiple concurrent storage operations.
In the process, this removes the in-progress flag, which should fix
issues where the storage instance can't be re-used after an error.

Closes #1432
Closes #2432

Change-Id: I51018e170fb9ab262b5c70125a03d979c8ccfb08
2020-04-10 04:33:11 +00:00
Joey Parrish ba5d062be6 Fix missing segments in offline storage
In Change-Id If885e828b4761528e40abdbc601a11cf13849a1e, I fixed a
memory leak, but broke offline storage.

The fix for the memory leak was to release SegmentIndexes and
SegmentReferences when the DASH parser stops, but offline storage was
stopping the parser before making use of the parsed manifest.

This changes offline storage to keep the parser alive until after the
storage operation is complete.

This bug did not affect any release versions.

Change-Id: I88b86d250b4407cc0740d35eaf4a7ef3d5a67798
2020-04-09 17:40:44 -07:00
michellezhuo 734d129fcd Add Support for HLS Discontinuity
Closes #2397
Closes #1335

Change-Id: I6f540c42c72bf0ae36239b682d4016cca3981c0f
2020-04-09 14:59:42 -07:00
Joey Parrish e24fec4b08 Flatten periods
This creates a new utility used by DashParser and old offline DB
formats to combine Streams across Periods.  This allows multi-Period
DASH content to be played without period-specific structures in the
manifest format, StreamingEngine, or Player.  This also makes the
Tracks stable across Periods.

Closes #1339 (flatten periods)
Closes #1698 (rapid period transitions issue)
Closes #856 (audio change causes bitrate change)

Change-Id: Icb04c8e47e36eacf7ac024a5063130d85a115e54
2020-04-09 19:22:16 +00:00
Joey Parrish 92dcc1e243 Prefer SegmentTemplate to SegmentBase in tests
In these tests, SegmentBase referred to init segments that did not
exist.  In period-flattening, we will be fetching segment indexes in
advance during parsing, so these bogus init segments would be fetched
and cause an exception.  Using SegmentTemplate avoids this for tests
are not concerned with SegmentBase specifically.

Issue #1339

Change-Id: I54990e95480dfbb59154fca72f12d277eca25701
2020-04-09 19:22:16 +00:00
Joey Parrish 6e3dfa40ba Deduplicate key IDs with Set
When period-flattening combines Streams, key ID arrays would get very
long with duplicates.

This changes keyIds in the manifest and offline structures from Array
to Set.

Issue #1339

Change-Id: I003d23e567efafa771ecd2ad597900181604ad18
2020-04-09 19:22:16 +00:00
Joey Parrish c4a5513ca5 Rename offline StreamDB.contentType to type
This brings the field name in line with the Stream objects from the
manifest types, allowing for more general processing of Stream and
StreamDB for period-flattening.

Issue #1339

Change-Id: Ic5d0e5d69a6560d475a19f5d3ecb0b1b40b8d271
2020-04-09 19:22:16 +00:00
Joey Parrish e8ac57f36c Move drmInfos array to Stream
Period-flattening will concatenate Stream objects, so this information
should be available per-Stream instead of at the Variant level.

Issue #1339

Change-Id: I96195fea48cab1e4a349b2ab0b16064a443e928a
2020-04-09 19:22:16 +00:00
Joey Parrish 5d07b5fbb7 Fix flake in high playback rate test
Something weird happens on some platforms (variously Chromecast, IE,
legacy Edge, and Safari) where the playhead can go past duration.  To
cope with this, don't fail on timeout.  If the video never got flagged
as "ended", check for the playhead to be near or past the end.

Also, wait for playback to begin before increasing the playback rate.
This improves test reliability on slow platforms like Chromecast.

Change-Id: If7d70de95b75e602853ec77ad1c285c118875db4
2020-04-09 19:22:16 +00:00
Joey Parrish 99de217c23 Remove periods from manifest structure
This removes periods from the internal manifest structure and cleans
up code and tests accordingly.  This leaves us unable to play
multi-period DASH & offline streams until the main period-flattening
algorithm is completed in shaka.util.Periods.

Three test cases have been disabled for the moment.

Multi-period playback will be restored in a smaller, more focused
follow-up commit, with disabled tests re-enabled.

Issue #1339 (flatten periods)
Issue #1698 (rapid period transitions issue)
Issue #856 (audio change causes bitrate change)
Closes #892 (refactor StreamingEngine)

Change-Id: I0cbf3b56bfdb51add15229df323b902f0b2e643a
2020-04-09 19:22:16 +00:00
michellezhuo 3b52166f56 Remove support for custom DASH ContentProtection schemas
Remove manifest.dash.customScheme callback function since it's no longer used.

Closes #2356

Change-Id: I6d08fcf97cff1bf2985e7c660d74efcd767eaed9
2020-04-09 09:11:20 -07:00
Joey Parrish fe36234951 Fix buffer check in StallDetector
mediaElement.buffered can never be null.  If nothing is buffered,
buffered.length will be 0.

The bug has been in this file since it was created in January 2019.
This affects all v2.5.x releases up to v2.5.10.

Hopefully this will address some seeking issues on Chromecast, though
that has not yet been confirmed.

Closes #1809

Change-Id: Iccc49d299cdac9fccdafdfc2d35e5b2376cff644
2020-04-08 21:31:10 +00:00
Joey Parrish 94f07dd410 Fix ratechange events w/ src= playback
The Player ratechange event is a filtered version of the video
ratechange event.  This is necessary because we manipulate
playbackRate as part of our buffering state management.

The UI uses this Player ratechange event to drive the playback rate UI
menu, but the event was not firing for src= playbacks (native HLS or
plain MP4s).

This fixes the ratechange event for src= playbacks, and also fixes a
small mistake in the MediaSource setup that could have resulted in the
ratechange event being triggered before playRateController_ was
created.

Closes #2488

Change-Id: If85e489d681cfbb1ae6141b490d82264e1d932bd
2020-04-07 23:36:07 +00:00
Sandra Lokshina fcc27b144a Hide overflow menu while ads are playing.
Change-Id: Ia77f0996c919e78b0a08b90e878c5615dcccf5bf
2020-04-07 18:32:13 +00:00
Sandra Lokshina ccc05ac14c Add ad manager tests.
Issue #2469

Change-Id: Ibf17caba5e99e1cd41f1da4b5cc472f815b10e2e
2020-04-03 10:54:54 -07:00
Sandra Lokshina 8107d1dfb3 Restore original ad manager factory after ad UI tests.
We suspect this is related to test failures on the ad tests CL.

Change-Id: I90265153a128eec926cfdf3eb61b078cb4d98ae5
2020-04-03 17:53:24 +00:00
Joey Parrish bf5e0e254b Fix SegmentIterator after evict
After evicting segments from a SegmentIndex, SegmentIterator should no
longer start at 0.  So instead of starting at 0, start at the earliest
position, which is returned by find(0).

Change-Id: I512ffb10a7f09f52930c5afbd783db063e9ebd66
2020-04-02 21:46:13 +00:00
Álvaro Velad Galván ad33625a11 Add non-standard DASH PlayReady UUID (#2474)
Resolves #2440
2020-04-01 09:54:42 -07:00
Joey Parrish f151f55da9 Fix nested TTML cues with non-ASCII characters
A regex in the TTML parser was looking for "word" characters (\w),
which is short-hand for non-whitespace ASCII characters, and excludes
Unicode characters and symbols from non-English languages.

There is a better option in Regex in some browsers, which is /\p{L}/u.
This is not supported universally yet, and defining an equivalent
regex constant using character codes is over 4kB of extra code.

It seems that the original author of that code meant "word" (\w) in
the sense of "non-whitespace" (\S), so we can just use \S instead.

This change also adds a regression test that doesn't depend on the
specifics of the regular expression used.

Closes #2478

Change-Id: I794258a797ba5d26a7bd8fc0a5244adc70c8a1ef
2020-04-01 16:08:48 +00:00
Jacob Trimble fda84c0343 Use waitForMovement in DRM tests.
This could help test failures on Windows since the video doesn't start
playing after the 5 seconds.  If it fails, we'll also get more
debug information for it.

Bug: 146050219
Change-Id: I1be5156350a591762022664feb05975470bbf92d
2020-03-27 15:56:58 +00:00
Sandra Lokshina f4a2b858d7 Refactor player out of SS ad manager.
Issue #2367

This also accidently fixes showing seek bar on ad end for
SS content.

Change-Id: I52241df9861f27d50976f0ce7309c7c14092463a
2020-03-26 17:13:26 +00:00
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
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 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
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
Sandra Lokshina 9a19821292 Add timeline ad UI tests.
Issue #2367.

Change-Id: I49042992f4462f35e48292e79a09fef779494faa
2020-03-11 18:52:16 +00:00