Commit Graph

752 Commits

Author SHA1 Message Date
Joey Parrish 4ec00f56e3 Audio adaptation
SimpleAbrManager will still choose the middle audio stream by default,
but will adjust audio up or down once video has been chosen.  Video
will be downgraded before audio, and audio will be downgraded only as
a last resort.

For audio-only content or content with one video stream and many audio
streams, audio will be chosen to fill available bandwidth, just as it
already was for video.

Change-Id: Ia4a0e9607d860713a5ad7887ac6a9aa04767eb25
2016-10-24 17:24:47 -07:00
Joey Parrish bcbf1c66ef Fix cast receiver idle behavior
When we replay a video without reloading, the idle card should disappear.

Closes #558

Change-Id: Ib2bca456ad90c8f2b4554f22f1edb920c69c8ada
2016-10-25 00:16:54 +00:00
Sanborn Hilland fff9892373 Add config option for using segment relative timestamps for VTT (#542)
* Add config option for using segment relative timestamps for VTT

Fix for #480

* Make useRelativeCueTimestamps a non-nullable param

* Update tests for the new useRelativeCueTimestamps param

* Move period relative timestamp deprecation warning to vtt parser

* Log warning only if using absolute timestamps in text cue

* Fix vtt text parser test
2016-10-24 11:22:54 -07:00
Joey Parrish 385a501d0d Stop clearing the buffer ahead of the playhead
Clearing ahead of the playhead is causing hiccups in playback on the
following browsers:
 * Chrome (all platforms, inconsistent)
 * Edge

These browsers appear not to be affected:
 * IE 11
 * Firefox
 * Safari

This is a manual change that reverts almost all of:
 * a8ac3142 - Make buffer clearing behavior explicit
 * 4593cf78 - Check position against null, fix bug in a8ac3142
 * 10b3dd0a - Seek after clearing a buffer, workaround Chrome bug
 * 6daa7f3b - Allow AbrManager to clear ahead of the playhead

Clearing the buffer is now an all-or-nothing proposition because that
is the only way to get consistent playback quality across browsers.
This comes at a cost, because we can no longer count on the ability to
remove buffered data on upgrade without a stutter.

Issue #520

Change-Id: Ia6f8b2fcb223f9c50e9829b26d7003ae8f6efb8d
2016-10-20 10:30:59 -07:00
Joey Parrish 96045b5ff2 Flush Chromecast pipeline after clearing buffer
To work around a bug in Chromecast, seek after clearing the buffer.
This forces the device to flush the pipeline and remove any decoded
data from the old representation.

Closes #544

Change-Id: I3c34d344bfd856b429a360fc41ce7288791716bb
2016-10-19 14:00:21 -07:00
Lucas Gabriel Sánchez 403a141f2c Use data URI content-type for manifest type detection (#550)
* Fix when using Data URIs for the manifest
* update test/net/data_uri_plugin_unit.js to test Data URIs content-type header response
2016-10-19 09:50:07 -07:00
Joey Parrish 5c4c8f4c1f Offer an API to force disconnect Chromecast
Closes #523

Change-Id: I2a213855479dc23797468757808c05a368d907c6
2016-10-18 18:37:06 +00:00
Sandra Lokshina 4607bf469c Refactor StreamingEngine.update_ logic.
Change-Id: I22a2c60f10d8f0abbec8d7c3d9b656d7958fe629
2016-10-17 22:45:49 +00:00
Sandra Lokshina 93001099a4 Add possibility to delay license request until playback is started.
Closes #262

Change-Id: Ia931fd66746cc791ce267c89644f905515b35d55
2016-10-14 23:07:42 +00:00
Sandra Lokshina 6d0f081764 Change bufferedAhead value calculation when switching periods.
Our new logic calculating bufferedAhead value doesn't work when
it comes to switching periods for content with SegmentTemplates.
This change partially reorders code from the 12c07efc change.

Closes #545
Closes #537

Change-Id: I1d9c3ab8a185d0a3f419bbc442b366e697115dd2
2016-10-11 22:30:14 +00:00
Joey Parrish 696332fbf8 Fix AdaptationSetSwitching support
We had a typo in the case of an attribute (schemeIdUri vs schemeIdURI)
and we did not have support for the latest scheme URI (upcoming MPEG
scheme URI vs /guidelines/ vs /descriptor/).

Change-Id: Ibee1802cfe2b04183d52e75378fa23e0c4e3aae8
2016-10-11 02:31:50 +00:00
Joey Parrish ddfb30a281 Ignore trick mode tracks
Issue #538

Change-Id: I47393ccdc189cf55b90e3a8e4239541e817618f9
2016-10-07 10:39:55 -07:00
Joey Parrish bdd96ee8b0 Probe both MP4 and WebM support in DrmEngine
Issue #540

Change-Id: I908804e9334214dd4ed9d7546ce4d4d28dd69d01
2016-10-06 22:39:07 +00:00
Sandra Lokshina fade7d291d Fix handling of internal-error key status.
Closes #539.

Change-Id: I3ff30167034b4aed2bd390fc901e9466f6dd12c6
2016-10-06 20:14:24 +00:00
Sandra Lokshina 91da191a02 Add API to get live stream position as Date.
Closes #356

Change-Id: I5bea5906c4528313da96fd6577005b385b445a65
2016-10-06 17:25:28 +00:00
Sandra Lokshina addece6098 Log and ignore non-standard WebVTT settings instead of erroring out.
Closes #509

Change-Id: I1aced2ea8828c4ca6a9afee6ea28b0144a832029
2016-10-05 18:06:51 +00:00
Joey Parrish 8152e649f1 Speed up ABR decisions
- Speed up EWMA estimates (lower half-lives)
 - Drop min delay concept
 - Trust the estimate after a certain number of bytes have been
   sampled (128kB)
 - Take samples as small as 16kB (previously 64kB)
 - Drop startup interval, just wait for estimate to be trustworthy

The result is much faster initial adaptation when the default
bandwidth estimate is too low, without sacrificing startup speed in
low bandwidth situations.  The best track is selected right away,
and is visible after the first two segments have played out.

In a high-bandwidth scenario using our test clips (Angel One and
Sintel), the initial ABR decision is visible 2.4x to 4.4x faster now.
Decision speed is now largely independent of available bandwidth.

Change-Id: I121f4dd44b725dc53de61c02f7afea14d9234df6
2016-10-03 16:04:26 -07:00
Sandra Lokshina 10b3dd0a7e Seek after clearing a buffer. Workaround for a Chrome bug.
A bug in Chrome makes video feed freeze for a while after a buffer
is cleared. Seeking helps to avoid freezing.
A bug on Chrome: http://crbug.com/651904

Change-Id: I80d9139cb02e859d9a0165235c9868d9afa8adfa
2016-10-03 17:22:48 +00:00
Joey Parrish c17b1f1610 Player.configure takes plain Object
The reality is that it has always taken a plain Object, but we were
calling it shakaExtern.PlayerConfiguration.  While it is true that
the argument follows that layout, only the fields to be changed are
needed.  This becomes an important distinction for other Closure-based
projects using our compiled binary.

As we move toward generating externs for the library at compile-time,
we should be careful about the required input type so our generated
externs can be used directly by the app.

As a side-benefit, this also removes some casts from our tests.

Change-Id: Iadb6a071d502e9ac6955af4d85af918eedd23571
2016-09-30 16:54:57 +00:00
Joey Parrish 54dfe329b8 Fix missing semicolons and missing dependencies
These issues were identified by an upcoming release of the compiler
and must be fixed before we can upgrade.

Change-Id: I8cf3af90b930f2adfa9760299fe69f1892614bf2
2016-09-30 16:54:53 +00:00
Joey Parrish 21f7fb0ce2 Remove FakeEvent from exported methods
This makes it so we do not have to export FakeEvent and include it in
our generated externs (coming soon, after a compiler upgrade).

Change-Id: I7ccdfe94b989a498c85681ad9166bc184eb611c9
2016-09-30 16:54:51 +00:00
Joey Parrish 8ec7164878 Do not export any part of the Promise polyfill
If we use @export in the Promise polyfill, those methods will end up
attached to the polyfill namespace in the compiled code, and will also
end up in the generated externs (coming soon).

By exporting then() and catch() manually, we avoid this.

Change-Id: Ib12b4d9319452ceed802c8fdc8c47d9c09dd24a5
2016-09-30 16:54:43 +00:00
Joey Parrish ef6a7f9e3a Fill out interfaces in MediaKeys polyfill
The interfaces for these polyfill types were not fully implemented
because we do not use every part of the interface in the library.
A newer version of the compiler is stricter about this.

Change-Id: I5164717159544a62640b14aca1a2c7b2d44a33ba
2016-09-29 16:25:34 -07:00
Joey Parrish 7861bab6fa Check for TextEngine destruction
Fixes a runtime exception if TextEngine is destroyed right after an
async clear() starts.

Change-Id: I6b2e4773fd834546a506536e5a1f9881853a5678
2016-09-29 21:34:10 +00:00
Joey Parrish 4593cf789a Check position against null, not zero
a8ac3142 had a bug in which a switch at position zero would not result
in clearing anything.  Positions may validly be zero, but never null.

Change-Id: I95a607df7bd6a41cf73f78122c3dcdda425fb145
2016-09-29 21:14:37 +00:00
Jacob Trimble 7f7e6d7568 Workaround bug in Edge buffered ranges.
It is possible for the SourceBuffer buffered ranges to return a
(small) negative value.  We should treat this as 0.

Closes #530

Change-Id: Ib36e3f4e5e4fdb9f51a7d6644f006b8f9791cc45
2016-09-29 12:48:23 -07:00
Joey Parrish a8ac3142ef Make buffer clearing behavior explicit
- Replace both boolean clear and number-of-seconds args with an enum
   indicating a specific type of clear behavior: none, all, or most
   (all but 2 segments, currently).
 - Calculate segment size from the content in StreamingEngine, rather
   than assuming a common segment size in AbrManager.

Change-Id: I9e4fee0945d5e50fd7da86bb8467911e60c4575e
2016-09-28 22:48:51 +00:00
Joey Parrish 4a608ad10c Clean up buffering checks
- Use TimeRangesUtils to calculate buffer end and ahead
 - Remove early checks on ended || seeking, which stopped buffering
   event when looping
 - Remove check on paused, which stopped buffering event on startup

Change-Id: If6d451c501d72d8cb37bc018db3e660b06958b6a
2016-09-28 22:04:37 +00:00
Jonas Birmé a060050564 Provide framerate and codecs information on video tracks (#533)
Closes #516
2016-09-28 14:13:54 -07:00
Sandra Lokshina ecdc0cf69f Move buffering logic from streaming engine to playhead.
This is basically rollback to what buffering logic used to be in
shaka v1. We will be checking buffering state every 250ms and
invoke onBuffering event when needed.

Closes #511

Change-Id: I726c7c30e60322cbb5b9f7222405f3cfdf18822b
2016-09-27 14:59:41 -07:00
Jonas Birmé d05b7d5d0c Some DRM providers require default KID in wrapped license requests (#529)
Makes key IDs from the manifest available to the app through DrmInfo.  From there, they can be used in license request filters.
2016-09-26 12:49:08 -07:00
Joey Parrish 6cc3a6a9dd Dispatch network error when HEAD request fails
UNABLE_TO_GUESS_MANIFEST_TYPE doesn't indicate that the guesswork
failed due to a network error.  To make it clearer what went wrong,
dispatch the original network error from the HEAD request.

Change-Id: I1905afdf0913740f9fce0d011b6b2ac3ad37efd7
2016-09-26 18:56:35 +00:00
esteban-dosztal fed84298ad Fix vtt with one digit hour (#522) 2016-09-15 14:46:07 -07:00
Sandra Lokshina 33151fb3aa Keep user selected text track when switching audio.
Closes #514

Change-Id: I6b1a15fca71bdd8db34b0945c59ecac56b2783df
2016-09-13 22:03:30 +00:00
Joey Parrish 17d63566b4 Update changelog and versions for v2.0.0
Change-Id: If1881dc31e5f65e5918d459209e605570c95891a
2016-09-06 18:26:29 +00:00
Sandra Lokshina c7c33c8a19 Add code to disregard empty cueElements to TTML parser.
Closes #506

Change-Id: I3b9844edd281478e8e6cbfeca71e59fcca36aa57
2016-09-06 18:26:04 +00:00
Joey Parrish 5389501197 Improve live edge startup
This fixes the definition of start time to exclude the rebuffering
goal. It also gives us a more conservative default presentation delay.
Content providers should always strive to provide a presentation delay
for their live streams.

Closes #504

Change-Id: I5a373666f4e325cc056ab2336d236b207430bde6
2016-09-03 10:48:03 -07:00
Sandra Lokshina b335c5a9e3 Delegate disconnecting from chromecast to Chrome.
Show 'stop casting' dialog on chromecast control click when casting.
If user chooses to stop, delegate disconnecting to Chrome.

Related to #261

Change-Id: I3072a3723e0d0d526039946fb45713e20349e54c
2016-09-02 21:00:22 +00:00
Sandra Lokshina 359d2c7299 Add support for casting from the cast button built into Chrome.
Closes #261

Change-Id: I1eb8d673d202d913444746f5adc079fede2f605a
2016-09-01 22:11:56 +00:00
Joey Parrish 20ff6e858f Register WebVTT parser with codecs=vtt
Related to issue #480

Change-Id: I0ef6d479e496ba45e6c4f984e8f7dc5e218c5175
2016-09-01 14:35:05 -07:00
Joey Parrish a8b012bc2c Fix cue issues on IE and Edge
- Avoids zero-duration cues which would throw exceptions on IE/Edge
    and stop playback.  (Warns about these ignored cues.)
  - Pushes offset down into the text parsers since cue times are
    read-only on IE/Edge.  This fixes text errors in multi-period
    content on those browsers.
  - Factors VTTCue/TextTrackCue interface decisions out to TextEngine.
  - Adds new platform integration tests for cues.

Closes #501
Closes #502

Change-Id: Ie2210a91e28149f9c4f7fd34bff847aabbeeea63
2016-08-30 17:42:47 -07:00
Joey Parrish 24856d9993 Fix peculiar VTT parser handling of newlines
The parser previously handled files which had no terminating newline,
and files that had a blank line at end (two newlines), but not files
that had a single newline at the end.  In that case, the trailing
newline ended up in the payload of the cue.

Change-Id: If70d1a811e13c7edac9c0ad2de85112d884b84fc
2016-08-30 02:08:07 +00:00
Joey Parrish b5334d6e8a Account for presentation delay in IPR seek range
Closes #477

Change-Id: Ic171e89ab00c9af6b35ae205555e108946270c76
2016-08-29 17:06:31 -07:00
Joey Parrish 6bf002a955 Add videoCapabilities to EME probes
According to the spec, one of videoCapabilities or audioCapabilities
must be non-empty.

Change-Id: I7c52d79afab1aca42495e3639e44558fa3d6bef6
2016-08-29 23:47:30 +00:00
Joey Parrish 1fa69b2375 Filter text streams for compatibility
Type compatibility checks are important for multicodec or
multicontainer content, and there's no good reason to exclude text
from those checks.  The new Axinom v7 test vectors have multicodec
text (both mp4+VTT and mp4+TTML).

Change-Id: I999aaf5b37cda8a9243538b4dd21c503df33dcb9
2016-08-29 23:27:30 +00:00
Sandra Lokshina b5a8fe2c26 Enable switching from unavailable to available text stream: part 2.
When switching from an unavailable to an available text stream we
are adding a text media state. This happens after switch method
checks for it and the assertion fails.
This is a change to return from the switch method before the
assertion gets checked.

Issue #474

Change-Id: I66fd4cfc7b61ea0acb2a7539cc5afaba4e17044e
2016-08-29 21:50:43 +00:00
Sandra Lokshina 925338f2b7 Add support for multiple roles to DASH parser.
DASH parser used to assume representation can only have one role.
However that's not true in case of text representations that can
have both role=main and role=caption/subtitle.

Closes #500

Change-Id: I1b6a494347a0b86211b6982416e444c020b1eeb0
2016-08-29 21:34:16 +00:00
Joey Parrish 3cad924cf1 In-progress recording (IPR) support, phase 2
Behavior for IPR streams:
 * offline storage disallowed
 * segment references will not be stretched to the period
 * seek range starts at 0
 * seek range end is calculated like the live edge
 * seek bar is from 0 to duration, not the seek range

Closes #477

Change-Id: Ia36874bb7208c2473c79cb817395ce03925b8c95
2016-08-29 19:57:15 +00:00
Joey Parrish eafe954d0c Replace Number.POSITIVE_INFINITY with Infinity
This is supported on all browsers, is more compact, and is easier to
read.

Change-Id: I96576dc341e093b7be9ef94fe36595c945b063c1
2016-08-29 18:56:54 +00:00
Joey Parrish c7e73e0115 In-progress recording (IPR) support, phase 1
This change creates a new model which divides DASH streams into VOD,
IPR, and live.  It is possible to create manifests which do not fit
into any of the three categories according to our model, so we now
assert that our input fits cleanly into one of the three.

Inline manifests used in our tests had to be updated to conform to
the new model.  All external test assets have been verified to fit
into these categories.

This is phase 1 of IPR support.  There should be no behavior change
in this CL.

In phase 2, we will make various other parts of the library aware of
IPR so that IPR-specific behaviors can be achieved.

Issue #477

Change-Id: I395d3a0c8c9825a3cd2efde263b8493ce0920ed9
2016-08-29 11:09:45 -07:00