Commit Graph

2275 Commits

Author SHA1 Message Date
Timothy Drews 25599ae9a5 Tweak StreamingEngine logs for easier debugging.
Change-Id: I79bc4de3a608dadd7d81af6ebd87e75ada5af6c7
2016-03-11 19:57:49 +00: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 3c12e8140b Add support for default language in player configuration.
Closes #207

Change-Id: I77cbd64c33ff2c45048774aff6440332891154b8
2016-03-10 21:47:57 +00:00
Timothy Drews c81b8e1582 Add live StreamingEngine unit tests.
Change-Id: Idc6b09e547b582ac4d9a1d39415243ad46d2351a
2016-03-08 16:27:06 -08:00
Jacob Trimble fb0cf16b82 Removed unused variables from AbrManager.
Change-Id: I2509e4f84fdf697e559f3dcdd0f76d0917668a0e
2016-03-08 18:55:47 +00:00
Timothy Drews eaadb52627 Add AbrManager.
* Import and rework Shaka v1.x AbrManager.
* Import Shaka v1.x EWMA utilities.
* Integrate AbrManager into Player.
* Add DefaultAbrManager unit tests.

Change-Id: I8df9c1caddff97684ad3cdc3064b10e9bc014874
2016-03-07 17:40:06 -08:00
Joey Parrish edc9bc8d49 Reject with Error objects in MediaSourceEngine
Instead of rejecting Promises with either exceptions or empty error
events, build full Error objects in MediaSourceEngine.

Change-Id: Ib4317f0ffe66c0292b3560f89f7a07e74e474dd3
2016-03-07 21:53:32 +00:00
Jacob Trimble 379830ffe6 Add support for Dash suggestedPresentationDelay attribute.
Change-Id: Id376a4627c97e4a810670b273610a0bb76806477
2016-03-07 20:24:04 +00:00
Joey Parrish 170bd8999e Fix key system negotiation on Edge 13
Key system negotiation was failing on Edge 13 when there were multiple
entries in the capabilities array.  From now on, we will not include
codec strings in the capabilities array and we will not include
duplicate entries.

Change-Id: I3edd7c6d1f629767a0fe8c37479f3edc538e7223
2016-03-05 00:16:15 +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 f42ea73210 Fix unnecessary INVALID_SEGMENT_INDEX errors
We should tolerate small overlaps between segments due to rounding
errors.  This fixes playback of several pieces of content.

Change-Id: I420e7ab3a5b0f72abeb43639d9dbb3bcbf5e4ef9
2016-03-04 12:12:47 -08:00
Joey Parrish 5c58df5be0 Fix buffering problems at high playback rates
The scheduling of updates was causing the StreamingEngine high
playback rate test to fail miserably on Edge.  Not scheduling updates
is actually much more resilient, as well as simpler.

This has been tested at rates up to 10x.

Change-Id: Iaad4df6b7d68b61b62dedcf08b7017ea7d74a596
2016-03-04 19:50:46 +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
Joey Parrish b960dbf36b Fix DrmEngine teardown via Player
DrmEngine sets mediaKeys to null, but this only works after the video
src has been cleared. Not doing this results in a video element which
cannot be reused.

Change-Id: I1015fd6e5f39e0bdd6e5d7b33881445258ceaf9d
2016-03-03 23:53:27 +00:00
Joey Parrish a60a77a08b Fix customScheme failures in compiled mode
Referencing node in the default customScheme keeps the parameter from
being removed by the compiler.  This is needed for the function length
check in mergeConfigObjects_() to pass in compiled mode.

Change-Id: Iaf5d0d0968ea8aecdbb8e503011689382aff12c3
2016-03-03 20:29:07 +00:00
Joey Parrish a46005e311 Change definition of live for default startTime
We will now default start time to the end of the seekable range only
if the duration is infinite.  This fixes playback of static, VOD
assets with availabilityStartTime.

Change-Id: I9f511678f767375d41d98260cc519dc84566538b
2016-03-02 17:07:21 -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
Joey Parrish 55f9d6423f Add event dispatch to Player
Also improves shaka.util.Error docs.

Change-Id: I62080acfc4ff658eec1f4a72e36f4bac8c934267
2016-03-01 23:12:32 +00:00
Joey Parrish bdb35f5952 Fix IE EME polyfill WRT event dispatch
This broke in 9d70cad0 when we simplified FakeEvent and
FakeEventTarget. Now that FakeEvents are no longer based on real
Events, we cannot dispatch a FakeEvent from a real EventTarget on
IE.

