Commit Graph

1631 Commits

Author SHA1 Message Date
Aaron Vaage cb4e35229b Be more explicit in DrmEngine destroy
We do a lot of tear down in DrmEngine at the same time. While this often
works well for common tasks, when tasks focus on different parts, it can
introduce some race conditions.

This change looks at being a little more strict about the order we do things
in DrmEngine destroy.

While this does not fix #1728, the hope is that this will correct the
"read property 'catch' of undefined".

Issue #1728

Change-Id: Id3cd25b416969ecd75a8cdd6d36959e34673fa1b
2019-01-04 21:27:56 +00:00
Aaron Vaage 58d4163401 Add Important Note about Media Source Engine Construction
When we create a media source engine instance, we pass in
a closed captions parser. However a key subtlety was missing
from the parameter description; media source engine is taking
ownership over the parser.

Change-Id: Id49483ccac4cc1812c31ead9e82c09390ce2ed37
2019-01-04 17:18:31 +00:00
Theodore Abshire e5b2428c6f Also use large gap threshold on Chromecast.
It appears that Chromecasts stop a fraction of a second before a gap.
This would sometimes cause them to stall on gaps in a way that the
stall prevention would not fix.
This changes Chromecasts to use the large gap threshold, to fix those
cases.

Issue #1720

Change-Id: Ifc6720e55ab35b81b8592dad2ba7e7293983a755
2019-01-04 03:50:26 +00:00
Michelle Zhuo 4cd5666d84 Clear closed captions map when text engine is destroyed
Change-Id: I610334e6ad187a09e8831cde285d9a0e38876aad
2019-01-02 16:28:53 -08:00
Aaron Vaage 25e92be2c8 Isolate and Highlight MuxJS Dependency
To make it clearer that the CloseCaptionParser uses MuxJS (and therefore
it requires MuxJS) it has been renamed to be MuxJSClosedCaptionParser. To
further isolate the dependency on MuxJS, the support check that we must do
before using the Caption Parser has been moved to a static function on the
parser.

Change-Id: If3385f192434d8f8ce0c1cadbc6365a7c5df9d5d
2018-12-26 21:16:49 +00:00
Aaron Vaage e610c09ee5 Make Chromecast Tests Use Platforms
We have a utility to test what platform we are running on. It looks
like the chromecast tests were not making use of it.

Change-Id: I0eddbf1fe1aa2c1707947a3c268672a3808ec4dc
2018-12-26 18:30:14 +00:00
Aaron Vaage 9e180712f4 Update Timer to ES6
Updated the shaka.util.Timer class to ES6. In this upgrade, the implementation
was slightly changed to make better use of arrow-functions.

Documentation for the class was expanded on to better document how multiple
calls to start would work. To ensure consistency, both "schedule*" methods were
merged into a single "start" method.

Issue #1157

Change-Id: Iae86cae4d9cb751f0985ef20c371c0023c40bd53
2018-12-21 23:39:54 +00:00
Michelle Zhuo 337c1a9f02 Create closed caption parser only when mux.js is loaded
Issue #1404

Change-Id: Ic65bdf1254c379dc44770e26d777728cf255eb82
2018-12-21 21:35:25 +00:00
Aaron Vaage 66377ecfff Use Timer In Playhead Observer
Before, we would schedule (and reschedule) the poll function in the
playhead observer. We do this a lot in other classes and even have a
timer class to do that.

This change updates Playhead Observer to use the Timer class to handle
the polling events.

Change-Id: I5982ab08de47d4f8a71ab467989f63c06d0853d2
(cherry picked from commit b8a807b2ef0b2906ee3856a9b2a5dc4922973679)
2018-12-21 20:04:24 +00:00
Aaron Vaage c861cb8688 Correct Assertion For Initializing Deprecation
It looks like the assertion for deprecation was inverted, it
would expect that the enforcer was created even before the
first call.

Close #1744

Change-Id: I74b0321d8db497612b29aaac59678373587b2a8a
2018-12-20 21:22:28 +00:00
Joey Parrish 4f08dab6fb Stop resizing the play button in JS
Make the play button and spinner a simple 15% of video width.

Fixes b/116328412
Fixes #1715

Change-Id: I31708d0066a033e64ebdeb9fa603688c5f99860b
2018-12-18 22:40:10 +00:00
Aaron Vaage 41f0f0e560 Don't include video roles in audio-language-role pairs
Rather than using tracks (that merge the roles) use the streams when
creating the audio-language-role pairs.

The reason we tried using tracks was to remove the need to handle
audio muxed into video streams. With this change, that problem is back
but we fixed the broken behaviour.

Issue #1731

