Commit Graph

438 Commits

Author SHA1 Message Date
Joey Parrish cd2d25cbb2 Convert TextSourceBuffer to TextEngine
This changes the text APIs to correctly handle buffered ranges of
segmented text.

b/25517444

Related to issue #150

Change-Id: I3a11b87e8d93376a5012566deb3bf0d015f52391
2016-02-17 00:19:49 +00:00
Joey Parrish 6ae1474e65 Fix time range fudge value for Safari 9
In Safari 8, the necessary fudge is 1us.
In Safari 9, the necessary fudge is 1us + 1femtosecond.
This makes the fudge value 0.1ms.

Change-Id: I7184c2d1c28ccbd93bac137d6617cbd8999bcfb9
2016-02-16 21:25:12 +00:00
Timothy Drews a0c35403e5 Add StreamingEngine tests and fix several bugs.
* Tidy up unit tests, and add more eviction tests and drift tests.
* Add integration tests.
* Handle end-of-stream and end-of-Period scenarios when segments
  are not perfectly aligned to Period boundaries.
* Use segment receipts to determine which segment to buffer next.
* Handle drift with eviction and other drift corner cases.
* Handle additional errors and improve overall robustness.

Change-Id: Ib57a255cda7a6e8c5857eb82accc14697983b893
2016-02-13 01:57:09 +00:00
Joey Parrish 813b746160 DrmEngine and associated tests
This is mostly complete, but needs additional integration with an
as-yet-unwritten AbrManager.

Change-Id: I3836040c6891fb774be800b53679f49e365c7e1c
2016-02-12 16:06:31 -08:00
Jacob Trimble cfb3e1d24c Changed Stream info to only have one key ID.
b/26982075

Change-Id: I462796ba34bbde8b4e3b0020a39e2474679daee7
2016-02-12 23:32:59 +00:00
Joey Parrish 069e5eda3b Sync Promise polyfill with master branch
Several fixes were made recently for v1.6.3

Change-Id: I20ffc0f647973962839d8b5322bfbf331880aa34
2016-02-12 22:02:49 +00:00
Jacob Trimble 8e21f46159 Fix ContentProtection parsing for non-IOP manifests.
This fixes the ContentProtection parsing to support non-IOP-compliant
manifests.  This enables the unit tests for it, as well as adding
several more.

b/26982075

Change-Id: I0da2dbaa24ea2a6acf657b97f0a2e2d24ee3a16d
2016-02-12 21:48:19 +00:00
Joey Parrish 4aea4d0d5f Fix $Time$ rounding errors in SegmentTemplate
Sometimes the calculated $Time$ value is not an integer due to
floating-point rounding errors, but the $Time$ value filled into the
template must be an integer.

Change-Id: I5e61ac5143222620e8b5e1dfeb1847241c6a6876
2016-02-12 10:31:46 -08:00
Joey Parrish beb99ff8d4 Show error enum names in uncompiled mode
Change-Id: I69b1fc52c452ae4cc0647689a1a4c4863597b8e0
2016-02-12 18:16:56 +00:00
Joey Parrish db714c8364 Do not require sourceURL in Initialization
It is the more common case for SegmentBase if the init segment comes
from the same URL as the media segments.

Change-Id: Ia9993471c892e103929729e2d496e0bc2f836b88
2016-02-12 18:16:51 +00:00
Joey Parrish a306f6ffd6 Fix default log level in uncompiled build
Change-Id: I063761f8d3b86a4305588f00d6216a37ed11fa5b
2016-02-11 16:40:02 -08:00
Jacob Trimble bfa42a8d1e Fix argument bug in Dash parser.
This also changes from using Node types to using Element types.  This
is more correct since the code only deals with XML elements and not
with other Node types (e.g. text content nodes).

Change-Id: I0e8c7bf2adc1800a494e575b16661e8c69a7deb0
2016-02-11 15:14:52 -08:00
Joey Parrish 97129b2310 Use StreamingEngine configure() to take in config
Change-Id: Ica651d25a353d84c44e8072c611b386c1c846b87
2016-02-10 11:42:54 -08:00
Joey Parrish d03021603b Make types nullable, use HTMLMediaElement
Non-nullability on some types forces us to use casts everywhere, at
which point the compiler is just trusting us.  So they might as well
be nullable and save us some typing.

Also, change HTMLVideoElement to the more general HTMLMediaElement.

Change-Id: Iaf111835bfbf230b99ad8cd7a7a06a6caffd16bc
2016-02-10 19:00:42 +00:00
Joey Parrish 493438cce5 Infer a missing URI scheme
Uses location to determine what the scheme should be if unspecified.
This is important because it allows us to use URIs that work for
either HTTP or HTTPS hosted apps without mixed content warnings.

Some special sauce was needed to make it testable, since we generally
can't mock location in tests.

Change-Id: I294ac532f1bba80977597e11addd7f585d1e9b79
2016-02-10 19:00:23 +00:00
Joey Parrish 6d57a9181b Improve jasmine/karma formatting of util.Error
Add extra info to util.Error in non-compiled builds so that we have
meaningful stack traces in test failures.

