Before, we would treat each buffer separately when deciding to clear
when seeking. However, this can cause problems because the media
states can end up needing different Periods.
For example: we are in Period 2 and seek backwards into Period 1 where
we have buffered text but not video. The text media state will need
Period 2 since it is buffered; but the video media state will need
Period 1. For both states, the "current" Period is 2, so the video
state will try to handle a Period transition. This will cause an
indefinite hang since text state will never need Period 1.
Issue #655
Change-Id: I9d03c0378481b412a79eef205cd647ec9895a8d7
Before, we would fire a 'trackschanged' event when StreamingEngine
asked us to select streams for a new Period. However, this is not
when the tracks change, they change when the playhead moves into a
different Period.
This adds code to Playhead to track where the current Period is and
raise an event when it changes. This also reduces any extra events so
a 'trackschanged' event is only fired when the tracks actually change.
Issue #680
Change-Id: I85aedaed737f9324d5871201d952066886ea290c
The member |initData| may be null or an Array. When calling
Array.concat with a non-array (e.g. null) it will add a new element.
This results in an array containing null rather than the intended
empty array.
Issue #682
Change-Id: I76b7625a04327f0e236b523d7dc83e08385a7804
This is a slight revert/modification of d4f2566d.
We should be calling setVariants inside load(). This is because we
need to tell AbrManager about the last filtering (for MIME type).
However, we should be using the current Period, not the first Period
like it was originally.
Change-Id: I83e1a3fa71e0b19815697d02658913d9e6edeb04
All of these exported methods on Player should be callable on
non-destroyed Player instances, even before media has been loaded or
after media fails to load. This makes sure we do not encounter
exceptions in these exported methods.
A follow-up on #677 and #678
Change-Id: Ia366c201da722f3e1d00935cc9de64d8a50883c8
If no content has been loaded and therefore there is no streamingEngine
then these two functions will fail. Add a guard to check and return an
empty array if there is no streamingEngine.
Close#677
We were not able to get our externs generated by the Closure compiler.
There were many issues with the Closure-generated externs, including
the order of the externs and the replacement of record types and enums
with their underlying types.
We made a few attempts to patch the compiler, but could not get our
patches accepted upstream.
This change introduces a new script to generate our externs from
scratch. It uses a JavaScript parser called 'esprima'.
Some interfaces need to be exported to the generated externs, but are
not actually attached to the namespace by the compiler. For this, we
introduce a new annotation. These are the currently-supported export
annotations:
- @export: truly exported (attached to namespace) by the compiler
- @expose: truly exposed (not renamed) by the compiler
- @exportDoc: considered part of the exports in the docs
- @exportInterface: considered part of the exports in generated externs
These annotations are now documented in docs/design/export.md
Change-Id: I33bf7384889c14c9edb0fa5f11caa7c4f4d79af6
Before, we would use the last appended segment to determine how much
we have buffered in StreamingEngine. However, this causes a slight
difference between StreamingEngine and Playhead, which uses the
MediaSource buffered ranges.
If the video has a non-zero drift, StreamingEngine will think it has
buffered enough and will stop buffering, but Playhead will see the
buffered ranges slightly less than the goal and wait forever.
Issue #600
Change-Id: Ib68df5f8a84c15bcc8530f9db9c6b9a06e6a72ba
Now it is set in a more suitable stage of content parsing, thus
fixing a bug where the field would contain multiple copies of
every keyInfo.
Change-Id: I12875efa04c4e3ccbb459945091533006bd398fd
First, Player should not call AbrManager.setVariants as part of load().
Before, it would set them for the first Period; however, this doesn't
work with a start time in another Period. StreamingEngine will call
chooseStreams_ for the starting Period before startup finishes.
Second, we should handle Period transitions before we handle buffering
goal. Before, we would wait until the playhead moves closer to the
Period transition even if we have buffered the entire Period. This
can cause problems when seeking, especially with text content that
buffers quickly. If we seek and we have buffered text but not video,
the pipeline will stall since text is waiting for the playhead to move
while video is waiting for the Period transition.
Lastly, it is possible for multiple Period transitions to occur closely
together. If we seek into a Period that is not setup yet, and then
seek back to a Period that is setup, then the second transition will
complete and the first will override it once it finishes setting up
the Period. We should stop any old transitions if another starts.
Issue #655
Change-Id: Iab8961c606a65487704c9f0efaa255db0e3dc942
This also makes the Playhead ignore duplicate regions. This simplifies
manifest updates in DashParser by having it add every Event tag it
sees. The DASH spec doesn't specify how we should detect duplicate
entries or how events are fired. So to avoid firing all the same
'timelineregionadded' events on every manifest update and getting
multiple enter/exit events, we will simply remove duplicates.
Closes#462
Change-Id: If5d2c42bd6958567b2ec05ba1e9af252c95cf354
If a session has been created but the license request hasn't been sent,
the session is not "callable". This will cause the |session.close()|
to be rejected and the |session.closed| Promise to never resolve. So
in DrmEngine.destroy, we should be using the Promise returned from
|session.close()| instead of |session.closed|. The |session.close()|
Promise will only resolve once the |session.closed| Promise is resolved
so they are effectively the same.
Closes#664
Change-Id: Ia619740d1eb3fa8ca1bdf121574d1efb1ddbea26
When using segment-relative timestamps in VTT, the presentation
offset has already been factored into the segment time. Therefore,
it should not be added again in the VTT parser.
Closes#595Closes#599
Change-Id: I9d062af7a17859f6f3374ecf20369b361f3eac7b
Chrome doesn't seem to support gap jumping immediately after a seek.
So when we detect how much is buffered after a seek, we should use the
exact ranges. Otherwise we will be left with a small gap that Chrome
doesn't want to jump.
Issue #655
Change-Id: I2d853e0c2b95285013463f38cece56ea9ea56133
Often we listen for an event once, then stop. This adds a convenience
method to EventManager for this increasingly common pattern.
Change-Id: I1507a904a8dac10b8d89965b3a0f192ed8f9ae2c
This add the groundwork for event regions that occur while playing.
When the playhead enters (or plays through) a specified region it will
fire enter/exit events for it. They are not fired when seeking over.
Issue #462
Change-Id: I9e280796bd012ad74d0319aa2056c6f6aa28890d
HLS parsing will be split into parsing the text of the manifest into
shaka internal objects and parsing those into a shakaExtern.Manifest.
This will make logic more clear and allow to test ManifestTextParser
independently of HlsParser.
Issue #279.
Change-Id: I44349966d3617e2d208185e3ad125ecea89732b4
Both DASH and HLS parsers will be using resolveUris() and possibly
other methods in the future.
Create a ManifestParserUtil for the shared methods.
Issue #279.
Change-Id: Iaa5e32ec543a390341a54752563a9f27251f0832
Rather than accepting multiple callback methods as separate arguments,
now start() will accept an object. This will allow us to add new
callbacks without breaking backwards compatibility or adding
additional arguments.
Change-Id: I839cbb12e71c2e7270aa218802c79440c458e964
IE/Edge have problems with reporting the buffered ranges when we get
to the end of the media. We use a fudge factor to determine if we have
buffered all the content. It was too small which meant that we would
not detect end of stream correctly. This increases the fudge factor
so we detect it correctly.
Closes#658
Change-Id: Ie9ecf8fd49eb716ffd8ccd9bcdff53b88356bbfe
Add UI options to select current audio and text language.
Split selectTrack() into selectText() and selectVariant().
Stop automatically disabling ABR manager when a variant is selected.
Add a warning if selectVariant() is called while abr is enabled.
Issue #412.
Issue #626.
Change-Id: I15f1c3c4fdc6d6b641f708fbef19dbcf10cbcfc6
Using a special API available on the Chromecast, determine if we can
do 4k. If so, raise the hardware limit from 1080p to 4k.
Change-Id: I6e403cce5d9c43a22f1b76cf4d79661ac096dd82
Now, when you pass a rejected or pending promise into Promise.resolve(),
it won't count as resolved.
Change-Id: Ib2ee6e12625753436bfeb0b418dd824df4bb422a
This adds a second Restrictions object to the Player configuration to
restrict ABR decisions. The original restrictions will remove any
non-matching streams from the manifest, like before. This new
configuration will only apply to AbrManager choices. Any restricted
track can still be explicitly selected using Player.selectTrack.
Closes#565
Change-Id: I52379b096e81f97df22b6683669c5787694d87e7
When we call this.onError_() directly, the load() pipeline will
continue even in a case where it should not. By throwing the error
instead, we force load() to stop before issuing additional, confusing
errors.
b/34127751
Change-Id: I9c5e1412711b08407c976aeec2fcd01abcf73456
The emsg, loading, and unloading events were present in v2.0.0.
The drmInfo, isInProgress, and keySystem method were also present in
v2.0.0. The getPlayheadTimeAsDate method was introduced in v2.0.1.
None of these were proxied to the cast device until now. All v2.0.x
events and methods are now being proxied.
Change-Id: I6fba60f4ca451053c1449cafcddd9c1006292ad9
In some cases, the networking engine could have attempted to
remove a pending request that did not exist, thus removing other
requests.
Change-Id: I08fb9c11c3dd153af7a148fcb591fe5c0c3634a1
Any EssentialProperty element we don't recognize is necessarily
attached to something we don't know how to handle correctly. We are
now following the recommendations in the specs which say that the
parent element should be skipped in these cases.
Change-Id: Iabd8a796c6c27e4187b3f0d7efe60ea35c933c7e
Parses DASH trick mode tracks and puts the extra trick mode Stream
into the manifest. StreamingEngine can now use this info to optimize
streaming during trick play mode.
Includes:
- a new demo asset with a trick mode track
- updates to tests (we now require at least one audio or video stream
and we require bandwidth attributes on them)
- updates to the parser's trickmode test
- a new StreamingEngine test
Closes#538
Change-Id: Id38264ca64bc7905a5c33a269269741cfd12dd4d
During recent refactoring, we introduced a bug in which we would
filter out any text stream with a non-empty codecs parameter.
Replaces PR #639
Change-Id: I9a45ef7e1bc250fd989e3972c0670f3e48336511
Now, the ignoreTextStreamFailures config applies to parsing errors as
well as network errors.
We also no longer count text streams against the startup phase. Early
text failures will not prevent StreamingEngine from switching, without
regard for the presence of the ignoreTextStreamFailures config.
Issue #635
Change-Id: I6818ef021beabfbc8742a7b013fa0424b77cff47