Commit Graph

39 Commits

Author SHA1 Message Date
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 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
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
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
Joey Parrish bd79d607ab Minor cleanup after #811
Change-Id: Iaed56bdbc2937006746ee433e2f13af08e3e585d
2017-05-25 11:15:28 -07: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 488453086a Add hls.Tag.getAttributeValue
Most of the times we want an attribute, it is only to get the value.
This adds a convenience method that gets the value directly, with an
optional default value if the attribute is not found.

Change-Id: I79002c4d6d4d4da468860238eab16fff6b8df747
2017-05-22 18:47:19 +00:00
Joey Parrish eb92f14ab5 Add more missing exports
See also commit 7a770783.

This fixes exports and externs that were broken in v2.1.0 and v2.1.1.

Generated externs are now verified and working with an external
Closure project.

Change-Id: I73a6b92474c87fd6119592c6d632ce91045fc073
2017-05-12 14:54:41 -07:00
Sandra Lokshina 2e84717803 Hls Parser: Make segment request to establish mime type.
Closes #769.

Change-Id: I8692fb0e9e851a31f38d04ab3bfeece0a1ea3375
2017-05-03 20:00:59 +00:00
Joey Parrish 42004d935f Parse key IDs from Widevine HLS content
Change-Id: Ia882d56772a71a0a413cfde62e2621336609ba69
2017-04-17 20:09:39 +00:00
Jacob Trimble e5ce395f37 Implement gap jumping.
The bulk of the logic for gap jumping is handled in Playhead.  It
tracks the current buffered ranges and jumps over any gaps that appear.
It listens for a special browser event ('waiting') for when the video
element runs out of playable frames.

This change also removes the logic for jumping gaps at the beginning
of the timeline.  This is handled by the more general gap jumping
logic and works cross-browser.

Finally, this updates the buffering logic to only count the amount of
content buffered (i.e. ignoring the gaps).  This fixes some bugs where
gaps in the content can result in StreamingEngine buffering forever
since it thinks only a little is buffered.

This includes full implementation of the logic, but this doesn't close
the issue since there aren't any integration tests yet.  Those will
be added next.

Issue #555

Change-Id: Id99eb9fe469e8cf2c7464a3d70c3733791e806e0
2017-04-17 18:15:23 +00:00
Jacob Trimble 575f2ad109 Add an indicator for critical errors.
This adds a severity field to Error objects.  This can be used to
detect whether an error is recoverable.  All the same errors are still
reported so the field can be ignored.

There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
  load() again

Closes #564

Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
2017-04-04 23:57:59 +00:00
Jacob Trimble b4d0fa4901 Expose license expiration times through Player.
This adds a method on Player to get the license expiration times for
the current EME sessions.  This also adds the expiration times to the
stored content structure for offline content.  This will update the
stored expiration while playing content (e.g. license duration changes
when playback starts).

Closes #727

Change-Id: I18770a79413423695bbb2ed5f31f6b19038a33d2
2017-04-03 18:25:43 +00:00
Joey Parrish db909b0f2e Add support for Widevine-encrypted HLS content
This abstracts the creation of DrmInfo to parse the EXT-X-KEY tag
differently per KEYFORMAT.

Issue #279

Change-Id: I2e187dcfc01f7306183c9090c54de58e81872bc4
2017-03-31 12:34:10 -07:00
Joey Parrish b549c3dac3 Add more mp4 extensions to HLS parser
Issue #279

Change-Id: I7a7de1f7321210322144469188fd5d99d0040c0b
2017-03-30 23:08:05 +00:00
Joey Parrish b00bbc45a0 Fix relative URIs in HLS manifest
For some reason, in some of my testing, the captured "uri" variable
was undefined by the time the Promise was resolved.  Instead, use
"response.uri", which accounts for redirects anyway.

Issue #279

Change-Id: Ibaef99a57dc01a665d095fec4765ac9b32d537ac
2017-03-30 22:25:04 +00:00
Joey Parrish 3dfc61a18d Make HlsParser.getRequiredAttributeValue_ static
This will allow me to use it outside of prototype methods in an
upcoming change.

Issue #279

Change-Id: Iaa7c9a92787d0f33b86dc1ba823f750aa268b9b1
2017-03-30 22:12:41 +00:00
Sandra Lokshina eb2f3f2dcb Remove TODO about trying to give Media Source a list of codecs.
We wanted to see if Media Source would accept a list of codecs for
a presentation without specifying which one belongs to which stream.
If it was possible, we wouldn't have to try and guess the codecs
and also wouldn't be limited to a made up list of codecs that we
know Media Source supports.
Been there, done that, doesn't work :|

Issue #279.

Change-Id: Id706022887beaa576eb0f68f2f97a278a0730f30
2017-03-29 12:03:30 -07:00
Sandra Lokshina 4f10bd7878 HLS: allow spaces in the codecs list.
According to the HLS spec, CODECS attribute should have a comma-
separated list of codecs. The example in the spec doesn't contain
spaces between the elements of the list.
However, I encountered spaces in the codecs list in content
encoded by Apple. It's easy to support both ways, so I decided to
do it rather than fight that battle.

Issue #279.

Change-Id: Iecb706207365a51b5964f013e32ffe13e99604c6
2017-03-29 11:36:04 -07:00
Sandra Lokshina 01d6458422 Prepeare HLS parser for supporting encrypted content.
This change enables HLS parser to get DRM information
from the manifest and create DrmInfo objects.
Note that until we actually add support for any of the
drm systems, we will still reject encrypted content.

Issue #279.

