Commit Graph

359 Commits

Author SHA1 Message Date
Timothy Drews 5db1c6b6b6 Use a default suggestedPresentationDelay.
Change-Id: I314d3ef8ffc3fa0a62affcef6bed9fa3faa1e451
2016-03-12 01:03:09 +00:00
Jacob Trimble 8daf53e329 Renamed shaka.asserts to goog.asserts.
Using goog.asserts will work with the compiler.  So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.

This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.

Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
2016-03-11 15:29:20 -08:00
Jacob Trimble 846e7beb48 Unified comment spacing.
Before there were two style to indent comments after an annotation,
using 2 and 4 spaces.  Now this only uses 2 spaces.

Change-Id: Id06415d7193cc154a2768fb3932aff7a06b7ed32
2016-03-10 16:27:45 -08:00
Jacob Trimble 379830ffe6 Add support for Dash suggestedPresentationDelay attribute.
Change-Id: Id376a4627c97e4a810670b273610a0bb76806477
2016-03-07 20:24:04 +00:00
Jacob Trimble 6f8f21405b Add support for DASH Location element
Closes #298

Change-Id: I8ac9eb13c2c721cf61ad8f4a55ecec86936d7856
2016-03-05 00:04:11 +00:00
Joey Parrish 78e996d090 Fix issues found by the newest Closure compiler
Fixes the following issues:
=====

lib/player.js:106: ERROR - Property id never defined on TextTrack

lib/util/xml_utils.js:42: ERROR - inconsistent return type
found   : (Node|null)
required: (Element|null)

