Commit Graph

3764 Commits

Author SHA1 Message Date
Joey Parrish 0890d33107 Do not enable subtitles unless a match is found.
If the user's preferred audio language is missing, and there are no
subtitles in the user's preferred language either, do not enable
subtitles by default.

Change-Id: I57e7ba3679758bbd0e8f460767913d090d0d5630
2015-04-16 11:39:31 -07:00
Joey Parrish 23872b65a7 Give an example of the Role tag.
Change-Id: Ifbc5fd0349a4b3bf679df2285162c01d53fce245
2015-04-16 11:39:31 -07:00
Joey Parrish 9ac2fb5f0a Update code samples in Player tutorial.
These were updated earlier in the sample text, but the HTML was not
updated.

Change-Id: I8ef02a46a28c20f6dc0e835a44ceff88cdfd4515
2015-04-16 11:39:31 -07:00
Timothy Drews 99ef55079c Show "LIVE" indicator in the UI for live streams.
Change-Id: Id77c22bbfdd165f9f8e6b1074d5d79eda26ad61f
2015-04-15 23:43:12 +00:00
Timothy Drews a377640961 Wait to move the seek end time until stream start.
* Wait to move the seek end time until all the streams have
  started so that the playhead starts at 00:00.
* Only fire 'seekrangechanged' events after the streams have
  started so the seek range doesn't jitter (caused by timestamp
  correction).

Change-Id: I82f90d896d124c7bb49580100d9592948a358935
2015-04-15 23:43:02 +00:00
Timothy Drews 5e6bd2507a Make MediaSource duration larger for live streams
Setting the MediaSource duration to a larger value ensures that
the stream can play-out longer.

Change-Id: I04d330692f0f1291d85a605be53636842f3b42fa
2015-04-15 15:55:51 -07:00
Timothy Drews 2e021bc1c2 Reset video.playbackRate if stream startup fails.
Change-Id: I793d9ae41b2be5839c78222240d938735219596f
2015-04-15 22:40:26 +00:00
Joey Parrish d3a5daf2ad Refactor 404 handling for live streams.
* Remove the acceptableErrors system and replace with a status check
  in SBM on request failure.
* End an SBM fetch task early on 404 or 410, but only during start
  and switch.
* Retry segment fetch to recover from 404/410 errors sooner.
* Set retry delay based on segment duration.
* Remove the 'truncated' fetch mechanism and the 'pleasebuffer'
  mechanism.  (Retry is more robust than entering a buffering state.)
* Retry MPD requests as well.  (Some live streams seem to experience
  very transient 404 errors when requesting updates.)

Issue #21.

Change-Id: I2d3b838a9afe950e9ed0a91da9b952d8a30bf0a1
2015-04-15 10:24:49 -07:00
Joey Parrish e37dbce2f7 Change underflow system in Player.
Underflow is now possible before the playhead enters a gap in the
buffered ranges.  Some misbehaving live content freezes with as much
as 50ms of data still buffered, so going into an underflow/buffering
state with a positive amount of buffered data is desirable.

To keep this from causing trouble at EOF, there is a special check
against video.duration.

Change-Id: I5a350c543fe33910a55cd8e9ebd8fd1ab2d6408c
2015-04-14 14:53:21 -07:00
Joey Parrish bbf1f21a2d Correct calling of Task.end() cannot be enforced.
Since a task stage is asynchronous, some async part of it may need to
call end().  Because of this, we cannot realistically know if the
caller is part of the stage or not.

Change-Id: I2a31515b9a4c6dd1bf246079fb42effe7a2da622
2015-04-14 14:49:38 -07:00
Joey Parrish 55e25d125b Schedule the switch in the video timeline.
Instead of always replacing the currentTime, only replace starting
at the currentTime for immediate switches.  Otherwise, use bandwidth
estimates to guess what the video currentTime will be when the new
segments have been fetched, and replace the old segments starting
at that point.

Relates to #51.

Change-Id: I0e8546402cb0f7a007a6c210ed3b215c8379e236
2015-04-14 14:45:39 -07:00
Joey Parrish aed0152580 Change debug of switch timing.
Instead of measuring switch time for non-immediate switches, measure
for all switches in non-compiled mode.  Switch latency for non-
immediate switches is a much looser metric, but still useful for
debugging and performance testing.

