Commit Graph

151 Commits

Author SHA1 Message Date
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
Joey Parrish 792c44a792 Do not reject "application/*" streams
Otherwise, we fail to play manifests containing TTML.  Without a TTML
parser, TTML streams should be ignored and not cause failures.

Issue #111

Change-Id: I982ad04083e40a3f5c5023f0059fa4ae1604ab07
2016-06-22 20:32:40 +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 0530362b97 Add separate error for missing key system URI.
Before, the same error was used for no available configurations or
key systems and for missing key system URI.  Now there are two
different errors.  Also elaborated on the error in the documentation.

Closes #371

Change-Id: I9b72daa0a99b4761714a74c3ceba60c873c89a77
2016-06-03 00:11:41 +00:00
Timothy Drews fe9189e413 Allow Representations without Segment* elements.
Representations without Segment* elements or which do not
specify "text" as their type are now ignored instead of causing
failure.

Issue #368

Change-Id: Ica6490442dc38c7fdbc778eb0650dd7909d764c5
2016-05-25 00:18:01 +00:00
Joey Parrish b73eeb89d2 Fix support for relative paths in UTCTiming
UTCTiming and configured clock sync URIs can now be relative.

Closes #376

Change-Id: I45f2a22ec6ddea7e345f6df71ebd4195aa3981a7
2016-05-24 18:49:11 +00:00
Timothy Drews b83a9c0a27 Handle output-restricted key status.
If a key is output-restricted it may still be usable.
So, instead of disabling these tracks, indicate that they
may be playable.

Issue #199

Change-Id: Ic13a02d97ccc21533118f17aa907c16d1cda05ce
2016-05-09 15:10:31 -07:00
Joey Parrish 0a3d6bd5b8 Add an option for default clock sync URI
Applications which cannot control their manifests may need to specify
a default clock sync URI for use when UTCTiming elements are missing.

Closes #290

Change-Id: I5704b25d2d3199ceb932f8102490a9b3e8a27dac
2016-05-04 07:44:15 +00:00
Joey Parrish 2e19ebe14a Revert "Update clock sync on manifest update"
Hitting UTCTiming sources over and over could be considered abusive
behavior at scale, so we will only sync the clock once on startup.

The change to update clock sync on manifest update was added for #345,
but it seems that this was not part of the fix, since the content in
that issue had no UTCTiming element at all.

Change-Id: I32f4fc0a40fc92feeb54191e5fe869e0aaa9b54c
2016-05-04 07:44:15 +00:00
Joey Parrish 1fb78929c1 Warn when UTCTiming is missing for live
Without a UTCTiming element in the manifest, a client cannot
synchronize its clock.  This can easily lead to playback failures,
so we warn application developers when we detect this.

Issue #290

Change-Id: Idcb395f5ece67bf2c7d0d984ad277f552d030eb8
2016-05-03 18:47:55 +00:00
Joey Parrish 8ad7762a7c Fix typo that broke docs build
Change-Id: I7f12215097beb99792eaea6b9e4c2fc4de87524d
2016-05-03 18:45:26 +00:00
Timothy Drews 294bcca4e9 Treat absent timeShiftBufferDepth as infinity.
This patch also enables presentations to start in live mode
and end in VOD mode.

Issue #351

Change-Id: Idc0ad0c69887d61d080f844ef388222d1228a535
2016-05-02 14:22:38 -07:00
Joey Parrish bc17162407 Fix key system content type checks
Some browsers, such as Edge 13, do not report capabilities at all.

Not all encrypted streams have known key IDs, so we should not
use that as a predicate for the encrypted content type filter.

Since not all content has both audio and video, the requested and
reported capabilities may not have both either.  So we should
default capabilities to empty lists if missing.

This also adds an encrypted audio-only asset so that audio-only is
covered by our integration tests.

Closes #342
Closes #360

Change-Id: If5973c4ddea358d96ab305700e027021b1a7b65a
2016-05-02 18:22:52 +00:00
Timothy Drews 1108700f10 Use segment info to adjust the pres. timeline.
* Permit non-zero presentation start times for VOD: some
  presentations have segments which start too far from 0 to
  allow the video element to begin playback; now the player will
  start VOD presentations from the start of the first segment.
  However, segments of the 2nd, 3rd, 4th, etc., Period of a
  multi-Period presentation must still start close to 0 (the
  player will not jump any gaps in the presentation).
* Prohibit seeking to regions at the beginning of the segment
  availability window if segment information is missing from
  that region: sometimes live manifests do not contain all the
  segments in the segment availability window; now the player
  will prohibit seeking to these regions.
* Update definition of live in DashParser to match Player and
  Playhead.
* Simplify PresentationTimeline's constructor by just using setter
  functions.

Issue #341
Closes #348
Issue #357

Change-Id: I96c22774448476bea89ff4014f03b87bdb51ba07
2016-04-26 21:09:57 +00:00
Jacob Trimble f9552a5359 Update clock sync on manifest update.
Issue #345

Change-Id: I9faef800444e3b818c8da64cf71848a99713c3ff
2016-04-22 09:52:45 -07:00
Jacob Trimble cc243faac9 Improve live stream support
* Support minimumUpdatePeriod="PT0S".
* Fix comparisons with very large timestamps.
* Assign default Period ID if not given.
* Increase suggestedPresentationDelay.

Closes #331
Closes #339

Change-Id: I091cb7ab3e2a1cdb38e4161fe139a96a10de3807
2016-04-21 23:38:04 +00:00
Timothy Drews d36bb6bcf0 Set maxSegmentDuration for ST w/ duration.
Also add more unit tests for maxSegmentDuration.

