Commit Graph

1183 Commits

Author SHA1 Message Date
Joey Parrish cbdbfbdec7 Update changelog for v2.3
Issue #1183

Change-Id: Ia25fba9e5f8149c12f55a8486ca3eb6bcd4131ea
2017-12-20 03:02:52 +00:00
Joey Parrish 186e3e69c4 Consistently take Uint8Array in text plugins
Instead of taking Uint8Array for media segments and ArrayBuffer for
init segments, take Uint8Array for everything.

Clean-up after #1022, discovered while preparing the upgrade guide for
v2.3.

Change-Id: I1f284f6f51f345e663c06d96d788bd9cfb941c52
2017-12-19 22:29:43 +00:00
Joey Parrish 66bfa31538 Do not use VTTRegion yet
Our use of VTTRegion seems to be wrong.  The feature in Chrome is
behind the "experimental web platform features" flag.  If this is
turned on, we display subtitles in the wrong place.

Until we can verify and fix our usage of VTTRegion, we will not
use it.  There are other issues to deal with in our region support,
in particular that TTML uses px and VTT uses percentages.  Futher,
our VTT parser does not yet extract region information.

This fixes the main issue for v2.3, so that future releases of Chrome
do not break sites built with v2.3.  There is more work to do in v2.4.

Issue #1188

Change-Id: I0de3392bdfca381c3727580e66c1a57ec457c5c2
2017-12-18 22:39:20 +00:00
Sandra Lokshina 2b920e228f Add role selection to the demo app
Closes #967

Change-Id: I3a83a85b327901a6ab071b355e6cd890a13d7550
2017-12-18 11:31:17 -08:00
Aaron Vaage 1cf0a38843 Support Upgrading from Version 1 to Version 2
Added a DB Upgrade path for converting content from version 1
to the version 2 format.

Issue #1047

Change-Id: Id8dc626d8289b08ca300c40b137173c0c6ec9d35
2017-12-18 19:04:04 +00:00
Aaron Vaage 967f339934 Mark Version 2 of DB Engine
externs/shaka/offline.js now represents the data types for Shaka Player
Offline V2. All offline shaka player code uses the new version and all
V1 and transitional code has been removed.

Issue #1047

Change-Id: Ia43f8d8d11426e823629e5fcd27c4e1e0ce400d3
2017-12-16 00:11:04 +00:00
Aaron Vaage cbaefcf475 Use Auto Increment For IndexedDB
Changed our stores in IndexedDB to use auto increment for the keys
so that we no longer need to track current ids anymore.

Issue #1047

Change-Id: I765ba19810fce03ec8e4d968cbf8cf383355be6d
2017-12-14 15:47:31 -08:00
Aaron Vaage 14e6b3a230 Create Upgrade Pattern
Create the pattern for how to handle database upgrades. As of this
change the only upgrade supported is from version 0 (no database).

Issue #1047

Change-Id: I9f889a9e39a190e926cf06f0720a5371bc3c59af
2017-12-14 14:53:48 -08:00
Aaron Vaage 80c5fff4b2 Create DBUtils
Create DBUtils to hold code that will be useful to updating code
outside of DBEngine.

Issue #1047

Change-Id: If759fd0d778f42e6114e82e9274a053af420ad35
2017-12-14 22:51:55 +00:00
Joey Parrish 4ce963415e Fix offline storage with temporary license issues
This change:
 - Fixes the use of temporary licenses with manifests without init data
 - Re-enables an integration test which was accidentally disabled
 - Makes that test use a manifest without init data, to cover #1159
 - Makes the test less flaky
 - Reduces the minBufferTime of offline manifests, which both speeds
   up load of offline content and makes the test faster / less flaky

Closes #1159

Change-Id: I3342e5112564a607f16f5d10c457a032443c57cb
2017-12-14 21:36:08 +00:00
Aaron Vaage c927300045 Store keys instead of uris in DB objects
Instead of storing uris for SegmentDataDB in SegmentDB, store the
actual key so that we don't need to convert back-and-forth so
often.