Change-Id: I0cf83aa016406569d5bb3ce86387bdaab3fe0038
2015-04-14 14:37:14 -07:00
Joey Parrish 10f80d2577 Refactor minBufferTime and bufferingGoal.
Strip extraneous minBufferTime copies.
Default minBufferTime in MpdProcessor if missing.
Pass minBufferTime as a parameter to Stream.start().
Keep a buffering goal separate from minBufferTime, which will only
be used for stream startup (as intended by the DASH spec).

This allows us to startup quickly and still buffer ahead.

Relates to #51.

Change-Id: I94b6b2566419344fa761ff75b0884719f255cd66
2015-04-14 14:35:02 -07:00
Joey Parrish 44b975da58 Supply a bandwidth estimator if none is given.
Change-Id: I1552b113445f0902cfd0f84c7fe6a8d202c0ae5c
2015-04-13 16:43:22 -07:00
Joey Parrish 4afdc4cc53 Correct throws annotations for Task.
Change-Id: I1a2f8ab5923ee6f93b0894ba584465d8e4cd5cca
2015-04-13 11:35:41 -07:00
Joey Parrish c700a9a198 Throw an error if DRM info is missing.
This can happen if the application neglects to provide a callback to
interpret ContentProtection.

Change-Id: Ibd011c9d3b1fbd94a4ed3797044c1941ff277f99
2015-04-13 11:34:58 -07:00
Joey Parrish 5f063f0385 Add waitForTargetTime to integration tests.
This reduces flakiness around inaccurate delay() calls.

Also:
 * Changed some tests to avoid a playbackRate race.
 * Reduced the playback rate in one test to improve stability.
 * ...?
 * Profit!

Change-Id: I452f6eb3b7f331c973a8d20b436ecab2b5576f21
2015-04-10 16:29:26 -07:00
Joey Parrish ca43b8e290 Remove streams from test app UI on delete.
Issue #22.

Change-Id: I4caa73629d3055c0ff734a7236fa55997495fe05
2015-04-10 23:29:15 +00:00
Joey Parrish d67198e61f Use a separate content DB for unit tests.
Issue #22.

Change-Id: I4a1f62dd0106ab8e68fe80bde9f4d2f75e00c373
2015-04-10 23:27:57 +00:00
Timothy Drews 8c0d93009c Enable injecting custom IBandwidthEstimator impls.
* Export FakeEventTarget so IBandwidthEstimator implementations
  can use it.
* Expose IBandwidthEstimator methods so they do not get renamed
  in compiled mode.

Change-Id: Ib4c58d2357afdf402482202dc9fb8cf42dbbfad1
2015-04-10 15:29:58 -07:00
Timothy Drews 9672a4e907 Disallow null estimators.
Change-Id: I9e687c11009d64b3de0924de0e0fec3a55d0775c
2015-04-10 22:24:46 +00:00
Joey Parrish 22a2d2bca5 Simplify watchdog timer, improve buffering state.
Running the watchdog timer all the time and inhibiting its function
during certain states, as opposed to starting and stopping it on
various events, improves stability and reliability.

This fixes some corner cases and bad interactions with various live
streams.

Change-Id: I0dfdcc54dc0d11eb1f313971e5fabb5ed606b139
2015-04-10 21:51:35 +00:00
Joey Parrish 5f3a153913 Refactor compilation wrappers.
The new wrapper has been tested using:
 * commonJS in node.js
 * requireJS in node.js
 * requireJS in a browser
 * directly in a browser

This also corrects the exports for commonJS to omit the "shaka"
namespace.  For example, you now get "module.exports.player" instead
of "module.exports.shaka.player".

Change-Id: Idf6b05d7d667aded925818001f730747ceeae2e9
2015-04-10 12:38:07 -07:00
Timothy Drews d3ec42d979 Better handle misbehaving streams.
Fix a number of error cases which caused failed assertions
and erratic behavior.

* Handle EOF in resync().
* Handle aborted clear() in resync().
* Ignore 'seeking' and 'play' events from onStreamsStarted().
* Handle empty SegmentIndex in setTargetUpdateTime_().