Change-Id: I351d2f65ef764947f8318372a47eeb6f014d7b16
2016-02-09 14:44:59 -08:00
Joey Parrish 63cc420d70 Promise.resolve requires context
This fails on Chrome:

var fn = Promise.resolve;
fn();

But this does not:

var fn = Promise.resolve.bind(Promise);
fn();

It seems that the native implementation of function "Promise.resolve"
needs the context of "Promise" as "this" to execute.

Change-Id: I4e06e6a85f966ef0af2f630da50cbfc60f12ed50
2016-02-09 20:22:10 +00:00
Joey Parrish 17fdcc61b9 Do not assume an initial duration of 0
This brings the MediaSourceEngine integration tests more in line with
reality.

Change-Id: I2a9446071e937e58c3878250aa1ece2c8a750b93
2016-02-09 11:28:36 -08:00
Joey Parrish 489ebfa941 Fix handling of configuration callbacks
Nullable callbacks can't be handled generically, since types won't
match the template.  typeof(null) != typeof(function(){})

- Make customScheme non-nullable.
- Check number of parameters in callbacks.
- Add a test that covers customScheme setting and validation.

Change-Id: I58eb88fc667bfa8ab13a679f1b1eed0c894e3755
2016-02-03 11:16:59 -08:00
Joey Parrish 2226269674 Add configure() to manifest parser
This simplifies the parser constructor and allows config updates after
playback has begun.

Change-Id: I43d53f2e074c1696a1f042961f399514b1afe5d6
2016-02-03 11:10:46 -08:00
Joey Parrish a6a150848e Player configuration
Change-Id: I43298c6bb86399fc10fbd5c201fed0902e0850fa
2016-02-02 18:41:19 -08:00
Jacob Trimble 823fdd7896 Fixed incorrect error reporting in ContentProtection parsing.
DASH sec. 5.8.5.2 states that with the mp4protection scheme, the
@value attribute should be the scheme type.  Rather than verify
the value is correct and ignore it anyway, this simply ignores it
entirely.

Change-Id: Ic1d089aecc1b5444b05cc5021606d9318e727a3a
2016-02-02 14:11:21 -08:00
Jacob Trimble 47a99253b0 Polyfills now register as plugins.
Change-Id: I498bda84d92f2c733f120e1b1c5a0ccae305ba15
2016-02-02 12:11:49 -08:00
Jacob Trimble a7bd6991ba Add ContentProtection parsing to DASH parser.
Now, the DASH parser correctly parses ContentProtection elements
and creates the needed DRM info.

Change-Id: I41c4f24e983895f670fae948343400153525545c
2016-02-02 17:10:25 +00:00
Joey Parrish cf6a74c67f Merge pull request #280 from donato/patch-2
Fix typo
2016-01-30 12:58:51 -06:00
Donato Borrello 5fb0bb4f12 Fix typo
Negotiation was the intended spelling
2016-01-29 17:57:15 -05:00
Joey Parrish 18678f2492 Fix IE11 test failures
This fixes small incompatibilities for IE11:
 - XML parser sometimes fails by throwing rather than returning null
 - bug in Promise polyfill prevented use of Promise.all([null, p])
 - IE11 does not have ArrayBuffer.prototype.slice, used by integration
   tests to clone a buffer in StreamGenerator

Change-Id: I9ace6bd17cd60272f85ce388342ca456f14d04c9
2016-01-29 09:18:07 -08:00
Timothy Drews f8b7b01fb0 Implement byte limits and segment eviction.
* StreamingEngine now limits buffers to a specified byte limit
  and evicts old segments as it appends new ones.

Change-Id: Id3e65bc45e782bf9d1214a6b52df0b92892606cb
2016-01-28 14:23:32 -08:00
Jacob Trimble 78e0b96cb4 Add support for UTCTiming elements in DASH.
Closes #205
Closes #241

Change-Id: Ieb870466bc6c38ee4a4e4919afcf15164cf8e981
2016-01-25 13:22:02 -08:00
Joey Parrish 82e5654636 No optional args in NetworkingEngine.makeRequest
The optional arguments in this convenience function really only help
in the tests.  To avoid some component in the library accidentally
making a request with default retry parameters instead of those
configured by the user, I'm making the retry parameters required.

The optional argument for method is only used once.  To avoid the
temptation to add more positional arguments for other seldom-used
fields, I'm dropping the method argument completely.

Change-Id: Ib0afb5766f68c5505f11372e3b004fc8eaca1223
2016-01-25 12:12:06 -08:00
Jacob Trimble 3cc1a43b8d Added some networking utility functions.
This adds some utility functions to NetworkingEngine for common
actions.  This also cleans up the related unit tests.

Change-Id: I1105b77b6dac3637d566c1a4e2f77004ad705e8b
2016-01-25 09:27:38 -08:00
Joey Parrish b822efcb86 Integrate Player with manifest parsers
Change-Id: I2388c8275a886709b35e7ec600fd6fa1340a6635
2016-01-16 05:10:48 +00:00
Jacob Trimble 7cd09c266a Removed goog.require from test code.
This removed any goog.require from the test code to make it simpler.
Now, shaka-player.uncompiled is required to be loaded before any
tests.  This fixes some dependency problems.