Change-Id: I837406469195956089f33f93f4a9e3c64ffbeab2
2018-12-17 17:19:44 -08:00
Aaron Vaage 8c69ab1a76 Stop passing "is live" to |Player.applyPlayRange_|
|applyPlayRange_| in |Player| was previously passed |isLive| but that
value would come from the timeline that it was already passed. Instead
of passing in |isLive| this updates |applyPlayRange_| to check the
the timeline for the "is live" condition.

Change-Id: I13efccd14b9177d2fd652347dce55338d74b7ec8
(cherry picked from commit d02959f3288ec140098d555559bcab9c51d02ca7)
2018-12-14 23:02:12 +00:00
Tomáš Tichý e3739c9495 Add safeSeekOffset to StreamingConfiguration (#1726)
Closes #1723
2018-12-14 11:01:50 -08:00
Jacob Trimble 5ee470ddbe Favor license URL in configuration over manifest.
This is consistent with our other configuration settings that are
used as overrides and the manifest values are used as the default.
This means for the manifest URL to be used, there needs to be no
license server URL given in the configuration.

Issue #484

Change-Id: Ib332fe66cd0b13613a17b4ca59496c5185ee65c9
2018-12-14 16:25:33 +00:00
Aaron Vaage 7426cfa1f0 Resolve SessionDeleter Compiler Warning
It looks like the lack of a constructor is at the root of the compiler
warnings when you try to alias a class.

To stop the error, I have made a small modification to the session
deleter class so that it could have a constructor.

Change-Id: Iad4614d80dc317b20f01930019096fb388b74ed9
2018-12-13 19:12:42 +00:00
Tyler Daines 3c8241f3c7 Add license url parsing (#1644)
This adds parsing license URLs to the DASH parser so the URL can be embedded in the manifest.

Fixes #484
2018-12-13 10:58:27 -08:00
Joey Parrish 2872f31e01 Add polyfills for Safari 12
Now that we have Safari 12 in the lab, we have found that it requires
the same MediaSource polyfills as Safari 11.

Fixes b/120434307

Change-Id: I45f8be79d0aca7987ffcba1ce13b8589a2287712
2018-12-12 10:47:39 -08:00
Aaron Vaage 1b90e0f4c1 Integrate Deprecation Tool With Library
This integrates the deprecation tool with our library and updates
all the deprecated warnings to use our new tool.

As some features needed to be removed in 2.5, this change removes them
since their deprecation checks would make us fail.

Change-Id: I28310bbe9df6839719f4763a96026d5968bdcea6
2018-12-12 00:26:50 +00:00
Aaron Vaage 161464b802 Define Deprecation Tools
Define a set of tools that we can use to track, test, and communicate
features that are being deprecated.

When you want to communicate that a feature is now deprecated, you just
need to put:
  ```
  shaka.Deprecate.enforce(MAJOR_VERSION_NUMBER,
                          MINOR_VERSION_NUMBER,
                          'Your message about what is being deprecated');
  ```

This will now print warnings when the feature is waiting to be removed and
print errors and fail asserts when the expiration has passed.

Change-Id: Ic66c53ecdfba7922cf961c7f588ab06beceb16ac
2018-12-12 00:26:50 +00:00
Aaron Vaage 0dbd2d2a4e Define Deprecation Version Class
Define class that will be used by the deprecation system for handling
library versions. We are only going to support deprecating at a
minor-version number level. We are able to use this to our advantage
when implementing Version as it makes the code MUCH simpler.

Change-Id: I041bc8d7c20a277d84fb621479b3116e3751e319
2018-12-12 00:26:50 +00:00
Aaron Vaage c559898f83 Update getGapIndex threshold comment and logic
The original threshold logic in getGapIndex was for IE/Edge
bust was later updated to include Tizen. However the comment
around it was not updated.

This change updates the comment and the code to better
communicate what all is affected.

Change-Id: I05638a5e51e6052946c67c3bc2850d0347c1ce21
2018-12-10 22:10:30 -08:00
Aaron Vaage 4167b1658b Isolate Platform Checks
To make it easier to know where we are check what platform something is
(normally a sign of a work-around), this change isolates the logic to
make the check into functions.

Now looking for uses of |shaka.util.Platform| should show when we are
using platform-specific logic.

Change-Id: Ief49837c503e951f7138ec08a83355fe1c46db88
2018-12-11 05:43:52 +00:00
Joey Parrish 436baa3343 Tolerate loadNewTextStream during startup
To fix the race in #1696, StreamingEngine now checks its state in
loadNewTextStream to ensure that it does not start a race between
the startup phase and the new text content.

Fixes #1696

Change-Id: I0f323a5d56b0585fb6e356308aa9eedeee8156b2
2018-12-07 16:39:09 -08:00
Joey Parrish 2b004f9380 Clarify code to auto-show subtitles
Vaguely relates to the investigation into issue #1696

Change-Id: I5d16f5cbdabf72361598e28bff196a5be7030967
2018-12-07 16:33:14 -08:00
Michelle Zhuo fd91f6ab73 Fix relative location urls
Fixes #1668

Change-Id: Ib9e1a19254f1829795bd69cc930d21f33e136980
2018-12-07 20:01:10 +00:00
Aaron Vaage f09d5d7a6c Pass ClosedCaptionParser into MediaSourceEngine
Instead of requiring media source engine to create its own closed
caption parser and then allow tests to override it, have it be
passed into the constructor.

This allows us to easily use the fake one in all our tests and
removes the need for a test only method on media source engine.

Change-Id: Ia1d4f0bb988dca30699b30ccaf4522126f357f90
2018-12-07 00:10:13 +00:00
Michelle Zhuo bcd10c272e Refactor for Caption Parser
Similar to Transmuxer, adding a Caption Parser class as a wrapper of
mux.js's Caption Parser, and move all relevant operations from Media
Source Engine to Caption Parser wrapper class.

Issue: #1404

Change-Id: Iaafa22a963b53315e1f7ae52a5fe17a4cd3f2bde
2018-12-06 01:26:52 +00:00
Aaron Vaage 77c7efa49c Limit scope of Edge work-around in DrmEngine
Before we had a method that would return all the supported types. The
only public use of this method was in the tests. Within DrmEngine we
would only use it to see if we could support a content type.

So instead of needing a caller to know about working around edge,
this changes it work around to be limited to one function.

This then allowed a consolidation of the other "support" methods in
DrmEngine.

Change-Id: Ia2a3484b0f8c9be51fe58955ac1ed146d4e7ba0a
2018-12-05 17:47:15 +00:00
Aaron Vaage eb6eea1f46 Address channel ids as |channelId|
In the methods use for testing, when getting the number of
close caption cues, we were only addressing the channel by "id".
This updates the name to be "channelId" so that it is clear
what the id will map to.

Change-Id: I773d5a63c376b832d492b41cf2505d8a27ea0f32
2018-12-05 16:42:09 +00:00
Aaron Vaage c9411d1c22 Refine comments on closed caption test methods
This change refines and emphasizes the message of the test only
methods for closed captions in text engine.

Change-Id: I0f13f0fa48f3b464c8dc4166ddbd12f09f53874c
2018-12-05 08:41:03 -08:00
Aaron Vaage e3b1cb41aa Remove Redundant Null Check in TextEngine
The close caption map cannot be null in text engine, but we were
still checking if it was falsy. Since it can't be null, we can remove
the falsy check.

With the falsy check removed, the expression was able to be reduce
even further.

Change-Id: I839bc2337cfa1415cc6b00b75602e608f75b0e13
2018-12-04 16:12:34 -08:00
Michelle Zhuo a51bc995f7 Add integration tests for closed captions
Issue #1404

Change-Id: Id8c16c073f3f85fd093d33e3f40e809fa574f5ee
2018-12-05 00:07:59 +00:00
Aaron Vaage 5cad6be056 Add log.alwaysError
Added an alwaysError log method that will ensure that some errors
(like expired deprecation messages) are always printed.

Change-Id: Ia641f97b97258ea2826a1ad3fe2d7d7952ffa2ed
2018-12-04 17:24:54 +00:00
Jacob Trimble d4ef43b8c7 Allow events from expired EME sessions.
When we close an expired EME session, we can still get a key status
changed event.  This fixed an assertion failure caused by this.

Fixes #1599

Change-Id: I49fd02151f8907c3868080e5c5dcd912fd25ecd4
2018-11-30 15:52:30 -08:00
Jacob Trimble 3db435e87d Fix some issues with IE11 EME polyfill.
- We can get a 'msneedkey' event with no init data.
- Use the correct message type name.

Issue #1689

Change-Id: Ic0e54fe8331d4700971d78095b77831de2d9580b
2018-11-30 22:43:00 +00:00
Jacob Trimble 8805b564e1 Fix PlayReady playback on Tizen.
Fixes #1712

Change-Id: I22d0d0673b11970372e9bd23accc8bf1f8c65f91
2018-11-30 22:42:15 +00:00
Joey Parrish 7991b2a86b Update docs for setStreamProperties
This clarifies how the MediaSource append window works.

Change-Id: Ice5f095298f47af6ce5967d17e47b16b4b58787d
2018-11-30 18:48:55 +00:00
Joey Parrish 49ce58bffa Fix chopped playback in MS Edge
Fudge the append window end to fix a playback bug in Edge.

Because Edge does not seem to implement MP4 edit lists correctly, we
may end up with some audio truncation and a gap.  If we fudge the end
of the append window a bit, we avoid this truncation and we get a
continuous buffered range and smooth playback.

Fixes #1597
Fixed #1435

Change-Id: If28f3f5499dbf5ad9d33ee4859f95ebd91ad3e59
2018-11-30 18:48:55 +00:00
Jacob Trimble 76f78187b6 Add extended error code for failed license request
Issue #1689

Change-Id: I7d3b4eee487395fdb8c121a4b6acc11ec461f0e3
2018-11-28 23:27:51 +00:00
Michelle Zhuo 1afceadc9c Refactor Closed Captions Support for HLS
Refactor the closed captions support for HLS, using the same approach as
the closed captions support for Dash.
If closed captions are signaled in the manifest, player will create a
text stream for to represent the closed captions, and text engine will
store and append them. We don't need to set 'useEmbeddedText' value for
closed captions any longer.

Issue #1404

Change-Id: I9a5bf4df7e29d6e6982f29fd5e2df07bc78071d7
2018-11-27 20:59:52 +00:00
Joey Parrish 69d3193675 Clarify and clean up usage of URIs in HLS
This fixes issues with the interpretation of URIs in HLS and makes
their usage and meaning consistent and clear.

 - Name URI variables as either absolute, final (post-redirect), or
   verbatim (exactly as they appear in the playlist)
 - Identify media playlists by their verbatim URI when testing for
   equality or duplication
 - When a master playlist is redirected, interpret media playlists as
   relative to the redirected location
 - When a media playlist is redirected, request updates from the
   redirected location
 - When updating a media playlist, resolve media segment URIs as
   relative to the latest redirected media playlist URI
 - Resolve absolute segment URIs when parsing the playlist text,
   rather than waiting until we intepret and build the manifest
 - Remove some incidental bind() calls, which exposed compiler errors
 - Avoid refactoring long parameter lists
 - Avoid refactoring for async/await
 - Clean up redirection tests, which were brittle and did not verify
   what they seemed to
 - Use relative segment URIs for all segments in tests
 - Use media playlist URIs within master playlists in tests
 - Add a regression test specifically for #1664

Closes #1664

Change-Id: I45f946790c7d669637c231ae93920a09c18c4222
2018-11-19 12:37:50 -08:00
Joey Parrish 37cd5a9116 Use Set and Map in HLS parser
Also document the usage of each Set/Map to make changes easier to
understand.

Issue #1664

Change-Id: I4e951c642bca13b7b3ead9b478bf530cfadbabf3
2018-11-19 11:52:02 -08:00
Sandra Lokshina 6b1ca2d229 Initial release of Shaka Player UI
Other contributors:
 - @joeyparrish
 - @michellezhuogg
 - @TheModMaker
 - @theodab
 - @vaage

Change-Id: If6df33d9ab5035d1ead4402004f7de37ee8470f4
2018-11-16 14:40:37 -08:00
Aaron Vaage b84e74e825 Use Language Terminology In Our Code
Now that we have a formal terminology for how we talk about
language and locales, this change updates our code to utilize
our new vocabulary.

For more information on our terminology, see our "Talking About
Languages" document.

While the expression of the behaviour has changed, the final
observable behaviour should not have changed. The goal of the
"rephrasing" was to build our logic based on the concepts discussed
in our "Talking About Languages" document.

Change-Id: I16c405e3d5a4d1e2275c99d5ec0bbdbaaf8373b9
2018-11-15 20:11:20 +00:00
Joey Parrish b2e93020a6 Fix async-related errors ahead of a new compiler release
Change-Id: I6859f4d921c74a70c2d21bf057d8f5ee747ee046
2018-11-15 18:26:38 +00:00
Joey Parrish 1831ce95e2 Loosen the event listener type
This gets us ready for upcoming changes in the Closure Compiler and
its built-in externs.

Change-Id: I1c22a8ea5b99ef39e3cd5b5ed42ef4373ea3007c
2018-11-12 14:37:58 -08:00
Andy Hochhaus 3bba6f37d6 Add missing require for shaka.util.XmlUtils (#1660)
Fixes #1658
2018-11-11 20:33:54 -08:00
Joey Parrish 3b25bc9bf1 Fix compiler complaints about Iterable|Iterator
Instead of Iterable|Iterator, just use Iterable.  Iterators are, after
all, Iterable themselves.

Caught by a newer compiler/linter that we have not been able to fully
adopt yet.

Change-Id: I85c03a9193e6dc0b315b3bf30e70fe7be7c718df
2018-11-09 14:28:49 -08:00
Joey Parrish 64e6e9508d Add missing private annotations
Caught by a newer compiler/linter that we have not been able to fully
adopt yet.

Change-Id: If25c7132f33d5544533542283c42a5ac7f39a552
2018-11-09 14:28:49 -08:00