Commit Graph

29 Commits

Author SHA1 Message Date
Joey Parrish 8ba088a38f Generate externs automatically
We were not able to get our externs generated by the Closure compiler.
There were many issues with the Closure-generated externs, including
the order of the externs and the replacement of record types and enums
with their underlying types.

We made a few attempts to patch the compiler, but could not get our
patches accepted upstream.

This change introduces a new script to generate our externs from
scratch.  It uses a JavaScript parser called 'esprima'.

Some interfaces need to be exported to the generated externs, but are
not actually attached to the namespace by the compiler.  For this, we
introduce a new annotation.  These are the currently-supported export
annotations:

 - @export: truly exported (attached to namespace) by the compiler
 - @expose: truly exposed (not renamed) by the compiler
 - @exportDoc: considered part of the exports in the docs
 - @exportInterface: considered part of the exports in generated externs

These annotations are now documented in docs/design/export.md

Change-Id: I33bf7384889c14c9edb0fa5f11caa7c4f4d79af6
2017-02-01 11:42:16 -08:00
Jacob Trimble 2ca962a33c Refactor ManifestParser.start to accept an object.
Rather than accepting multiple callback methods as separate arguments,
now start() will accept an object.  This will allow us to add new
callbacks without breaking backwards compatibility or adding
additional arguments.

Change-Id: I839cbb12e71c2e7270aa218802c79440c458e964
2017-01-19 22:54:09 +00:00
Sandra Lokshina 23a23b9b36 Make language selection explicit. Split text and variant selection.
Add UI options to select current audio and text language.
Split selectTrack() into selectText() and selectVariant().
Stop automatically disabling ABR manager when a variant is selected.
Add a warning if selectVariant() is called while abr is enabled.

Issue #412.
Issue #626.

Change-Id: I15f1c3c4fdc6d6b641f708fbef19dbcf10cbcfc6
2017-01-18 00:05:52 +00:00
Joey Parrish efa1108a19 Add additional docs for offline storage
This adds additional text explaining how to use the Storage API.

Change-Id: Icff55d6fe19e91f983ffb3e4a786f2beefe9ae8f
2017-01-13 00:56:49 +00:00
Jacob Trimble 66963dc232 Add tests for OfflineUtils.reconstructPeriod.
Change-Id: I936a0667de97b2210e9d32cde89c43561c81b4c8
2017-01-12 20:03:26 +00:00
Jacob Trimble ded62a8205 Add more tests and remove dead code.
This brings 9 classes over 80% branch coverage.

Change-Id: Id9edf22022c3f99d21fa6cad6df6994ee751079d
2017-01-11 01:20:19 +00:00
Joey Parrish c6451690e6 DASH trick mode support
Parses DASH trick mode tracks and puts the extra trick mode Stream
into the manifest.  StreamingEngine can now use this info to optimize
streaming during trick play mode.

Includes:
 - a new demo asset with a trick mode track
 - updates to tests (we now require at least one audio or video stream
   and we require bandwidth attributes on them)
 - updates to the parser's trickmode test
 - a new StreamingEngine test

Closes #538

Change-Id: Id38264ca64bc7905a5c33a269269741cfd12dd4d
2017-01-05 04:45:10 +00:00
Joey Parrish 1bfdecf311 Ban ES6 Array and String methods
This bans the use of Array and String methods introduced in ES6.
These are not implemented in IE11, so their use is not allowed.

This also replaces our recently-introduced use of these methods to
fix test failures on IE11.

Change-Id: I3175a2e60b708d490997387a41d42ca4662e5fa8
2017-01-03 15:39:35 -08:00
Sandra Lokshina e95d7b9de4 Refactor shaka internals to use variants instead of stream sets.
Issue #279

Change-Id: Idf4241b4e2490876bdc6275685361a5c9bf132b0
2016-12-28 17:49:24 +00:00
Joey Parrish 18da8e04dc Export all plugins
This exports all plugins from the library, to make delegating and
subclassing easier for applications.

This also fixes a couple of issues with the generated documentation.

Closes #551