This also moves the utility test code to test/util.

Change-Id: I8991a61fc59c9c03e0143bb0883fd6d166af86c2
2016-01-16 01:19:28 +00:00
Joey Parrish 0b886325ab All response headers should be lowercase
This makes it possible for the few parts of the code which will use
headers to do so without relying on assumptions about case.

Change-Id: I3b1ca57a3d789d18d51b4ee94f0791daf301993f
2016-01-15 15:12:21 -08:00
Joey Parrish 33c957298b Stringify Errors for better reporting in tests
This fixes unreadable test failures like "Failed: [object Object]"

Change-Id: I61d5abf273bd49f9b972c1a7adeab99e459f378d
2016-01-15 22:42:32 +00:00
Timothy Drews a4ff2711f2 Add StreamingEngine and Playhead.
Closes #101
Closes #186

Change-Id: I8d1a8d6c0f8cfb5abdd81a149318377282b2bea0
2016-01-15 14:30:27 -08:00
Joey Parrish 736fe9e799 DRM types
A prelude to a more complete DrmEngine.  Should allow development of
DRM-related DASH parsing to proceed in parallel with DrmEngine
development.

Change-Id: Ie51504955f530898469fcacd897cb51588caa7d4
2016-01-14 13:22:41 -08:00
Joey Parrish 075af4ed4b Detect HTTP 302 redirects
When possible, use xhr.responseURL to detect 302 redirects and make
the information available in the Response object.

Use redirect URI as BaseURL for manifest parsing.

See also #225, #266

Change-Id: Ie24abeb3b8418b3e89fed6666eb525aecd74f03b
2016-01-13 17:20:51 -08:00
Jacob Trimble 54fa88f6f0 Added Dash manifest parser.
b/25851171

Change-Id: I4fbd6410d579899b749b50c8819fa8c17ac80658
2016-01-13 19:29:07 +00:00
Joey Parrish dea1021a9b Restrict SourceBuffer.remove() for IE11
This makes sure that remove() is called in a way that is compatible
with IE11.  For more information, see #251.

Change-Id: Iabe752713ba74c7bf516b4e7b93bc83cfccdd481
2016-01-11 17:46:36 -08:00
Joey Parrish b6a39b3e92 Add throws QuotaExceededError to MediaSourceEngine.append_
Relates to issue #258

Change-Id: Id83b1df13f876e565ad481169af11d65902047d6
2016-01-08 17:04:18 -08:00
Natalie Harris 388466dd6f Move XML parsing functions to XML util class.
Change-Id: Iea7256eff9f2f7a60607743cd6cf95e6762bd961
2016-01-08 23:02:25 +00:00
Donato Borrello 13e21f805d Fix typo, rename registerPlugin to registerScheme
This is a simple change to an out of date comment
2016-01-08 14:22:15 -08:00
Joey Parrish 3bb8f06b7d Require assertion messages
This will enforce messages on assertions, which should make console
logs more useful.

Change-Id: I2cff9e20f630d1d4d46192e2ee317b1942cc7188
2016-01-08 13:29:56 -08:00
Joey Parrish f2ca3a5b53 Move externally-used record types to externs
This is important to avoid renaming properties during compilation so
that applications can inject these types without compiling their code.

This also migrates record typedefs to the new documentation format.
Each record will be annotated with 'property' for each field in the
record.  This results in better output from jsdoc.

Change-Id: Ia877b1e2b333ef7020a85f16bc2469a20879bf94
2016-01-06 12:10:47 -08:00
Joey Parrish e798f060dc Add property docs to internal typedefs
We will be transitioning toward a new way of documenting record
typedefs.  Each record will be annotated with 'property' for each
field in the record.  This results in better output from jsdoc.

This covers all internal record types.  External records will be
handled in a separate CL.

Change-Id: I2ab93015bfc9db01b4b6d474b608709c99fd70cd
2016-01-04 12:36:44 -08:00
Joey Parrish 58003ff9d6 Overhaul build and docs layout
* Move redesign docs to docs/design/
* Put all build output (including closure deps) in dist/
* Restore doc-building scripts
* Fix small doc error in MPD utils

Change-Id: I930f4f976370885b3c3c37c59f1ae7fcc5522413
2016-01-04 12:33:10 -08:00
Timothy Drews 6389338d86 Update Manifest and SegmentIndex documentation.
Change-Id: I84d97b5015073f53d9a2f2b546a4bd775ef8000d
2015-12-18 09:16:20 -08:00
Joey Parrish 6231488784 Add docs to all error codes
b/25306826

Change-Id: I0c00d0f3b92f87175d6009dd986c1bff130524a0
2015-12-17 11:31:10 -08:00
Jacob Trimble 0b4ba1f8f8 Unified naming of variables about URIs.
Renamed variables to only use URI instead of URL.  Also made variable
names plural when referring to an array of choices.

Change-Id: I7bfd5022606d77a3153575d8f13dd1e040331901
2015-12-16 16:37:04 -08:00