Commit Graph

2275 Commits

Author SHA1 Message Date
Natalie Harris f3e6003f9d Allow injection of a custom IAbrManager implementation at runtime.
Closes #48.

Change-Id: I8f15adb9143076626bdc616e3f3ba4f3be90324e
2015-05-22 17:26:58 +00:00
tdrews 202799a9db Merge pull request #79 from swilly22/ajax_timeout
Handle Ajax Request timeouts issue #78
2015-05-12 14:30:27 -07:00
swilly22 4a542cafdb Helper function which re-sends ajax request 2015-05-12 10:28:43 +03:00
swilly22 860adfac7c Handle Ajax Request timeouts issue #78 2015-05-11 17:22:17 +03:00
Natalie Harris 561006b49f Create an abstract interface for AbrManager. Issue #48.
Change-Id: I5e0e43f27e00506bbe7a01d9fe605575fdce120b
2015-05-08 17:50:10 +00:00
Natalie Harris 48088130b8 Make buffering runtime-configurable.
Closes #49.

Change-Id: I954e247e83a27c5f9f2e56bb7b57c714c1d8db71
2015-05-06 21:27:49 +00:00
Natalie Harris 99e16661bf Make XHR timeout runtime-configurable.
Closes #50.

Change-Id: I812192cdcb3a272977f418c8853a052fa7f650fa
2015-05-05 10:36:59 -07:00
Natalie Harris a93a5c66fb Make OfflineVideoSource estimator arg nullable.
Closes #72.

Change-Id: I73728c85ba8e8641a2a953c3ec11bcabc5ff6b2b
2015-04-29 15:41:39 -07:00
Natalie Harris d2bb9cf25f Rest of Offline tutorial. Issue #60
Change-Id: I27108a03891abda5e8d57a70ac5e1739f0719323
2015-04-29 12:53:40 -07:00
Joey Parrish 7dc3c1b0a9 Choose live playback by type='dynamic'.
Also avoid fetching manifest updates when minimumUpdatePeriod is
missing.  In the absence of minimumUpdatePeriod, just reprocess
the MPD we already downloaded.

Closes #69, #70.

Change-Id: I138bf136e5b0d691d9d625bbad02fb07ae21d32f
2015-04-28 11:59:55 -07:00
Natalie Harris f9330a59e9 Adding hard-coded minBufferTime to offline playback. Issue #22.
minBufferTime is hard-coded when reconstructing manifestInfo
from offline. This is needed to prevent failing assertions
during playback. 5 was chosen because it is large enough to
keep playback going properly and small enough that the buffered
data won't get garbage collected.

Change-Id: Iabb08137bda95d15f35a5e5f6386c0be321de7fa
2015-04-24 13:18:48 -07:00
Natalie Harris 23e7a8e11f Progress events for Offline storage. Issue #22
Change-Id: Ic8c24241b8a55a42c4207084491e5a3e2a0d0a86
2015-04-24 16:45:24 +00:00
Vignesh Venkatasubramanian 72fe1b2ce6 mpd parser: Handle minimumUpdatePeriod being set to 0.
For live streams, minimumUpdatePeriod can be set to 0. It means that
we shouldn't refresh the manifest until there's an explicit signal
from within the stream. As of now, there's no way to get that signal
from MSE. So as a workaround, if we see a minimumUpdatePeriod of 0,
we set it to 10 seconds. This is similar to how Exoplayer and Dash.js
handle this case.

[1] https://github.com/Dash-Industry-Forum/dash.js/blob/fe14ee023c0e3aa073284ce034758942e8f3c7bf/build/test/js/utils/MPDHelper.js#L12
[2] https://github.com/google/ExoPlayer/blob/953e1118a58a269ded8b0246874bd827d900fcf0/library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java#L270
2015-04-21 18:17:18 -07:00
Joey Parrish a849f033ea Remove reliance on node.children.
Use the slightly more old-fashioned childNodes property instead.

Change-Id: Iade1ff63b4f86d53712ac818024c02f5e9b658b7
2015-04-21 16:12:15 -07:00
Joey Parrish 9ebd522c15 Add a polyfill for CustomEvent.
Change-Id: I92ac840976794e62c6ffc18a2065d4ebc4dfb33c
2015-04-21 16:11:47 -07:00
Joey Parrish a61c544de0 Make polyfill installation easier.
Change-Id: Ia8ccfae3c56d7146c9a2c65f8788bd5e5044579e
2015-04-21 10:54:34 -07:00
Joey Parrish 7ea820c399 Fix fullscreen polyfill test.
Only install a getter for fullscreenElement if the property does not
exist.  Previously, we installed the getter if the property existed
but was null.

Change-Id: Ibea5bc63a75a98cd1d50c56ca99fac2aa38e449b
2015-04-21 10:54:34 -07:00
Timothy Drews ecc1f80279 Don't go into a buffering state while paused.
Closes #61

Change-Id: I46ce7b97b6058797ba643b77ccf72399dadc9765
2015-04-20 15:33:17 -07:00
Joey Parrish cad2218d99 Update changelog and bump version to v1.3.0
Change-Id: If99ce53c1c180cb8414bc691bc5d688bfea0102f
2015-04-16 17:12:29 -07:00
Joey Parrish 3d6bce90a2 Add docs for live streaming events.
Issue #21.

Change-Id: Id45875f7b2630320c2bbeba98a97ff5e8ecfb3dd
2015-04-16 13:21:07 -07:00
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
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
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
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 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 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 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