Change-Id: I23798f6117e1944d7ffc67bcb50ae36f3943710a
2016-11-14 23:58:09 +00:00
Jonas Birmé a060050564 Provide framerate and codecs information on video tracks (#533)
Closes #516
2016-09-28 14:13:54 -07:00
Joey Parrish 3cad924cf1 In-progress recording (IPR) support, phase 2
Behavior for IPR streams:
 * offline storage disallowed
 * segment references will not be stretched to the period
 * seek range starts at 0
 * seek range end is calculated like the live edge
 * seek bar is from 0 to duration, not the seek range

Closes #477

Change-Id: Ia36874bb7208c2473c79cb817395ce03925b8c95
2016-08-29 19:57:15 +00:00
Sandra Lokshina 05a5fb9d19 Revert use of new Function() in player config.
Chrome App Content Security Policy prohibits use of new Fuction()
method. Revert the change that introduced it.

Closes #487

Change-Id: Id38522318affb9c5be8f6d2f4446e2967b43f58b
2016-08-26 22:32:14 +00:00
Joey Parrish 3715c9a435 Merge pull request #459 from hochhaus/nontrivial_return
Add JSDoc to functions with non-trivial return values
2016-07-24 11:32:37 -07:00
Andy Hochhaus 2381e27406 Add JSDoc to functions with non-trivial return values 2016-07-23 23:35:51 -07:00
Andy Hochhaus 6a00ee8a31 Add missing goog.require 2016-07-23 14:42:38 -07:00
Joey Parrish b7af879583 Remove hasOutputRestrictions
If a key status is 'output-restricted', treat the key as unusable.
In many cases it is, and we have no way of differentiating when it is
or is not.  So our treatment of this status should be conservative,
and we should treat the key as unusable.  This will prevent
HDCP-related failures that may be caused by adapting to a stream whose
output restrictions may not be met.  The hasOutputRestrictions flag on
streams and tracks is now gone.

The caveat to this change is that if content is encoded with the same
key for SD and HD, and HD streams have HDCP restrictions that cannot
be met, we will now consider both the SD and HD streams to be
unplayable, even though we could still play the SD streams.  Because
we can't separate the status of the two streams, we don't know for
sure if the SD streams can be played.

We will no longer support such content due to the complexity of doing
so, and due to the risk of playback failures on adaptation to
restricted streams.  Streams with different security requirements
should always be encrypted with different keys.  Content which does
not follow this best practice will no longer be playable in Shaka
without modifying the player.

Change-Id: Ia29db8efa0b6f83c0376199dea5210c9b468bc40
2016-07-13 10:40:24 -07:00
Jacob Trimble 858d3a55c7 Give warning when storing tracks of the same type.
When storing multiple tracks with the same type/kind/language, issue
a warning, since adaptation does not make much sense when playing
stored content.

Change-Id: I75d1625b2de680ae06728862d27b50272b951b7f
2016-07-13 16:16:04 +00:00
Jacob Trimble d17c9ddf22 Download different content types in parallel when storing.
Change-Id: Id66a6de7953e4c9678bbd39837d8b89601a43f8b
2016-07-11 16:10:44 -07:00
Joey Parrish 3624d8e079 Limit Chromecast playback to 1080p
Original Chromecast devices can output a max of 1080p, and may have
issues digesting higher resolution content.  Since higher resolution
content would be downscaled for display anyway, limit Chromecast to
1080p to avoid both decoder issues and wasted bandwidth.

Some Cast devices may support UHD content, but the max res for
Chromecast is currently hard-coded until we have a way to detect a
device's capabilities at runtime.

Issue #261

Change-Id: I3dd093b07f9a964116f81422f3c298dfbf7e2e52
2016-07-07 19:28:48 +00:00
Jacob Trimble beb902e826 Move common code in offline to offline_utils.
Added new offline_utils.js to hold utility methods for offline
support.  This also removes a circular dependency between
Storage and DownloadManager.

Closes #431

Change-Id: I98842c63c7ba57d4d02d7fe6bace57227982317c
2016-06-30 19:49:51 +00:00
Jacob Trimble ad6a9daa68 Change the offline UI for demo app.
Now the demo assets can only be stored once, if an asset is stored
the store button will disable.  Combined the store and delete buttons
into one.  Added a text box to set the name of the asset when
storing custom assets.  Also add export to Storage.destroy so it
works in the compiled version.

b/29777213

Change-Id: I7972a7931166c67efcffe70f5017a920cca617ef
2016-06-29 20:30:05 +00:00
Jacob Trimble 85fe4438b6 Various fixes for offline playback.
* Remove warnings for incorrect argument counts in configure.
* Duration incorrect for multi-Period.
* Multi-Period does not always work with multi-codec.
* Progress meter visible from start and after done.
* Offline buttons enable while storing if asset is switched.

b/29777213

Change-Id: I934bec0e6b5be2d69a908629b187459a6289f7a7
2016-06-28 23:29:10 +00:00
Andy Hochhaus 87a62d717e Add missing goog.require() dependencies 2016-06-25 15:45:15 -07:00
Jacob Trimble a3c1ed29d4 Defer filling URI template until request is made.
Instead of filling the URI templates when parsing the manifest,
wait until the request is made to fill it.  This reduces the time
it takes to parse the manifest.

This was tested using a stream with a 24-hour timeShiftBufferDepth.
Using a Chromebook pixel running Chrome 51.  The average manifest
parse time was about 1 second before, now it is about 200ms.

Issue #405

Change-Id: I89f36085441f6c6b7d6281b24b671dc668f23fe5
2016-06-23 21:15:19 +00:00
Jacob Trimble 7aab332e9b Correctly use suggestedPresentationDelay in seek range.
Before, we did not use suggestedPresentationDelay in the seek range.
This meant that seeking to the live edge would usually lead to a
buffering state because the seek range is the same as the availability
window.  Now the seek range is handled differently from the
availability window.

b/28938315

Change-Id: Iacfffe30778f7c63734fe24eeb95634611da86be
2016-06-22 22:06:51 +00:00
Jacob Trimble 6cc9613803 Add support for storing protected content offline.
Now the Storage class can store protected content and play it back.
When deleting it, the offline EME sessions will be removed.  Also
now offline support appears in Player.support().

Closes #343

Change-Id: Ic5b5a0e0854d80f7821e04e751275abf40ee6eb6
2016-06-16 18:30:25 +00:00
Jacob Trimble 387ed49e92 Add offline storage manager and manifest parser.
This contains two major parts: the Storage class, which manages
storing, listing, and deleting the stored content, and the offline
manifest parser, which loads the stored content into a manifest so the
Player can play it.

This does not include support for storing encrypted content.  The
EME sessions will not be stored properly and will fail to play.

Issue #343

Change-Id: I7ecb3400391ec8100155aa972f9b09bb7ae24d9d
2016-06-09 23:10:46 +00:00
Jacob Trimble c7c2b41ac9 Add DBEngine to manage IndexedDB connections.
This is part of the v2 equivalent of the ContentDatabase.  This only
manages low-level interactions with the IndexedDB and wraps all
actions in Promises.

This also adds an in-memory version that is used for testing.

Issue #343

Change-Id: I0d296639e74c1d4cab232ce7248b03a353b38b3c
2016-05-20 11:22:50 -07:00