Issue #1047

Change-Id: I2f6d1bc1e58abd7a210097dea757d1e2fc9d4cac
2017-12-14 21:34:49 +00:00
theodab 8ed316d3c2 Reduced frequency of some getters on cast updates
Not all values need to be updated twice a second. This change modifies
the list of player getters so that each value also includes an update
frequency, and only updates that property once in that many updates.
This acts as a configurable way to ensure that some properties update
in different amounts, without having to have multiple update timers or
compose multiple update messages in the same timeframe.

Change-Id: I90e75e3e73f6c633d91b1799307ec2b15587327b
2017-12-14 21:02:48 +00:00
Joey Parrish e97a93d396 Drop cast serialization special case
Removes a special case in serialization that is no longer relevant due
to a configuration interface that was removed for v2.3.

Change-Id: I87ed194f42c1c25d86ca45b7ac952d6a45119a26
2017-12-14 10:28:10 -08:00
Aaron Vaage 46685fbd15 Moving Offline Uri
Moving offline uri code to avoid an upcoming circular dependency in
the upgrade code.

Change-Id: I952386f17c6d4e7806d97e2f540887b915f68de7
2017-12-14 00:00:23 +00:00
theodab 31b2984f6b Stopped proxying getManifest()
getManifest() hugely increased the message size when casting, to the
point where we were having message size problems.
This CL stops that property from being proxied.

This also adds an integration test that makes sure update messages do not get
too large.

Closes #1128

Change-Id: I3c4bfabb4d35ee870a603c38f784cb226366a28b
2017-12-13 22:16:30 +00:00
Joey Parrish b08ea87f7e Add support for legacy avc1 codec strings
Closes #1186

Change-Id: I87c24ee28f2c83b392a1887e77b9f2110953ef11
2017-12-13 11:37:59 -08:00
Joey Parrish 2e5b856f79 Do not require EXT-X-MEDIA-SEQUENCE in HLS live
Closes #1189

Change-Id: Iae6f4f4524bb9895f8b211491793cf7626661a5d
2017-12-13 18:49:03 +00:00
Joey Parrish 20750504fe Fix presentationTimeOffset in SegmentTemplate
We were not previously applying presentationTimeOffset in
SegmentTemplate w/ the duration attribute.  This fixes the DASH parser
to correctly apply the offset in this case.

This also fixes an issue in which segment times could stretch past the
end of the period or even past the end of the presentation, causing
StreamingEngine to fail period transitions afterward.

Closes #1164
Closes #1163 (PR to address 1164)

Change-Id: Ib16fc2b65117557a4ad9a05adc4a07f8bc90fd3c
2017-12-13 18:46:28 +00:00
Aaron Vaage 3399292d49 Changed Storage Remove API
Changed the storage remove API to use the offline uri instead of
the stored content as that is all that is needed to remove the
content.

Updated the demo app to remove using the Uri and not stored content.

Change-Id: I72a1049838759452eb16c78c8f1f7f4170e4e841
2017-12-12 22:12:56 +00:00
Michelle Zhuo 852f298992 Keep textVisibility and textDisplayer's textVisibility consistent
After a video is loaded, every time we show/hide the captions,
this.textVisibility_ is not changed. But when we load again, the new
textDisplayer uses this field to decide whether to show the caption or
not, which may make the captions and the caption button inconsistent.

Closes #1185.

Change-Id: If2ed169b9553d066f85f3d21247391efdd9aa3d4
2017-12-12 21:57:23 +00:00
Aaron Vaage dff382b9a3 Remove reserve id from StorageEngine
Removed the reserve id from storage engine. Now adding an item to a
storage engine will return a promise that resolves with the id it
was stored under.

Change-Id: Id4d2c4c51a359593f1308aeb5fe580ab460ebeb8
2017-12-12 13:28:33 -08:00
Aaron Vaage b53f5a0816 Isolate download logic from error handling
In |Storage.store| there was download logic hidden by error handling.
This change moves the logic into its own function so that the error
handling does not hide the logic as much.