Change-Id: Ia1fafff068cae238eaeca0cee06391a3a837514a
2015-04-10 18:53:53 +00:00
Joey Parrish 45710616a2 Include all exported classes in the build.
EWMABandwidthEstimator is not used internally, but should still be
exported.  This keeps it from being stripped as dead code during
compilation.

Change-Id: Ie75b0a2987b439e85e64ffee560553ca0846bd25
2015-04-10 11:38:27 -07:00
Joey Parrish d35df2817b Allow smoother dragging in seek controls.
Update the currentTime UI while dragging the seek bar.

Defer seek-bar-initiated changes to avoid spamming video.currentTime
with seeks.

Change-Id: I8f8f6e52d05f4b94d671e30ab7423014bcbb8e13
2015-04-09 19:32:00 +00:00
Joey Parrish 03964e4c84 Drop suppressMultipleEvents from DrmSchemeInfo.
This interfered with key rotation, and was not widely used.  Removing
the feature is the more general approach, and the worst that will
happen is that some applications will see more sessions than they
strictly need.

Change-Id: Ide2238433af296e729e4401711672fb17257093e
2015-04-09 19:31:34 +00:00
Joey Parrish ce58300072 Fix reference check errors.
I should not have used "this" inside an anonymous function.
Converted this.references_ to a captured variable.

Change-Id: Ifc191c35aceac25e69b1de267688f91d4f66badd
2015-04-09 12:05:46 -07:00
Joey Parrish fa931883f7 Minor clean-up in Stream.
Use Stream.BUFFER_SIZE_SECONDS_ on startup.
Improved the way adaptation latency is measured.
Avoid calling abort() twice during adaptation.
Reduce the size of the Promise chain slightly.
Merge the SPLICING state into SWITCHING.

Change-Id: Ie06e6c56df4df17e7acb379d0e19f639f791c99b
2015-04-09 18:52:05 +00:00
Joey Parrish b6753da727 Fix buffered range indicator for live streams.
Change-Id: Ib618d42ac3ced487b79b32b704979f3041ee4429
2015-04-09 18:25:29 +00:00
Joey Parrish 51563c118f Use start time as reference ID.
Since SegmentTimeline streams may not have segment numbers, we should
not use segment numbers as reference IDs.  These IDs must be unique
for the buffering and streaming systems to function properly.

This also adds assertions to check that reference IDs are unique.

Issue #21.

Change-Id: Ia94a48c68149283f87d27c6595a4f5a6cca07a27
2015-04-09 10:10:38 -07:00
Joey Parrish 72046285df Correct FakeEventTarget exception handling.
If an event handler throws an exception, this should not affect the
caller of dispatchEvent.  This corrects FakeEventTarget's behavior to
more closely resemble EventTarget, and makes many of our asynchronous
processes more resilient to errors in application-level handlers.

Change-Id: I41202aa24650ebdba3310f20864568eea32b74ce
2015-04-09 17:09:35 +00:00
Timothy Drews ea1f0120ef Align each SegmentIndex to its media timeline.
A SegmentIndex only provides an approximation of its media timeline. The
differences between the two can be particularly problematic if the
SegmentIndex is "behind" its media timeline, as such an offset may cause
the stream to get stuck during startup.

* Correct each SegmentIndex using timestamps in the actual segments.
* Make hasStarted() return true only after the Stream fully initializes.
* Adjust the seek range after computing a timestamp correction.
* Set timestampOffset for all types of SegmentTemplate based manifests.
* Remove PTO rounding, which is not required with timestamp correction.
* Only attempt to resync Streams after all streams have started.

Change-Id: Id03c38826d07513d8f451029ffc9d891854c19df
2015-04-09 16:21:20 +00:00
Timothy Drews d414d4eaa7 Fix load stream in compiled mode.
* Move retrieveGroupIds to OfflineVideoSource.
* Quote properties of stored objects to avoid variable
  renaming issues.

Issue #22

Change-Id: I31ca1261411de5ff5ae4859da571d0029ed77f42
2015-04-09 16:16:40 +00:00
Timothy Drews 176aac3bc1 Only set a target update time for live manifests.
Issue #21

Change-Id: I7bb43972b08f1121268ae5590bd5f456f97659ab
2015-04-08 22:48:14 +00:00
Timothy Drews a19ec9337f Fix earliest/best segment for SegmentTimeline.
* Only fallback to 0 for the earliest timestamp if there are
  no segments.