Change-Id: I7648f64ab9f90c70d1daf53f30a3d558b7a899f3
2016-04-21 23:04:27 +00:00
Jacob Trimble e1d834f3c2 Add track restrictions to Player.
Now the application can restrict the kinds of tracks that the Player
will play.  This is done through player.configure().  This also
allows restricting the playable tracks based on the EME key status.

Closes #326
Closes #327

Change-Id: I88210ece6fd1db886c49d4599fbe5814d394132d
2016-04-15 12:21:24 -07:00
Joey Parrish 9e7c000735 Fix typo in method name
Change-Id: Ie39a118190b8a81295f9181b2765eb047f8f54b7
2016-04-11 16:32:20 +00:00
Joey Parrish 8df544637a Default track language to "und" - undetermined
The default language code should be "und", since a blank string is not
a valid language code.

Change-Id: I5c201d98492881658820c512332f23444c415504
2016-04-04 17:12:44 +00:00
Joey Parrish 32e351d060 Add @namespace annotations to static classes
Without @namespace annotations, static classes do not show up in the
generated API docs.  Although I stumbled over one instance while
writing tutorials, the rest were discovered programmatically by:

for x in $(find lib/ -name '*.js'); do
  grep -Eq '@(constructor|interface|namespace)' $x || echo $x
done

Change-Id: I97dd2bb4bf3faad5ac8d952a28837fa1f594deb9
2016-04-01 11:37:41 -07:00
Timothy Drews 0b4398fc7c Don't replace PresentationTimeline on MPD update
Only update segment availability duration.

Issue #295

Change-Id: Ia73338be4c308169f28f5394c9d4ef5dbc8af304
2016-03-31 19:12:27 +00:00
Joey Parrish a9b4cd89d0 Merge pull request #315 from cmgrecu/master
Update end time of last segment in a period when new periods are added

Fixes #310
2016-03-29 13:28:37 -07:00
Jacob Trimble 8b85e58f73 Add several utility functions.
Change-Id: Ifbd2582747d2cb54d4abda789b0989b7a6b77aa6
2016-03-29 20:17:44 +00:00
Costel Madalin Grecu 013f1e6478 Remove outdated todo item 2016-03-29 11:24:15 +03:00
Joey Parrish 9263bddbb4 Default text tracks to subtitle
Change-Id: I56e1f79eaf55dc01a2a6e8e28a3121de81a9864b
2016-03-28 16:47:34 +00:00
Timothy Drews 3e300d25ae Fix live-edge calculation.
The live-edge calculation in PresentationTimeline needs to take into
account the duration of the current segment since the current segment
is not available until it has ended.

To do this we use MPD@maxSegmentDuration when available, and compute our
own maxSegmentDuration when it's not (as specified by the DASH spec).

Change-Id: Ic5b8478dbbff8eac93cf123a00a8b02db140cf15
2016-03-22 20:50:51 +00:00
Joey Parrish bc1958fd3e Fix timeline duration for multi-period live streams
Multi-period live streams have no presentation duration and have no duration
on the final period.

In this case, we were setting the timeline duration to the start time of the
final period, based on end = start + duration with duration == null.

This fixes the situation so that timeline duration is infinite.

Relates to #310

Change-Id: I8592318e3d4c5643fa1fcc03b34624957a2e974c
2016-03-22 01:23:06 +00:00
Joey Parrish e50832f372 Do not require AdaptationSet ids for update
When updating a DASH manifest, we can key off of Period and
Representation only.  The spec says that Representation IDs are unique
within the Period, and that Period IDs are unique within the
presentation.  Therefore we do not need an AdaptationSet ID to merge
on update.

Relates to #310

Change-Id: I12b9f83c2bfda958a14e9ee31d459c04da8722e6
2016-03-21 16:38:31 -07:00
Joey Parrish fe66d55267 Merge pull request #307 from cmgrecu/master
Fix presentationTimeOffset handling in v2 #297
2016-03-20 21:23:02 -07:00
Costel G d56cbb1385 Add PTO support for SegmentBase 2016-03-20 15:36:28 +02:00
Costel G 543481df14 Correctly apply PTO in SegmentList 2016-03-20 00:26:56 +02:00
Costel G 2f5d8e8376 Implemented presentationTimeOffset in SegmentList 2016-03-19 10:30:42 +02:00
Jacob Trimble e74f43bb94 Add clear key to ContentProtection key system list.
This also changes DrmEngine to reject key systems that do not have
any license servers, this causes init() to fail.

Change-Id: I10148c2caa2ffc57bf6c5f16421ed0600d98be95
2016-03-17 23:09:50 +00:00
Costel Madalin Grecu c0e0aef46d Fix presentationTimeOffset handling in v2 #297 2016-03-16 12:08:06 +02:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Joey Parrish 4e7a0c2258 Correct segment fit check
The sense of the condition was inverted, causing final references not
to be fit to the period

Change-Id: I4b83643ae029e0bf285be37238418c827fd3093b
2016-03-15 14:35:48 -07:00
Joey Parrish 03be508b62 Fix jsdoc error
Trailing comma in this typedef caused jsdoc to have a fit.

Change-Id: If0734940ec989ac23480309112a676c67adebfd3
2016-03-15 21:10:12 +00:00
Timothy Drews 1007ffbc5e Fit SegmentReferences into their Period.
This ensures that small gaps from the start of the Period or from the
end of the Period are not interpreted as missing SegmentReferences.

Change-Id: I7492faef8e44067494e3daf3ff73742fa914d1e3
2016-03-15 13:50:19 -07:00
Jacob Trimble 8b99513242 Removed live check from Dash parser.
Our new interpretation of whether a stream is live is if there is
no duration.  This removes the old check for type='dynamic' from
the Dash parser.

Change-Id: I58aa1a785c7e949be7b48ab5b3b409cbf8e828a6
2016-03-14 21:19:32 +00:00
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