Change-Id: I4d0652411a567bc75d919c5bf732f20e870a5aeb
2017-03-29 17:33:12 +00:00
Sandra Lokshina 74653ccfb6 Improve check for encrypted content in HLS parser.
Until we implement support for protected content for HLS, we
reject it. We used to determine it by the presence of an
'EXT-X-KEY' tag. However, it is possible for the manifest to
have the tag, but describe clear key content if the 'METHOD'
attribute of the tag is 'NONE'. This CL insures we don't reject
this kind of playlists.

Issue #279.

Change-Id: Iee853dd23116c40a43b228f0876efe373c3111af
2017-03-23 17:55:18 +00:00
Jacob Trimble ca2f61d6bc Add support for 'emsg' based manifest updates.
b/36072752

Change-Id: I00c19be71e81b15b5d3f33d5e2dafb17a6f8acee
2017-03-16 18:46:05 +00:00
Sandra Lokshina a3d6186dd4 Add support for multiple media tags with the same group-id (HLS).
Currently HLS parser expects only one media tag to have a given
group id. According to the spec that might not be the case.
This change adds support for multiple tags with the same gruop id
and insures the parser creates variants for all of them.

Issue #279.

Change-Id: I327e52387f7513464fc56c4b6b8d07ead689d6cc
2017-03-14 15:07:49 -07:00
Sandra Lokshina f946067535 Add HLS language canonicalization.
b/36134603

Change-Id: I425baa0aba373d1eae32d0097c66ec379347136c
2017-03-14 11:21:18 -07:00
Sandra Lokshina cb11dac389 Fit segment references to the period length in HLS parser.
b/36070874
b/35849456

Change-Id: Ibd64b02dd98d2ff6db175412e5f44dc5e872d767
2017-03-14 10:32:41 -07:00
Sandra Lokshina 0b12937520 Replace content type strings with constansts.
Change-Id: I4fda583915766b40ee7a5c7451d037077d9f2582
2017-03-08 21:41:59 +00:00
Sandra Lokshina c6729d7c14 Add hls config with default time offset.
Apple encoded content has a default time offset of 10 seconds.
Every other packeger we've encountered so far doesn't.
New config will default to 0 and allow the application to specify
the offset for their content according to the packager's standards.

Issue #279

Change-Id: I65b16b05a5974a2f0318cd1f9847c3a56c38b745
2017-03-02 13:32:17 -08:00
Joey Parrish 6632897733 Comment on the lack of HLS CLOSED-CAPTIONS support
Issue #279

Change-Id: I491e0e7da2a814276e071fcd98deb66753c03122
2017-02-28 20:05:43 +00:00
Jacob Trimble fc46b29ed8 Move 'emsg' handling to StreamingEngine.
Rather than having it in the DashParser as a network response filter,
we should have it in StreamingEngine.  This will give it access to the
segment times so we can calculate the presentation times for the event.
Otherwise, there is no way to know when the event should actually occur
since the app can't know which segment is being downloaded or which it
came from.

This also adds startTime and endTime fields to the event so the app
doesn't have to calculate them.  For reverse compatibility, the old
fields will still exist.

Closes #698

Change-Id: Icbaf3619aedfca7ea06bc8b1fe49e9cce65b0cc2
2017-02-23 19:36:06 +00:00
Jacob Trimble 33c277ae82 Remove HLS requirement for init segment.
An init segment is not required for all streams, some streams are
self-initializing (e.g. MPEG2-TS).

Issue #279

Change-Id: I99556ee26f6568cc5e712b50d0bb4de78cb2bd9d
2017-02-17 11:21:13 -08:00
Sandra Lokshina eff3225563 Add constants for shaka content types and stream kinds.
Change-Id: I6630863e3a53caf9c863e5df6a593cddba516f2a
2017-02-17 09:59:37 -08:00
Aaron Vaage e1a4499490 Adding "toString" method to HLS Tags
For HLS Drm Init Data, the whole tag needs to be passed down to
the cdm. This is a problem as by the time the drm init data is
being created the tag has been parsed and no longer has reference
to its original form.

This change adds a function "toString" to create a tag that would
be the same as its original text form.

As we create tags in our tests - it was not feasible to just give
it a text tag value so instead the function will recreate the text
form.

Change-Id: Idbc5bff3dd088a3aa3a67ef6a22749ea91bb1ccf
2017-02-16 20:36:36 +00:00
Sandra Lokshina 109065b3f2 Add support for subtitles to HLS parser.
Issue #279.

Change-Id: Ie32ab228ab0d00f0def9f2ee8d7c1e496b346ef8
2017-02-15 21:19:59 +00:00
Sandra Lokshina 933f5f9834 Update the comment about default time offset for HLS.
Issue #279.

Change-Id: I3b3935906e7e5989db6788648f2b2400b66369f5
2017-02-10 21:34:40 +00:00
Sandra Lokshina 5c5f313351 Add m4s to supported file extensions.
Issue #279.

Change-Id: Ic082b268877c2b5336080113c96a73f029a1503c
2017-02-10 21:20:29 +00:00
Sandra Lokshina 24c17d2d44 Implement basic HLS manifest parser.
Issue #279.

Change-Id: Iec504a7f180f6f069d08bea471a7d4970f7ae7d4
2017-02-09 21:04:50 +00:00
Sandra Lokshina 0553f61528 Refactor HLS manifest text parsing into it's own class.
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
2017-01-20 19:13:21 +00:00
Sandra Lokshina 8afadb4773 Add HLS objects and basic routines to parse manifests into them.
Issue #279.

Change-Id: I5b6f90b682d77849ce075a2a76a4202c56e5d882
2017-01-09 10:50:55 -08:00