* Don't allow the best timestamp to be less than the earliest
  timestamp.

Issue #21

Change-Id: Ie4df6e36d60adc0ee0dfc54dcbefef7ae0de2705
2015-04-08 22:48:12 +00:00
Joey Parrish 23db99c5cf Use BUFFER_SIZE_SECONDS_ for sanity only.
The BUFFER_SIZE_SECONDS_ parameter should be used only as a sanity
check in case the MPD specifies a tiny minBufferTime or none at all.
Having a large value meant that we sometimes tried to overbuffer for
live streams.

Relates to issue #21.

Change-Id: If086ef54618621fa77b169be58f4bfc9e255525e
2015-04-08 09:55:26 -07:00
Joey Parrish 0dbf69f83b Update changelog for v1.2.3
Change-Id: Ia946a421a2f68e9b1a0c05992be28849975ee1df
2015-04-07 14:21:18 -07:00
Joey Parrish ffb4220bac Clean up Stream constants.
Drop unused SWITCH_BUFFER_SIZE_SECONDS_ and combine
SINGLE_FRAME_SECONDS_ and the unnamed nudge constant into NUDGE_.

Issue #51.

Change-Id: I5d9a001aa6432a859b6205ded6e1d75be759b9db
2015-04-07 11:52:26 -07:00
Timothy Drews ea6d57c232 Reorganize mpd_processor.js
* Make function order in mpd_processor.js match function
  dependencies.
* Make a two line parameter list into a one line parameter list.

Actual code and comments are not changed.

Change-Id: I586b2552601a3c36c5cd1711f4589447213462a4
2015-04-07 18:31:41 +00:00
Natalie Harris a0aa5e51c6 Retrieve list of currently stored group ids. Issue #22
Change-Id: Ifeaa4085ec289679ccd9cb1fc22bd400c9cd8198
2015-04-07 15:32:36 +00:00
Joey Parrish ae8b3fb3f0 Combine index.js and shaka-player.compiled.js.
This cuts down build time by 30%.

Change-Id: I882a7d5996aa996863af418006d3e40b95d6df05
2015-04-06 22:34:32 +00:00
Timothy Drews 79b638fe8d Evict unavailable SegmentReferences.
Issue #21

Change-Id: I137f5e1e38f093e355ace5aaa29780bd93980fad
2015-04-06 15:25:49 -07:00
Timothy Drews b8b3ad862b Cleanup SegmentIndex, make merge() more robust.
* Rename SegmentIndex functions to shorter names.
* Add first() and last() functions for convenience.
* Throw exceptions for out of range errors.
* Handle more corner-cases in merge().
* Add more unit tests.

Change-Id: If875cd766e7091504c028413694326fcdf2aae5b
2015-04-06 22:07:17 +00:00
Natalie Harris 86ffb4fb2b Delete a group of streams from storage functionality. Issue #22
Change-Id: I0318da7adc9cfdb154fb826486718385a771f544
2015-04-06 20:25:12 +00:00
Joey Parrish 8e18bf0e0b Add support for hours in the currentTime UI.
Change-Id: Ib2c215860c8ce4b0d9d59be10a8bd5f81cfde12a
2015-04-06 11:05:28 -07:00
Joey Parrish 489abbffdc Measure MPD fetch latency.
Issue #21.

Change-Id: Id1720fbfb716df414262604d8c1b86c78dd6fe93
2015-04-06 10:54:23 -07:00
Joey Parrish 9a11ecdbde Hide offline rows until shown.
Change-Id: Id315eec8820623b076b60f011014dbc17348a808
2015-04-06 17:27:04 +00:00
Joey Parrish 73afa67be7 Fork SegmentTemplate test asset as non-live.
The test asset as it exists upstream is styled as a live stream, in
spite of the fact that it is static content.  This creates a bad
experience in the test app when this asset is selected.  Fork it and
remove the update property that makes the Player treat it as live.

Change-Id: I8bc18c68186ccf9f51e9e031753bb39ed33e065a
2015-04-03 18:54:51 -07:00
Joey Parrish f0f93726ea Add live seek range support to the test UI.
Issue #21.

Change-Id: Ibc338b46e423d8f7ecafdaa7c2397032faabbd1a
2015-04-04 01:40:46 +00:00