Change-Id: I3fc911573937f4543837015cf2500a1447d923ef
2017-12-12 12:43:54 -08:00
Michelle Zhuo d221339326 Remove empty lines in response header
Since IE/Edge returns the header with a leading new line('\n'), we need
to remove it from the response.

Closes #1172.

Change-Id: I133f9cfbada6486edc438f3dcbc37c7c78dbf36c
2017-12-12 18:03:01 +00:00
Aaron Vaage 8f45f7939d Changed Stored Content to not always need an offline uri
Before, stored content always needed an offline uri. As the id
will soon not be available before saving to storage, stored
content needed a way to represent content that was being
downloaded.

This change allows the offline uri to be null to represent content
that is being downloaded. It also allowed stored content to be
created from a Manifest (for content to be downloaded) and to be
created from a ManfiestDB (for content already downloaded).

Change-Id: I3039069995f0b061112ed0c636a53ceef5673389
2017-12-11 23:21:12 +00:00
Joey Parrish 8351095ac4 Do not restrict tracks when 0 key statuses are known
For some platforms and CDMs, such as PlayReady on Chromecast, there
are no key statuses.  We still get a key status event, but there is
not even a synthetic key ID.  In these cases, do not restrict tracks,
as that would result in a 4012 error (RESTRICTIONS_CANNOT_BE_MET).

Closes #1070

