Commit Graph

142 Commits

Author SHA1 Message Date
Joey Parrish 93bcf28e41 Fix mixed content URLs in integration tests
Change-Id: I9b50b581b341302fbeaf127c411e16d9927facf2
2015-10-20 16:41:24 -07:00
Jacob Trimble 5637962073 Offline now doesn't use data URI for init data.
Also now uses the same ContentDatabaseReader for offline segment
requests.

Change-Id: I9cebc90b46ca9067467a8a343d48b264abc7cf26
2015-10-19 23:10:22 +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 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
Timothy Drews fb9c419e1b Make ST + @duration test use explicit values.
Change-Id: Ibd2a9327898ef798b10c617507706a4b4780daa9
2015-10-05 09:31:12 -07:00
Jacob Trimble be008764a5 Reorganize MpdProcessor tests.
* Renamed mpd_* files to mpd_parser_* where applicable.
* Gave the mpd test groups more descriptive names.
* Split mpd_processor_spec into several files.
* Cleaned up the createStreamInfoFromSegmentTemplate_ tests.

Closes #189

Change-Id: I71daa1600e944b53937030ff87b53a3dbca3948e
2015-09-28 16:34:49 -07:00
Jacob Trimble 1f88c9dae1 Reorganize integration tests.
* Split player_integration into several files.
* Moved some helper methods from player_integration to
  integration_util.

Closes #188

Change-Id: I14cb2eda8375fc24ef0419e7993027b90e881d5b
2015-09-28 23:09:51 +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
Jacob Trimble 9b50f2ad94 Deleting offline content now deletes persistent session.
Closes #171

Change-Id: Ia0ff2c9892f53c2ceeddb2b589e2e2c886aea54a
2015-09-24 22:05:01 +00:00
Timothy Drews 80961de8f2 Reduce preferred language test flakiness.
Wait for playback to begin after each load(), not just the
first load().

Change-Id: I790270d5054ba1c1878c65f1a60e1fa0655e4a3c
2015-09-24 17:39:41 +00:00
Timothy Drews 638b9a1274 Fix preferred language tests.
Waiting for playback to begin ensures there's an active
audio track.

Change-Id: I9b5a107fc1644bd6a61349bac0618148239e389d
2015-09-23 15:45:37 -07: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 5e84b9bd39 Fail gracefully when all tracks are restricted.
* Fire an error event when all audio/video tracks are restricted
  during playback.