Change-Id: I81635ef40ac627cf757a87c12b3a5a94068a0ad8
2016-03-01 11:25:29 -08:00
Joey Parrish 09bb56164a Do not export individual polyfill docs
Also corrects duplicate Promise entry.

Change-Id: I7d675b0e8bbcbcb1dc1508f3c08e0a3811149d63
2016-03-01 17:51:14 +00:00
Joey Parrish 51218cbd36 Correct StreamingEngine error category
Change-Id: I99c5f783d4ebd5e86ebe96eab9e039af28396e0b
2016-02-29 18:30:34 +00:00
Joey Parrish 9d70cad0ea Simplify FakeEvent and FakeEventTarget
We now avoid tricky things like CustomEvent and setting properties on
native Events.  This gives us better cross-browser compatibility and
less complexity.

Change-Id: Idc9fcc69c33257e4540d956bcbc949de6d992cf0
2016-02-29 17:58:55 +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 32b9c43d00 Fix live edge null check
Change-Id: If061ce0b3b891966bd771acca25e5b05dce08cd6
2016-02-23 21:17:05 +00:00
Joey Parrish 793560d368 Fix typo
Change-Id: I6bf5b8df4f55a4e3f1c44d00db1905a89898abc6
2016-02-23 21:17:00 +00:00
Joey Parrish f02bff9018 Player.load, integration with streaming & DRM
This implements Player.load and integrates with StreamingEngine and
DrmEngine.

Change-Id: I28b80d835c3c07706bdd69059991e97390d590d8
2016-02-23 12:54:59 -08:00
Joey Parrish 282218a5c3 Spread out error codes
Each category now has its own range of 1000 error codes.  Using codes
in the thousands rather than the hundreds will help avoid confusion
between our error codes and HTTP error codes.

Change-Id: I8defd0ecbbbff7ef1b06e18419f29f16a85b2555
2016-02-22 16:23:40 -08:00
Joey Parrish d0701d525c DrmEngine integration tests and associated fixes
- Update MediaKeyStatusMap definitions
 - Remove MediaKeyStatusMap iterators (not present in Edge)
 - Work around MediaKeyStatusMap interop issues
 - Update MSMediaKeys definitions (stricter on Edge 12 than IE 11)
 - Add onKeyStatus callback from DrmEngine and associated unit tests
 - Unpack PlayReady license requests
 - Byte-swap Edge 13 key IDs
 - Fix nullability of types in NetworkingEngine
 - Skip all DrmEngine integration tests unless either Widevine or
   PlayReady are available.

Change-Id: I49cbcdb5f82afa9a70a127601b195cf0794e1181
2016-02-22 16:23:33 -08: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
Joey Parrish 454662817b Remove unnecessary defaults in HttpPlugin
Change-Id: Ib146e46980dd5e10ed437be09d6360481335f149
2016-02-19 22:20:51 +00:00
Joey Parrish 3dcd6d3891 Fix data uri test failures on Edge 12
Some failure scenarios resulted in success on Edge 12.
It seems that calling reject() followed by resolve() in a Promise
constructor was resulting in a resolved Promise on Edge 12.

Change-Id: I353d37f34be59c4535a11eb6c181bfa3d320c52d
2016-02-19 22:20:25 +00:00
Joey Parrish 5c4240e358 Add debug logs for HTTP error text
This was useful when debugging license request failures.

Change-Id: Icb8f56fa02fe52f0d01c3c353fdb6ee0fa3f751d
2016-02-19 19:18:51 +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
Timothy Drews 77b3480c3a Introduce new StreamingEngine API.
* Replace onBufferNewPeriod() with onChooseStreams().
* Remove newPeriod()
* When transitioning Periods, only call onChooseStreams(p) once
  Period p has been setup.
* Refactor documentation.

Change-Id: Ic341dd018302bf46fdd071072e5facb0e0fccb3b
2016-02-18 16:47:12 -08:00
Joey Parrish c2dc1d8958 Fix off-by-one-frame issues with MSE window end
This adds a fudge to appendWindowEnd so that the final frame in a
period won't be dropped and a gap will not appear between periods.

Change-Id: I9ded5237c949a3bae7e2c4081b32fa33938d9583
2016-02-17 22:55:50 +00:00
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