Commit Graph

478 Commits

Author SHA1 Message Date
Sandra Lokshina c70367dc97 Separate text parsing and display logic.
Closes #796.
Closes #923.

Change-Id: Ifc2017b40a0fb570103f0fed7bc130aa24819e9f
2017-07-17 21:39:59 +00:00
Sandra Lokshina af252c94e7 Add bandwidth info to switch history and make it accept variants.
Change-Id: I3927697cd820dcdd681de39eca3517b81150d7df
2017-07-12 15:18:18 -07:00
Jacob Trimble f511c86039 Fix resetting resumeAt in StreamingEngine.
Based on PR #839

We use |resumeAt| to handle switching between Periods that do and do not
have text streams.  It is used to override what time we need to start
buffering from.  Once we have used it (i.e. started streaming), we
should reset it (to ensure it doesn't break seeking).

There was a bug where if the stream wasn't available yet, it we
would reset |resumeAt| but not start streaming.  Meaning on the next
update, we would check at the playhead time instead of the next Period
time.  Now we reset |resumeAt| only after we know we have started
streaming.

Closes #839

Change-Id: Ibd3ce680cec129719869c8d4a7dda409b573a17f
2017-07-12 10:19:56 -07:00
Sandra Lokshina b3586c193a Add stream bandwidth info to variant tracks.
Closes #834.

Change-Id: I3af66a227ad09f1686a7ca3f545c2bf9683d3c24
2017-07-07 10:20:54 -07:00
Theodore Abshire 54d2914791 Filters out single-stream variants.
In situations where there are variants with video and audio, and variants
with only one of the two, this filters out the less-complete variants.
This removes the possibility of the player switching to an audio-only
variant and breaking MediaSource. It also solves the regression where
audio-only variants have the lowest bandwidth and thus are chosen
preferentially on weak connections.

Closes #824
Closes #861

Change-Id: Ic37543d98962ddd83a85224e26e5225d142b844e
2017-07-06 15:46:28 -07:00
Theodore Abshire 820a6a19c9 Fixes parsing Microsoft-packaged HLS.
Microsoft HLS packaging tools generate audio-only variants in an odd way;
specifically, the variants have an AUDIO tag despite being audio-only, and
thus double-link to the stream.
Previously, the way we detected stream type lead to us assigning one version
of the audio stream to audio and one to video, thus erroneously making those
variants appear to be video+audio variants.
This makes it so that, if the AUDIO tag has the same content URI as the base
stream, it only uses the version in the AUDIO tag.

Change-Id: Ie940970587e95a9020ed67589042008d0568e153
2017-07-06 09:50:18 -07:00
Jacob Trimble a1807179f6 Disallow unknown properties (4/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: Iecdf071c7f99b9d5460e75dfc4f77df871740ad2
2017-07-05 17:49:53 +00:00
Jacob Trimble 26bacb1489 Disallow unknown properties (3/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: Ic37437a1ad2305bc50a814cdcc562e74703222ac
2017-07-05 17:47:03 +00:00
Jacob Trimble 845c9af2f6 Fix text track reinitialization.
We should not reinit text until we are sure we are switching.
Otherwise, the new text parser won't have seen the init segment and
won't be properly initialized.

Closes #910

Change-Id: Ieb5549afcad7aa58aa1a6e8d383f3cd783280d5c
2017-06-28 13:07:07 -07:00
Jacob Trimble 78fc6d9b36 Disallow unknown properties (2/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: I48335fc6659d3c33a6d55b00d087b59410c79cf7
2017-06-27 19:47:42 +00:00
Jacob Trimble adb8da4764 Disallow unknown properties (1/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
2017-06-27 19:43:00 +00:00
Jacob Trimble d8a3d8d2f7 Change jasmine.Spy type definition.
The old definition using a union with a Function causes problems.  The
compiler tends to treat this as an unknown type, so we loose type
safety.  The new types ensure full type safety, at the cost of needing
to "convert" the spy when it is used as a function.

Change-Id: I98ebd9dffd9cb865d0cf5d03db0fb5d6ea001ed3
2017-06-27 12:18:48 -07:00
Joey Parrish 892d107433 Reorder, clean up, extend times of offline tests
This changes the order of the things tested in the offline tests,
cleans them up a little, adds comments, and extends the playback
time by 5 additional seconds to deflake the tests.

Closes #903

Change-Id: I9c0656882cf31e3f61c67946b7867d3ef25ba953
2017-06-22 20:14:21 +00:00
Michelle Zhuo f09999aa80 Add channel count information for HLS audio tracks
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.

Resolves #826.

Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
2017-06-22 11:34:36 -07:00
Joey Parrish 8b54c7b758 Define, document and rename new option for offline
The new isPersistentLicense option was not documented in #878.
This adds docs and renames it to usePersistentLicense.

Closes #873

Change-Id: I59ed32c98660ad7c155392a1708eab98f63131c3
2017-06-21 14:56:05 -07:00
Graham Scragg 59fe4e5d40 Support for offline data with a temporary license (#878)
Based on app configuration, we could store protected content offline
without a persistent license.  The offline content would then require
a network connection, but only briefly for licensing.  This makes
sense in a lot of commuter or airplane WiFi scenarios.

Closes #873
2017-06-21 14:44:02 -07:00
Jacob Trimble bb621714e9 Cleanup Player unit tests.
Change-Id: Ia0a6e9a3493c247cc8f03a2d9a02f5a817786dc1
2017-06-21 12:55:09 -07:00
Jacob Trimble 4aa2430a1b Fix key status problems with EME polyfills.
Our EME polyfills give a key status with a Key ID of '00' (a single 0
byte).  This breaks the Player logic for restricted tracks since it
assumes that those are not playable.  When we get this Key ID, we should
treat the key status as a global status, not for that specific Key ID.

Closes #884
Closes #890

Change-Id: I392550227274fb321d2c223eb8d483a0a4733186
2017-06-21 19:42:05 +00:00
Jacob Trimble 7a5991a01d Fix date parsing when timezone is missing.
In DASH, when parsing a date, it should default to UTC.  When we pass
the date string to Date.parse(), it will use the local timezone.  So
if we don't see a timezone, we need to manually add the UTC timezone
so Date.parse() will parse the correct timezone.

Closes #901

Change-Id: Ica0433042e9bfd42b0cbf62653bdbd2b97b56297
2017-06-20 12:43:23 -07:00
Joey Parrish 849891a77b Work around Tizen DRM test failure
Instead of hanging while we wait for key status events that will never
come, move on after 5 seconds.

Issue #891

Change-Id: Ia338401097fb29039fa203729d0efaa4cca5623b
2017-06-16 22:41:27 +00:00
Jacob Trimble 2abb3ae50e Fix track switching when near Period boundary.
Trying to switch to a stream from a previous Period while we are
buffering a later Period can cause problems.  This is caused by
different media states "needing" different Periods.

So if we try to switch to a stream from a different Period, we should
handle the Period transition then to ensure all the streams are needing
the correct Periods.

Closes #797

Change-Id: I3d93d93bf141901fe8f8f62fd0ca9fa96a07c268
2017-06-15 23:14:59 +00:00
Michelle Zhuo 00b440f376 Support audio track selection by role and language
Exposing the roles of tracks, which come from the manifest, in the
select audio language method. This is a follow up on commit
b27861050c11451db57d87270ec1385c1906627a.

Closes #767.

Change-Id: Iebb873f1db8834c7275a8a9fc01c3b855c0288aa
2017-06-15 22:41:21 +00:00
Joey Parrish 98f3f3e218 Support MIME and codecs on different DASH elements
This fixes the detection of content type for text AdaptationSets which
contain mimeType only, but contain a Representation with codecs only.

Closes #875

Change-Id: Ibae7ae8357653c1960daefa4c3e122187de51bb3
2017-06-15 11:03:46 -07:00
Jacob Trimble 8835f7b898 Fix bug when trying to load when there are pending failures.
If you attempt to load an asset and then the first load fails, then
the second load will hang forever.  This was caused by the second load
trying to cancel the first, but the CancelableChain not handling this
case.

Closes #782

Change-Id: I79e201db44cbf47485e7221cc148bbfdde6276f7
2017-06-07 13:29:28 -07:00
Jacob Trimble 7a5e59c42f Fix test failure on Safari.
Change-Id: Ife4c51797a0f2a3b58f1d5a38227a055d152e433
2017-06-07 10:09:41 -07:00
Jacob Trimble 70ac4987d8 Track manually added text tracks in active tracks.
There was a bug where manually added text tracks weren't added to the
active track list in Player.  This caused assertion failures and
problems with selecting those tracks.  Now those tracks will be tracked
correctly.  Note that Player will correctly select text tracks based on
language and will allow switching.

Closes #821

Change-Id: Ie9465a2d3bc757f43281ef40658daa488f58bc12
2017-06-06 14:36:00 -07:00
Sandra Lokshina c6c6d05810 Move text-related files into their own directory.
This change creates a lib/text directory and moves all files
with text-related logic to it. It also lays the ground for
separating text parsing and display logic. (That change will
introduce even more files with text-related logic which will
crowd lib/media directory).

Issue #796.

Change-Id: I65ac134020a0126ff02a8f2067beb73870232e65
2017-06-06 18:21:09 +00:00
Joey Parrish 80251cdf91 Fix DRM test errors on IE and Edge
Somehow, errors thrown by CastReceiver unit test setup caused DRM
tests on IE and Edge to fail.  This cleans up the Cast tests to fix
these uncaught errors that somehow polluted the DRM tests.

Change-Id: I435ff994b0b70199eb5a8febd419296b59497920
2017-06-05 20:18:06 +00:00
Joey Parrish 434f1bf9b0 Choose lowest bandwidth codecs
Before asking AbrManager to choose streams, we should choose codecs.
Choose the most efficient codecs, and do it after we have filtered
out the codecs that the platform cannot use.

Closes #841

Change-Id: Ifbdd22b33254d4584f77db6456ab238f7c04c755
2017-06-05 18:00:23 +00:00
bhh1988 41eac10c08 Stop infinitely retrying on network errors for VOD (#842)
Do not infinitely retry on top of the retry-policy already defined by
RetryParameters, especially for VOD. For live video the previous retry
logic is still useful to be robust against clock-sync or asset
availability issues. This commit adds a boolean configuration parameter,
infiniteRetriesForLiveStreams, to allow the user to turn this behavior
off even for live video.

Fixes #830 and #762
2017-06-05 10:42:09 -07:00
Matias Russitto ace0e8cf49 add video and audio stream IDs for getStats().switchHistory (#846)
Closes #785, #823
2017-06-05 10:29:55 -07:00
Joey Parrish 5f33c119dc Clean up FakeStreamingEngine
- Make FakeStreamingEngine injectable by removing Period argument
   - FakeStreamingEngine can now have its spies manipulated before we
     call player.load().
 - Do not poke into player's manifest_ and streamingEngine_ members in
   chooseStreams(), since load() sets those already.
 - Instead of setting activeStreams in the constructor, set them in
   init().  This is a more accurate fake, and this is important for
   upcoming tests related to early filtering, since filtering takes
   into account the active streams.

Leads into a fix for #841

Change-Id: Ia893053490cde819e32907c7a1a2030c29022f62
2017-06-05 16:48:08 +00:00
Joey Parrish bc56744812 Cleanup in Player and MSE unit tests
- Fix isTypeSupported override in MSE unit tests
   (Should not be a prototype method)
 - Add isTypeSupported override in Player unit tests
 - Fix a Player test that used to pass for the wrong reasons
   (MSE type filtering instead of EME type filtering)

Change-Id: Ibb72957f3bdff62923f2b235e9b9e9a598353912
2017-06-05 03:23:15 +00:00
Joey Parrish e8af210dab Clean up config merging, type check certs
- cleans up config merging now that abr.manager has been removed
   from the config
 - uses thing.constructor == Object instead of
   typeof(thing) == 'object', for better detection of anonymous
   objects
 - adds a default (empty) server certificate for type-checking
 - treats empty certs the same as null (no cert provided)

Fixes #784

Change-Id: Ie833a1b3bf484d5f12f3ebf6d513ed51740bdc44
2017-06-05 03:21:48 +00:00
Joey Parrish bb32073725 Fix PlayReady on IE and Edge
We broke PlayReady on IE and Edge in #815 when we fixed PlayReady for
Tizen.  This should work for both, but will still need to be tested on
Tizen after merging.

Closes #837

Change-Id: Iff41845ae6a4b369e8f21a80623ebb2cb5475fd6
2017-06-05 03:21:33 +00:00
Sandra Lokshina 859130fd45 Refactor player to accept abr manager factory.
This change makes ABR targets configurable and refactors player
to accept Abr Manager factory rather than have manager be
part of ABR config.

Closes #744

Change-Id: I732daaf555d21cc9e79450eeb1f74ac3544b90cc
2017-06-01 09:35:54 -07:00
Sandra Lokshina 765e016e0b Add an API to limit playable/seekable range for VOD.
Closes #246.

Change-Id: If555ab5b78c60defe0932eb4c160ab4e296c9d9b
2017-05-31 21:28:52 +00:00
iKinnrot bed012dc3c Add label attribute to text track (#831) 2017-05-31 13:54:57 -07:00
Michelle Zhuo afb0ded49c Expose Roles of Audio Tracks
This change is to expose an audio track's role in order to differentiate
among a main / caption / commentary track that shares the same
language.

Issue #767.

Change-Id: I05d38cba2170d0005611cf160b7ae45996fe77dd
2017-05-26 13:51:43 -07:00
Theodore Abshire 1e119e40cf Adds option to fail gracefully on xlink failure.
At the moment, when there is an xlink problem, the manifest parser
returns a rejected promise. This adds a configuration variable to
instead simply not replace the xml tag.

Closes #788

Change-Id: Iace953233c83a57820130033150e7cd9a9385d6f
2017-05-25 21:10:09 +00:00
iKinnrot 151930284a Add support for DASH label and HLS NAME attributes (#811)
* add support for non-standard DASH label attribute
* add support for HLS NAME attribute

Closes #825
2017-05-25 10:43:07 -07:00
Joey Parrish 16f9ca6a97 Make some educated guesses about HLS missing info
- Default CODECS attribute to 'avc1.42E01E,mp4a.40.2'
 - Infer stream type and multiplexed status from number of codecs,
   associated groups, and video-specific attributes.
 - Recombine codec strings when we detect multiplexed content

Closes #805

Change-Id: Ib1298033360b52091b7d871fed0eca047a00ad22
2017-05-22 18:47:19 +00:00
Joey Parrish 17e6763fd2 Disable failing PlayReady DRM integration tests
The PlayReady server at Axinom is failing with HTTP 500, so for now,
we will disable these tests on PlayReady.

Change-Id: Ife0365669376af0fd437798a501b79a9bc0b3eab
2017-05-22 09:49:18 -07:00
Aaron Vaage 730fd9e44f Replacing Cursor Delete In DBEngine
After looking into the speeds for removing data from IndexedDB, it was
found that using a cursor was slower than the other methods. This change
takes the remove logic and changes it to remove each key as part of
one transaction.

Closes #756

Change-Id: Iec3916650d8a4fe2b6353b604c070d8a0af7426c
2017-05-11 21:42:53 +00:00
Joey Parrish a51a1b3584 Upgrade jasmine-core
This upgrades jasmine-core to a version with jasmine/jasmine#1138
fixed.

Change-Id: I5021ad8d3a6942afc85370ce0ff15bd07fd0945e
2017-05-10 16:37:50 +00:00
Theodore Abshire bdae795ae9 Fixed bug with nested relative xlink links.
Before, if a relative xlink contained another relative xlink,
the nested xlink link would resolve its URI based on the filename
of the parent link, rather than its final URI.

Change-Id: Ic42ad8bfbd8487b4d1da66d86117823800c447be
2017-05-09 21:47:32 +00:00
Theodore Abshire b641a24acf Removed uses of .children from processXLinks.
Element.children does not work on IE or Edge, so all uses of it
were refactored to use .childNodes instead.

In addition, Element.children was added to the ban list, to prevent
further problems like this in the future.

Closes #792

Change-Id: I33009f77dbb1f4afa9847e31b57fda324baba472
2017-05-09 19:15:50 +00:00
Joey Parrish f992851925 Don't recurse on serverCertificate in config merge
Treating serverCertificate as an Object and recursing causes an
exception the second time you set the serverCertificate config.

As a quick fix that can be cherry-picked for v2.1.x, do not recurse
on serverCertificate.  This has the side-effect of not type-checking
the serverCertificate field on input.

A more detailed fix will be made later, for inclusion in v2.2.

Issue #784

Change-Id: I84c05ee3dd370a4b83e9ce2337d2326ec36532c2
2017-05-08 23:46:38 +00:00
Theodore Abshire 723e6ad1bc Added basic xlink support.
This adds a utility to mpd_utils.js that filters a manifest and
automatically downloads and substitutes in the contents of any xlink
link.

This only supports xlink:actuate="onLoad"; "onRequest" would require
significant changes to our manifest processing pipeline.
It also adds a new field to INVALID_XML errors to indicate which
xml was invalid, to make the error more informative when called on
xml loaded by xlink links.

Also added a demo asset.
This is just a simple modification of heliocentrism to break it into
multiple files.

Closes #587

Change-Id: If87b1e78e65261dcc4e043b0c2e6cf69c1b12e08
2017-05-08 14:00:56 -07:00
Jacob Trimble 40aaa3d03a Update video duration if there's a gap at end.
If the media segments don't reach to the end of the presentation (as
given in the manifest), then we may get stuck buffering forever.  Now
StreamingEngine will update the duration so PlayheadObserver won't
enter a buffering state.

b/37722271

Change-Id: Idf95fcccc04a024307601f0741b5da4474f76d03
2017-05-06 00:36:51 +00:00