Change-Id: Ib3a853418629433cc9be491a0cf7981dd41a3f59
2017-12-11 22:19:00 +00:00
J. Oliva 58caec4341 Remove duplicated mime types (#1181) 2017-12-11 11:57:57 -08:00
Aaron Vaage 6a03ceb30f Isolate Progress Code
Isolated all progress code into functions in Storage to help abstract
progress from the storage logic.

Change-Id: I7a72c25dbd126cb4a5e682763fb1e46afa0703ef
2017-12-08 21:17:20 +00:00
Joey Parrish 0a59da4146 Free segment memory after storage
Although DownloadManager clears the segment list as soon as it has
started the download Promise chain, the entire list is bound into the
each download function.  This is subtle and difficult to address
directly.

Instead, we set the segment data to null explicitly after the segment
is stored.  In this way, we are sure to only have one segment buffer
in memory at a time during a storage operation.

Note that there is no regression test to go along with this, because
ArrayBuffer memory consumption cannot be directly instrumented from
JavaScript, weak references cannot be used to track which buffers are
garbage collected, and the buffer references are bound into anonymous
functions and therefore cannot be found by exploring object
hierarchies.

Closes #1167

Change-Id: Ifeccbfb2d15a1a0243524c92e36512f9308fd5c6
2017-12-08 12:12:47 -08:00
theodab bc5d309607 Fixes another null exception in cast receiver
When calling getStats, if there is no active stream but there is
a playhead and manifest, the player experiences a null exception.
This does not fully fix #1128, however, as there seems to be more than
a null exception at work there at the moment.

Issue #1128

Change-Id: Ic9d318a037157c2a8e28a54a857ec3a1e5797aae
2017-12-07 22:05:15 +00:00
Aaron Vaage 834d960f88 Use Manifest Duration for Offline Manifest Duration
Use the duration from the original manifest as the duration for the
offline manifest.

Change-Id: I1b31888ecf25126e4a4794f73ea3aeaf101e5820
2017-12-07 21:38:43 +00:00
Michelle Zhuo 41ad98a99f Cancel text mediaState's update when not showing captions
When the user chooses not to show captions, we unload the text stream,
by canceling the update of text mediaState, and deleting the text
mediaState.

Since setupStreams_() is an async function, I'm adding a boolean
variable to mark the request of unloading text stream, so as to prevent
the race condition caused by quickly hiding and showing captions.

Closes #1058.

Change-Id: I554522b542bde5db037d74aa3a499d1ac0001151
2017-12-07 18:30:18 +00:00
theodab 5f612bd1d3 Added an integration test for cast receiver
This adds a single integration test for cast receiver, as well as a
framework for adding more in the future.
This particular test pauses at each stage in Player.load where the
player could theoretically be polled to compose an update message, and
waits for an update message to be polled. This should help catch any
further null exceptions in the cast receiver that prevent update
messages from being sent out.

Issue #1162

Change-Id: If24486dd821275ab674960e559bd6d10776955a7
2017-12-06 13:45:17 -08:00
Joey Parrish 8c80b6cefa Wait for close(), but timeout after 1s
An improved workaround for https://crbug.com/690583 and #1093, on top
of PR #1168.

If we don't wait at all, we end up trying to use the same session ID
too quickly, which causes a playback failure.

Change-Id: I8c9d1a0f09432054b862e033b80b0c2f47739c74
2017-12-05 16:47:54 -08:00
Joey Parrish 5cca0e573e Remove deprecated interfaces for v2.3
Closes #1091

Change-Id: I0c15a2bfd51c3074c749d88cd66b89ba64d1fa35
2017-12-06 00:39:11 +00:00
Aaron Vaage 2f47e6d769 Moved Legacy Variant Ids Resolution into DBEngine
Before we added variants, there was no variant ids field on
StreamDB. To support legacy downloads, we created variants
for streams with no variantIds.

This change moves that conversion into DBEngine so that outside
DBEngine, streams will always have variantIds.

Change-Id: I85d050dac0b5f82fe00947380587dd7af4401dee
2017-12-06 00:39:07 +00:00
Joey Parrish 9759eddf54 Ignore style blocks in WebVTT
We do not support CSS embedded in WebVTT at this time.  Instead of
failing to parse the cues, skip the style block.

Closes #1104

Change-Id: I3d500ba11afe43e81bbdef9924e4dd9e05db2b85
2017-12-05 23:31:23 +00:00
Jacob Trimble bfe41a6da7 Don't always switch tracks in configure().
Configure should only switch tracks if the current variant can't be
played under the new configuration.

Closes #1138

Change-Id: I1acb8bdbb0c8b41252e978bd17ef52bec1095844
2017-12-05 18:33:02 +00:00
Joey Parrish 719ba3a2ef Do not allow seeking/startup at duration
Seeking to or starting playback at the duration does not work well
across browsers.  Any seek or startup time at or past the duration of
VOD or IPR content will be bumped back by a configurable amount
(default 1s).

Closes #1014
Bug: 69874888

Change-Id: I6d21ecd8e211f0f823a093b8eb8b95d329b4385f
2017-12-05 18:08:51 +00:00
Sandra Lokshina 891b9716cf Use Network Information API to get bandwidth estimate when possible.
Issue #994

Change-Id: Id4a33ce7467c2e89613acb191fb304f02d10ed65
2017-12-04 15:35:02 -08:00
Aaron Vaage b98ce99f08 Add Type Structure to Storage Engine
Changed the Storage Engine interface to know about the types that it
is expected to store. This allow the implementation to do more internally
as the scope of the object has been limited.

Change-Id: I388e2bde5e7e3f99e8b28bd16e08a8f6d5fc6453
2017-12-04 22:41:23 +00:00
Chris Fillmore e387e06572 Don't wait for sessions to close on DrmEngine#destroy (#1168)
This is a workaround for Chrome bug https://crbug.com/690583

Resolves #1093
2017-12-04 14:34:59 -08:00
theodab 17cf08041b Fix a null exception with CastReceiver.destroy
This causes the cast receiver to ignore further proxy events after
the receiver has been destroyed. This is to prevent errors after
destroy.
This is a nearly inconsequential bug; destroy is only called when
the cast receiver app is about to be unloaded, after all.
However, this change is necessary for integration tests to work.

Change-Id: I7bd9cb0f815e8f0989838c7f205e0475eb1b729b
2017-12-01 13:15:21 -08:00
Joey Parrish 45a1d71b8a Add more strict conformance checks
This adds extra conformance checks:
  - A ban on @expose, which we already got rid of in 775d7552
  - A ban on unresolved types, which did not generate any failures
  - A ban on global variables
  - A more comprehensive ban on console logging

None of these caught any real bugs in the existing code base.

In one test suite (MediaSourceEngine unit tests), the compiler was
unable to determine the type of one of the mocks, leading it to
suspect that it could possibly violate the new ban on console.error.

The goog.define('GIT_VERSION', ...) line in player.js was seen
(correctly) as a global variable.  This has been fixed and simplified
as a result.

The only custom conformance checks we are not using are "BanNullDeref"
(too many false negatives) and "BanThrowOfNonErrorTypes" (for which
we have our own, more restrictive version).

Since we have now tried all custom conformance rules provided by the
compiler today, this closes the associated issue.

Closes #1130.

Change-Id: Iad9040d0f5ee397c7d46b1d64bc5bebf2def57bc
2017-11-29 14:50:47 -08:00
Joey Parrish 07860ba4c7 Fix race condition between metadata and timeupdate
On Edge & IE, the timing of "loadedmetadata" and "timeupdate" events
is different, and exposed a race condition in the fix for #1105.
This solves the race by canceling any pending "early seek" handling
once "loadedmetadata" fires.

A fix for the fix of issue #1105

Change-Id: I5587a72e12c6b28beb0b3ea36f2665a0f1e39f08
2017-11-28 22:10:40 +00:00
Michelle Zhuo e6f675a448 Stop buffering live stream when paused
We shall not buffer live stream, when the video is paused and the
playhead falls out of the seek range.

Closes #1121.

Change-Id: I66bbe1e62017f6ae8d121f072f324763f73da0f4
2017-11-28 10:44:35 -08:00
Aaron Vaage 464a34ba4b Add events to Cancellable Chain
Added onComplete and onCancel events to CancellableChain so that someone
creating it can invoke their own code when it is cancelled or completed.

This is needed for the work on IDestroyable.

Change-Id: I5c274356e952ecbd43dd5e8809a6d4cb4e5e85c5
2017-11-27 23:44:10 +00:00
Joey Parrish d1070b4026 Allow Playhead to recover from drift
There are two ways Playhead should be able to recover from a drifting
stream:

1. Wait until the initial position is available
2. Seek to another position

Neither of these was working.  For one, we couldn't detect seeks
before content was loaded.  For another, we were constantly updating
the initial streaming position, so a drifted stream would never catch
up to our expectations.

This fixes both issues so that a drifting stream can at least recover.

Relates to issue #999 (drift tolerance)

Closes #1105

Change-Id: I8d2eedcff25b92b42ecd2e1f361d45ecbddd26ba
2017-11-27 22:43:24 +00:00
Aaron Vaage b68623180c Simplified Offline Schema
Before, segments required knowledge of the manifest and stream to
be created but that information was never used. This change removes
that information from the segments and breaks the circular dependency
between manifests, periods, and segments.

Change-Id: I94064220dd8e3693ff69f5c9100ec1b91aa3c34d
2017-11-27 21:17:07 +00:00
theodab ddd5c9f871 Don't return variant/text tracks before playhead
getVariantTracks and getTextTracks both check values on
player.playhead_, but don't check if the playhead exists beforehand.
This leads to problems when casting an encrypted asset; the cast status
update will check getVariantTracks and getTextTracks before the
playhead exists, and the error will make the status updates stop
coming.

Issue #1128

Change-Id: If38e586b1ea3006c01d3556216f5333d9eaf6e17
2017-11-27 09:14:06 -08:00
Jacob Trimble 59b48f0c8e Revert "Prevent gap jumping while seeking."
This also changes the tests so they mirror the |video.seeking|
property to reveal the problem that change created.  That change
broke seeking into gaps and gaps before the start.

Issue #1149
Issue #1150
Reopens #1061

Change-Id: I18fb65b1529acdacd0becd77078780625e0a955b
2017-11-22 23:01:36 +00:00