* Fire an error event and fail gracefully when all audio/video tracks
  are restricted before playback (requires calling player.unload() when
  the VideoSource's attach promise gets rejected).
* Rework AbrManager so that getInitialVideoTrack() can be called before
  starting bandwidth monitoring.

Closes #170
Issue #179

Change-Id: I4ac6cdf2a4c862e0d0560dff2f2d7bb6801bbc38
2015-09-15 21:12:39 +00:00
Timothy Drews 6049d67804 Re-allow pausing while rewinding.
This fixes a regression and adds more integration tests.

Closes #130

Change-Id: Idd386931ae6d9f37052f24438ebcba10774e3451
2015-09-11 13:09:29 -07:00
Joey Parrish 4e69e00b67 Fix CENC car MPD for IE & Firefox
The manifest didn't declare an XML namespace.  Firefox and IE are
very strict about this, whereas Chrome is not.

Change-Id: I96fd44bb2debb974d7587603732965982681eadd
2015-09-09 19:59:24 +00:00
Timothy Drews 9fd655f17c Fix SegmentTimelines with @presentationTimeOffset.
Fixes #143

Change-Id: I49bf77c7a63be48bcac19281dcadd373b52bcd4f
2015-09-08 21:57:13 +00:00
Joey Parrish 4cc4e96dbd Overhaul license comments and file annotations
* Updates all Copyright years to 2015.
* Adds licenses annotations to all JS.
* Makes all licenses identical to avoid repeated appearance in the
  compiled output.
* Drops fileoverview annotations, which do not affect docs output.
* The linter still requires fileoverview on externs.

This patch required a newer closure compiler, since the previous
version we used had a bug regarding license annotations that caused
the license comment block to appear in the output once per file
regardless of uniqueness.

Change-Id: I2e9272db680cba7ecc4613d97f1d3a94ac2244cc
2015-09-08 12:02:34 -07:00
Joey Parrish 4d9177240a Revert "Adding license annotation to js files."
This reverts commit 8cb24652cb, due to
the fact that the new annotations caused our binary size to jump
by 52%.

The compiler preserves all 'unique' licenses, which causes trouble
since the comment blocks with the license annotations are not unique
and contain file overview comments as well.

We can re-examine this once we have restructured the license headers.

Change-Id: I418e407a0e0253630633697f30cf496a7fc2ddfc
2015-09-04 18:36:39 -07:00
Yohann Connell 8cb24652cb Adding license annotation to js files.
Change-Id: Id10592ccaf35608ac4f01844cae2fec4a2030d65
2015-09-04 00:05:17 +00:00
Joey Parrish 36e121b859 Support rewind outside of buffered area
Closes #165

Change-Id: I684560b332808f9acffcfc09ad8fffcd8c164fba
2015-09-01 21:56:42 +00:00
Joey Parrish 60491b4080 Deflake rebuffering test
The underflow threshold was too small (measured 0.13s buffered during
underflow), and the minBufferTime was unnecessarily large.

Change-Id: I468a010a5f30ad64ccde8ce05d6482b02e71b9d4
2015-09-01 16:46:14 +00:00
Joey Parrish 97769bd413 Clean up exceptions on Player.destroy()
This introduces a new method on PublicPromise called destroy(),
which does for Promises what destroy() does for the other classes:
shuts down async processes and cleans up references.

In addition to catching errors and shutting down more cleanly in a
wider array of circumstances, this may also help with GC, since we
no longer leave pending Promises around with handlers attached to
them.

Closes #151

Change-Id: I205c5979418fbc18cd7e35d91d0de2746f337137
2015-09-01 00:16:05 +00:00
Joey Parrish 45fbcbc407 Add extra debugging to loop test failure
This test has failed once in many, many, many test runs.
Add extra debugging so that we can deflake it if it fails again.

b/23226999

Change-Id: Id2f7f4b7cb535ab155c6ba35c9912f755e381c57
2015-08-31 22:32:02 +00:00
Jacob Trimble 7deaab25e7 Replaced integration test delay() with waits.
In several places in the integration tests it uses delay() to wait
for something to happen.  Now it uses wait* methods instead.  This
should make the tests less flaky.

Closes b/23226999

Change-Id: I17c4a51c4e7f3f794de5aacf5c44378fd9d9f37e
2015-08-26 23:11:32 +00:00
Joey Parrish e4d36265cb Fix off-by-one error storing offline content
The final chunk was only being stored when the endTime of the final
segment happened to be null.  An index with explicit end times for
all segments, even on one stream, would trigger this bug.

For example, the end time of the final video segment may be null, but
the end time of the final audio segment may be equal to the content
duration.  The stored audio would be missing a chunk, causing the
computed stream limit to be too short on playback.

This corrects the off-by-one error in the storage code by explicitly
signalling when a segment is the last one, rather than checking for
a null endTime.

Closes #157

Change-Id: Ic99d53b9e2b071409d4d9472b8bc4ae0cf76f940
2015-08-26 22:26:30 +00:00
Timothy Drews 150fdd49c9 Align buffering conditions w/ buffering goals.
Make the Player exit the buffering state when the minimum
buffering goal between all Streams has been reached.

Closes #166

Change-Id: I09753c88e2ea998e9a794763592254a89bc35af9
2015-08-26 20:05:38 +00:00
Jacob Trimble b7f09adec1 Added more unit tests for MpdUtils.createTimeline.
Change-Id: I4ff356990a008d9fc85e14c534bf5d344e4465b7
2015-08-26 17:16:34 +00:00
Jacob Trimble 8fc33a5122 Network callback now called for MPD requests.
Closes #148

Change-Id: I20455ca1f17d4172f2f3019fa3e23c2f163d18e9
2015-08-25 21:25:48 +00:00
Jacob Trimble fdcee73fb4 Added partial support to specify negative r values in SegmentTimeline
Can now specify negative values for the r attribute in SegmentTimeline.
Not supported with live when used on the last element.

Issue #162

Change-Id: I7206e02f7af469a7daf1e4710befb2d102f4f979
2015-08-25 19:50:05 +00:00
Timothy Drews dc008cc6cf Parse the default_KID attribute.
Issue #67

Change-Id: I7df48dcad94823b2937b3bc88a0d5d9c6087edc5
2015-08-25 18:33:22 +00:00
Timothy Drews 1c58dee0c2 Add new ContentProtection interpretation API.
Add new ContentProtection interpretation API that allows applications to
return multiple DRM configurations for each ContentProtection element
and to parse raw ContentProtection XML elements.

This patch deprecates DrmSchemeInfo in favor of DrmInfo. Furthermore,
DrmSchemeInfo will be removed post v1.5.0.

* Replace DrmSchemeInfo with DrmInfo.
* Move Restrictions class definition into its own file.
* Populate initData values from explicit PSSHs without application
  intervention.
* Allow explicit PSSHs to differ between Representations

Issue #71
Issue #137
Closes b/23428584

Change-Id: Ib8d6ba630b930ee64f923a3f4a3e518abacccf88
2015-08-24 10:41:41 -07:00
Jacob Trimble 52c57163d1 Fixed flaky seek integration tests.
Change-Id: I5ac0385f85eb8fc56a3cb2da5303dba82722c3d5
2015-08-24 09:56:44 -07:00
Jacob Trimble e74ad98eaa Added setNetworkCallback method to dash and offline video sources.
This allows the app to intercept media requests to modify its URLs.
The callback accepts the URL for the request and returns a modified
URL or null to use the original.

Closes #148

Change-Id: I08352754ace05f318706fd93910097c0fa7696f0
2015-08-24 09:35:27 -07:00
Timothy Drews f5c4eb1667 Improve end-of-stream behavior.
For static content, if the playhead moves to the end of the video then
either the video should pause or loop. Before this patch media timeline
misalignment and buffering detection would sometimes prohibit this from
happening.

* Ensure the MediaSource's duration is >= the end of each
  stream's last segment (both before and after timestamp correction).
* Use an append window to keep the MediaSource's duration constant.
* Rework Stream startup so that the MediaSource can be modified
  safely during timestamp correction.
* Remove timestamp correction member variables from StreamVideoSource.
* Fix buffering detection when there are no buffered ranges.
* Add sanity checks and improve logging for debugging MSE issues.
* Improve Stream startup documentation.

Closes #155

Change-Id: I6f7a1d15240af62a2282f3f62b29cd3acd5b1873
2015-08-19 09:30:00 -07:00
Jacob Trimble e0e6621d21 Changing the text track now fires AdaptationEvent.
Closes #147

Change-Id: Idd57ada8155273db50f422096f2d40b8bce38230
2015-08-17 20:54:02 +00:00
Joey Parrish 88c38cb278 Remove clearkey alg, no longer required
See w3c/encrypted-media#48

Change-Id: I85062d5842b46855168cc85b131972415c2a2120
2015-08-13 20:01:25 +00:00
Timothy Drews 97809a008a Rename RangeRequestTimeout opt. & fix unit convs.
* Rename the RangeRequestTimeout option to SegmentRequestTimeout
  since the RangeRequest class no longer exists.
* Fix a few unit conversion errors between seconds and
  milliseconds and vice versa.

Change-Id: I8695c3bfb79ae0e20ec5bc75d9ae9f941bccd023
2015-08-13 16:41:27 +00:00
Jacob Trimble 899c322995 Added support for multiple BaseURL elements.
Added a new class called FailoverUri which handles multiple URLs and
switches to others when one fails.  This is also handles the request
itself.  This replaces SegmentMetadata as well as a number of manual
requests.

The MPD parser now produces arrays of URIs rather than just one.  The
MPD Processor then converts it to a FailoverUri inside the manifest.

Added unit tests to test the new functionality and updated the old ones
to the new changes.

This does not support failover on subtitles since subtitles are handled
by the browser.

Closes #68

Change-Id: I5410104827b9e4102b243444b1b5a3f01dcaf10d
2015-08-10 16:01:06 -07:00
Timothy Drews 7623b58fea Fix ContentDatabase/AjaxRequest circular dep.
The circular dependency,
ContentDatabase -> RangeRequest -> AjaxRequest -> ContentDatabase,
causes issues for the upstream Closure compiler. This patch breaks that
cycle by factoring out reading and writing operations from ContentDatabase
into ContentDatabaseReader and ContentDatabaseWriter respectively.

The following minor changes have been made to code that has moved:
* Removed retrieveInitSegment() since it's not used.
* Changed .stream_ids to ['stream_ids'] in retriveGroup().
* Reworked deleteGroup() so that it doesn't depend on retrieveGroup().
* Made deleteStream() private.
* Made minor formatting changes to meet the 80 character limit.

Change-Id: Idfc5d04ad32225a915b1531e0f4205137de5cc73
2015-08-10 14:23:32 -07:00
Natalie Harris 3936bfafb6 Player configuration should not use static variables.
Closes #126.

Change-Id: Ib8ef19e46918276f28d6539a158517f8558867d1
2015-08-04 08:51:22 -07:00
Jacob Trimble 5ffa20561c Added unit tests for SegmentList.
Changed the current tests for SegmentList and added new tests that
include testing SegmentTimelines.

Change-Id: I82e6429f31f396ba065aaae89bd95a1149a942ac
2015-08-03 21:36:39 +00:00
Timothy Drews 263ea9985d Re-work seek handling during stream startup.
* Instead of intercepting specific 'seeking' events to forego stream
  resync, record the particular seeks using a member variable, which is
  less error prone.
* Don't rely on 'playing' events for stream resync after pause/play:
  'playing' events aren't reliable; instead, just check if we need to
  clamp the playhead when we update the seek range.
* Don't fire seeking events when starting the video at t=0, or when
  there is no timestamp correction.

Closes #132
Closes #136

Change-Id: I350ee6e9966af9f44d3e8bda4dc8297271e41855
2015-08-03 11:16:26 -07:00
Jacob Trimble f610cbf4c9 Added support for SegmentTimeline inside a SegmentList.
A SegmentTimeline can appear inside a SegmentList and describes the
duration of the items in the list.  A SegmentTimeline can also be
inherited from the Period or AdaptationSet.  These have all been
added.  Also added SegmentList support for dynamic MPDs.

Closes #88

Change-Id: I849491b1c6a5808a58c597eccfd439154e2e6ecd
2015-08-03 16:54:28 +00:00
Timothy Drews bcda5cf8b2 Fix flaky pre-processor test.
The license pre-processor test was sometimes failing because the fake
LicenseRequest constructor's prototype did not define a 'send' function.

Change-Id: I029088607dd260e90e09db39ca5328b424e648e5
2015-07-31 11:49:14 -07:00
Jacob Trimble 950b17354c addExternalCaptions can now be called more than once.
Multiple calls to DashVideoSource.addExternalCaptions will each
add a caption source to the object.  Added unit and integration
tests for this.

Change-Id: I387d285b5d11aa345b3abefab05d633194863030
2015-07-30 14:55:35 -07:00
Jacob Trimble 320a9ec9f5 Added addExternalCaptions method to DashVideoSource.
This allows an app to specify an external caption source so the captions
can come from a different source than the MPD.  The method should be
called before the call to load().

Closes #133

Change-Id: I0686fd800e0fe3a73d89a71e2f374dffef905dba
2015-07-28 16:57:36 -07:00
Timothy Drews 8880a8e378 Add more options for license request processing.
* Add a URL override and an HTTP method override to LicenseRequestInfo.
* Use LicenseRequestInfo objects as dictionaries so the pre-processor
  interface works like the Player.configure() interface.
* Ensure LicenseRequestInfo fields are valid after the pre-processor
  is called.
* Improve pre-processor integration test.
* Add @expose to some typedefs so they are included in the documentation.

Closes #134
Closes #135

Change-Id: Ia29d36d70fa661d58196d166cbc60b281c679594
2015-07-27 21:22:05 +00:00
Timothy Drews c8cf08f477 Add map getter functions that check types.
These may be used to sanity check arguments coming from outside
the library.

* Use new getter functions in Player.configure().
* Add additional tests for Player.configure().

Change-Id: Ib0b907cde46aeb65ca1273fb424e3f13872fa5da
2015-07-22 16:06:41 +00:00
Timothy Drews 38f70c5aeb Recover from failed segment requests.
* Reject Task Promise if one of its stages fails so that the caller's
  catch handler is invoked.
* Use TypedBind consistently in affected Promise chains.

Closes #131

Change-Id: I94fa6688949444212fa0b1edd3a94e0de4d6956f
2015-07-21 20:05:15 +00:00
Timothy Drews 2bb69043d5 Re-work misleading ContentProtection tests.
ContentProtection elements aren't parsed at the Period level,
so ContentProtection elements cannot be inherited or overridden from
Period.

Change-Id: I6155cfa89a99c78f5164e24044853ccba052014f
2015-07-21 16:40:40 +00:00