Commit Graph

1614 Commits

Author SHA1 Message Date
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
Joey Parrish a9c88db16a Add -master back to version in master branch
Change-Id: I8dc3d689874c6d11d9b5f611237ae5b68778ce68
2018-11-09 21:33:02 +00:00
Joey Parrish 6b976c07ac Update changelog for v2.5.0-beta2 and bump versions
Change-Id: Ic6709aefa478d1675f539c05cd104131a226adbe
2018-11-09 21:25:30 +00:00
Joey Parrish 2d9299e513 Fix erasure of the database
In cases of corruption or version mismatch, we must be able to delete
the database without loading anything from it.  This comes up in
testing when you run an older version of Shaka Player after a newer
one has created the database.

Our ability to erase the database in these cases was lost when we
fixed #1277.  This reverts that change and changes the contract of the
storage classes to ensure that we will always be able to erase the
database, no matter what.

Change-Id: Iccfbe1fa2ca880877e4743e5ca6bd42cba44abe0
2018-11-09 11:18:14 -08:00
Michelle Zhuo dbdd39886b Small refactor for CEA closed captions for Dash
Removing a few hacks from player and streaming engine, so that now
closed captions streams are treated almost the same way as usual text streams.
Fixed the issue where toggling the closed captions doesn't work.
Fixed the delay of showing closed captions when we seek to a buffered
stream.

Issue #1404

Change-Id: I28a739f3033f30b53b3adf8fa1a181e3d4592f6f
2018-11-09 00:36:56 +00:00
Michelle Zhuo b9a806d071 Add test cases for CEA closed captions
Issue #1404

Change-Id: I35e679ef985ac5cef1f8d8673192845cae29b114
2018-11-08 15:13:51 -08:00
Michelle Zhuo f2b9e3fdf1 Add support for CEA with no channel and language info for Dash
When the dash content has CEA closed captions signal but no detail
information about channel number and language, we show the default
caption information.

Issue #1404

Change-Id: Ie6ca77739a043d24832efc5a28d4ba708dc4b17f
2018-11-08 22:19:01 +00:00
Sandra Lokshina 34408b9c26 Notify min segment start time when creating stream.
Fixes #1601

Change-Id: I132f05a23129fca944e955cbf8a347e735724b37
2018-11-07 15:11:33 -08:00
Michelle Zhuo 19a38ed6b5 CEA closed captions for Dash
Adding support for CEA closed captions embedded in video streams for
Dash.
1. Dash parser reads and parses closed captions' channel and language
information.
2. Player creates text streams for the closed captions.
3. Media Source Engine calls mux.js Caption Parser API to get the closed
captions embedded in the video streams.
4. Text Engine stores the closed captions, and text displayer shows the
captions.

TODO:
1. Add test cases, will send out another CL.
2. Change closed captions support for hls to the similar way we handle
dash closed captions, will send out another CL.
3. Handle dash content that's missing language indication from the manifest.

Issue: #1404
Change-Id: Ibae8f69623c13561415ec860107d7f5bc86e19e9
2018-11-06 09:53:18 -08:00
Aaron Vaage 74b97ed428 Add Iterables Filter Method
Added a filter method for iterables so that we can filter any type
of collection without first needing to convert it over to an
array.

Change-Id: I28919e271672649d13d3b6c2e6902d0ff549a2ee
2018-11-01 14:24:17 -07:00
Aaron Vaage 32b34479f5 Create Text Segment References
We were failing to download text. It appears we were not creating
the segment references for the text streams. This adds the text
streams to the set of streams that we are looking to download.

BUG: b/118437010
Change-Id: Ie4367e61519b5856cb63cacf8621453b677cf94b
(cherry picked from commit ec837b91193c07e8ba15300fb56f5b4010bbae7a)
2018-10-31 15:54:37 +00:00
Aaron Vaage e464b811e0 Fill In Playready Data in fillInDrmInfo
Instead of waiting until after we are done filling in the
drm info to fill in the playready values (in drm info),
let's do it in fillInDrmInfo.

Change-Id: Iaad7fd7cb42d66417e762f38c37a46c8a5f64f61
2018-10-24 22:17:20 +00:00
Aaron Vaage 9620910cc7 Make fillInDrmInfoDefaults_ static
As we look to make drm engine initialized with media key
configurations that will be made with static helpers, we
need fillInDrmInfoDefaults to be static too.

Change-Id: Ia5df0af97b0b3ef784f0b6d45b09e974c4e42617
2018-10-24 22:16:56 +00:00
Gi Gi 517730970d Set server certificate before Store and Delete (#1639)
Call setServerCertificate before store and
delete operations, when serverCertificate
exists.
In demo application, request and
configure certificate when certificateUri
is given in asset.

Fixes #1623
2018-10-24 13:56:58 -07:00
Jacob Trimble 140105b0a2 Optimize processXlinks.
- Only traverse children once.
- Avoid traversing into SegmentTimeline, which is usually large and
  won't contain xlinks.

Issue #1640

Change-Id: I8a7a05d580740f9a9953b0a8aec89a06cc7e33f2
2018-10-24 11:38:36 -07:00
Aaron Vaage 79719ee02c Resolve TODO in Storage
There was a TODO I left in storage about using sets when finally
adopted them, so I am happy to say I got to resolve it to day.

The change here is that instead of using a object as a map to track
which ids we have seen, we can now use sets.

Change-Id: I9288c3e48c67d2f8cfeda70883ffb683bf735cae
2018-10-23 18:31:01 -07:00
Jacob Trimble 443269a347 Fix MediaSource tear down race.
First, we cannot destroy the EventListener in MediaSourceEngine until
the in-progress tasks are done so we can get the 'updateend' event.
Second, we shouldn't detach MediaSource until the tasks are done to
ensure the media stack is still working.

As part of that, we need to delay the destruction of DrmEngine to
ensure it happens after MediaSourceEngine.

Fixes: 118148113
Change-Id: I2c77d72556eb0b1b6ef4a3f7a092f182b94e9156
2018-10-23 16:04:31 +00:00
Aaron Vaage 5612a0f855 Use Sets For Filters in Networking Engine
If we use sets for filters in networking engine we get some
pretty good additions:
  1. Someone can't double-register their listener (by accident)
  2. We don't need ArrayUtils to remove listeners.

Change-Id: I5115b9488d43f0bcd64fcc1a11133d5a49ad3d3a
2018-10-22 21:08:34 +00:00