lib/dash/content_protection.js:256: ERROR - Parameter must have JSDoc.
      function(element) {

lib/dash/content_protection.js:284: ERROR - Parameter must have JSDoc.
      function(elem) {

lib/media/drm_engine.js:47: ERROR - Private property configuration_ is never read

lib/polyfill/patchedmediakeys_20140218.js:269: ERROR - Private property keySystem_ is never read

lib/polyfill/patchedmediakeys_20140218.js:389: ERROR - Private property type_ is never read

lib/util/language_utils.js:84: ERROR - The value 0.0 is duplicated in this enum.
  MIN: 0, MAX: 2

lib/util/language_utils.js:84: ERROR - The value 2.0 is duplicated in this enum.
  MIN: 0, MAX: 2

demo/assets.js:171: ERROR - Value assigned to local variable headers is never read

lib/dash/content_protection.js:188: ERROR - Value assigned to local variable repUnknown is never read

lib/dash/dash_parser.js:400: ERROR - Value assigned to local variable suggestedDelay is never read

lib/dash/segment_base.js:41: ERROR - Value assigned to local variable SegmentBase is never read

lib/dash/segment_template.js:291: ERROR - Value assigned to local variable periodStart is never read

lib/media/drm_engine.js:172: ERROR - Value assigned to local variable onEncrypted is never read

test/dash_parser_live_unit.js:358: ERROR - Value assigned to local variable manifest is never read

test/drm_engine_unit.js:383: ERROR - Value assigned to local variable cert1 is never read

test/drm_engine_unit.js:384: ERROR - Value assigned to local variable cert2 is never read

test/media_source_engine_unit.js:24: ERROR - Value assigned to local variable dummyData is never read

test/media_source_engine_unit.js:504: ERROR - Value assigned to local variable p2 is never read

test/media_source_engine_unit.js:505: ERROR - Value assigned to local variable p3 is never read

test/media_source_engine_unit.js:506: ERROR - Value assigned to local variable p4 is never read

test/media_source_engine_unit.js:535: ERROR - Value assigned to local variable p2 is never read

test/media_source_engine_unit.js:601: ERROR - Value assigned to local variable p2 is never read

test/media_source_engine_unit.js:602: ERROR - Value assigned to local variable p3 is never read

test/media_source_engine_unit.js:603: ERROR - Value assigned to local variable p4 is never read

test/media_source_engine_unit.js:632: ERROR - Value assigned to local variable p2 is never read

test/mpd_utils_unit.js:20: ERROR - Value assigned to local variable HUGE_NUMBER_STRING is never read

test/streaming_engine_integration.js:55: ERROR - Value assigned to local variable onSeek is never read

test/streaming_engine_unit.js:1263: ERROR - Value assigned to local variable reportedContentType is never read

test/streaming_engine_unit.js:1264: ERROR - Value assigned to local variable reportedPeriodIndex is never read

test/streaming_engine_unit.js:1540: ERROR - Value assigned to local variable size is never read

test/util/dash_parser_util.js:77: ERROR - Value assigned to local variable retry is never read

test/util/dash_parser_util.js💯 ERROR - Value assigned to local variable retry is never read

test/vtt_text_parser_unit.js:272: ERROR - Value assigned to local variable result is never read

Change-Id: I707700250541e04ccbfe81d7298b3f0c5a82dcdc
2016-03-03 16:04:58 -08:00
Jacob Trimble b6ccd386f1 Fix DASH update bugs.
There were several situations where if stop() was called while an
update was occurring then it would either fail or continue to update.
This fixes those and also adds more tests for these cases.

Change-Id: I652198d289f65e60647a8d2aac00185cab43dead
2016-03-02 17:57:00 +00:00
Jacob Trimble 4320b4d4b8 Update DASH AdaptationSet group squashing.
Before, we would squash AdaptationSets that belong to the same group.
However, this is incorrect.  Now it squashes AdaptationSets according
to the AdaptationSetSwitching info.

Closes #293

Change-Id: I2f7e37aa797d1fd8f453a924c0b0c9682fd84505
2016-02-26 21:17:42 +00:00
Joey Parrish 1daed906c0 Externalize manifest parsers and simplify factory
This properly externalizes manifest parsers so that they can be
implemented in application-space.  This also moves all parameters
from the factory function to start().

Change-Id: I66801bc1cb13214d576e0043cebc2d9b9cb5a641
2016-02-25 13:42:47 -08:00
Joey Parrish 793560d368 Fix typo
Change-Id: I6bf5b8df4f55a4e3f1c44d00db1905a89898abc6
2016-02-23 21:17:00 +00:00
Jacob Trimble 49b238b3c9 Fix support for UTF-8 encoded data.
Before, we simply converted each byte from an ArrayBuffer into a
character; however, this is only valid for ASCII characters.  This
changes it to fully support UTF-8 encoded network responses.

Change-Id: I9c49f29b09960501d345b98aa7af1bb711972abf
2016-02-23 00:12:43 +00:00
Jacob Trimble 56d9bebc8e Fix DASH manifest parser when compiled.
The use of strings as indexers in the DASH manifest parser would
not work when the library is compiled.  This fixes it as well as
adding type-safety to those parts.

Change-Id: Id07068bc0eefdab4730dadc114e66b661cd4bb3e
2016-02-19 17:03:02 +00:00
Jacob Trimble 4f4ace5a70 Add support for non-segmented text.
Issue #150

Change-Id: I588f47a0ae505d70d8a0bd263a88e26d7aa60c32
2016-02-19 00:55:50 +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
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 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
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 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 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 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 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
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
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
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
Natalie Harris 388466dd6f Move XML parsing functions to XML util class.
Change-Id: Iea7256eff9f2f7a60607743cd6cf95e6762bd961
2016-01-08 23:02:25 +00: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
Joey Parrish 9dbd6e6549 Add messages to all assertions
This makes debugging easier when an assertion fails.

Change-Id: I362e58706c71a12cffcda84dcd0b9ad281c51f30
2015-12-04 02:17:28 +00:00
Timothy Drews f741ad6e3f Add MpdUtils.
Change-Id: Idbbeb7ed2d0534f148873e0a98dce0c0a4ac955f
2015-12-01 21:36:33 +00:00
Joey Parrish 03df140fb8 https://goo.gl/RvMyq4 2015-11-25 12:14:04 -08:00
Joey Parrish 7fabab9c14 Always inherit ContentProtection from AdaptationSet
Fixes #230

Change-Id: Ie1dc63de83a40c270c586f8aee98fa98c214ecb8
2015-11-11 04:05:55 -08:00
Joey Parrish a304a041b2 Combine init datas across Representations
When computing common DRM schemes among representations, we were not
previously combining the init datas.  Because of this, if different
Representations with different PSSHs had their PSSHs in the manifest,
we would only request a license for one of them.

b/25596430

Closes #229

Change-Id: I150f67174df9dc0dbe1c7b32ab7b1a6dea633328
2015-11-10 17:28:47 -08:00
Timothy Drews 29f8022806 Make @startNumber implementation consistent.
* For SegmentTemplate with @duration, treat @startNumber as the number
  of segments absent from the start of the Period.
* For SegmentList, fix off-by-one error when computing segment start times.
* Add more @startNumber documentation and unit tests.

Issue #192

Change-Id: I0b7950cc6cda0a2cbd345e13bd769a50f83d4982
2015-11-05 19:41:36 +00:00
Joey Parrish 1ebf669350 Require live support for SegmentList and SegmentTemplate
Change-Id: I48b034c7499fe9c648d8c0730481a5f77ae08875
2015-11-03 10:05:16 -08:00
Joey Parrish f248647685 Permit disabling webm and containers in general
Change-Id: I985e460b7be3dd57ee7cc80c80e3ea2d3c85e7d8
2015-10-30 11:53:27 -07:00
Joey Parrish 7b78b9747d Drop unused member in ContainerSegmentIndexSource
Change-Id: I7d95493e56f5efe881c801fff3493269ce766e80
2015-10-20 20:02:12 +00:00
Jacob Trimble d84428b42f Removed 1.6.0 deprecated functionality.
Closes #203

Change-Id: I52f72030078c2bf69f1da33fae035664ca50daca
2015-10-15 17:14:11 +00:00
Jacob Trimble 62adcd40c1 Always apply timestamp correction to OPT.
Closes #200

Change-Id: I821d7a8336cc66593665dbc2ad794adc3fb55918
2015-10-13 18:23:34 +00:00
Jacob Trimble f346ece22c Improve live end-of-stream behavior.
* Supports live streams of a fixed length.
* Live streams that stop now correctly end the video.
* Only uses local MPD when @availabilityStartTime is in the future.
* Added configuration option liveStreamEndTimeout.

A live stream is considered "ended" when the play-head moves past
the last segment for liveStreamEndTimeout amount of time.  This allows
the MPD to be updated with new segments.

Closes #139
Closes #140
Closes #145
Issue #172

Change-Id: I0675203931f35ca3e0dee60a87c54ba74cbdbaea
2015-10-13 18:00:01 +00:00
Jacob Trimble ee872017ed Added 'app' error type.
Change-Id: I1c56d875ec92291af408a10e01e7d2c8fae24749
2015-10-07 22:28:24 +00:00
Jacob Trimble e4603b1c4a Re-Process MPD when availabilityStartTime reached.
When the availabilityStartTime is in the future, the
StreamVideoSource will re-process the local MPD once the
availabilityStartTime passes.

Closes #172

Change-Id: I1432ae06fbff6c4978ed93bc51263f7cac37e136
2015-09-29 22:39:19 +00:00
Timothy Drews 9dcbda7234 Use Period.duration for ST + @duration.
For static content that uses SegmentTemplate + @duration, compress
the last SegmentReference so that it does not go beyond the
Period's duration.

Issue #173
Closes #187

Change-Id: Ifb9404ddfe267915541c035a5d6286f63f7bc032
2015-09-25 22:30:18 +00:00
Timothy Drews 26bfade2df Fix multiple audio language support.
* Ensure AdaptationSets with different languages but with the same group
  end up in different StreamSetInfos.
* Set the main flag in a StreamSetInfo if any one of the source
  AdaptationSets has their main flag set (commit
  689c2a47aa broke Role 'main' support).

Closes #182

Change-Id: Ia017e294e0b359c62133adc42a8d701d614f3b0d
2015-09-15 17:36:20 -07:00
Timothy Drews 9fd655f17c Fix SegmentTimelines with @presentationTimeOffset.
Fixes #143

Change-Id: I49bf77c7a63be48bcac19281dcadd373b52bcd4f
2015-09-08 21:57:13 +00:00