Commit Graph

76 Commits

Author SHA1 Message Date
Álvaro Velad Galván 9e2b15ead4 fix(HLS): Fix subtitle timing (#7625)
Simplifies subtitle management for sequence mode and segments mode 
Runs subtitle tests in segments mode as well (Tizen 3.0)

Fixes: https://github.com/shaka-project/shaka-player/issues/7447
2024-11-19 18:36:49 +01:00
Álvaro Velad Galván 013b3c7f22 feat(Offline): Allow store external thumbnails (#7322)
Related to https://github.com/shaka-project/shaka-player/issues/2016
2024-09-17 09:44:53 +02:00
theodab b4e04b6616 feat: Store bandwidth info inside references. (#6825)
Issue #6725

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2024-07-23 14:32:09 +02:00
Álvaro Velad Galván 0895e2e771 feat(HLS): Add support for MediaQualityInfo events (#6927) 2024-06-28 09:14:24 +02:00
Cristian Atehortúa 2dd85e4e23 fix(DASH): decrease memory preasure on manifest with SegmentReference by updating old initSegmentReference (#6499)
Helps on #6070
2024-04-29 11:54:14 -07:00
Álvaro Velad Galván 2bb6dbc56d feat: Add segmentData info to SegmentReference (#6370)
This is useful when creating custom manifests, which are actually a
single segment. For example, a custom AAC manifest or any other audio
format.
2024-03-26 22:44:50 +01:00
Wojciech Tyczyński 58d946e35a perf: Optimize init segment reference comparison for common case (#6014) 2024-02-20 10:03:10 -08:00
Álvaro Velad Galván 31c06ca189 feat: Rename aes128Key to aesKey to allow aes256 in the future (#5990)
See:
https://mailarchive.ietf.org/arch/msg/hls-interest/RZBgatOvI4W0M0J5cShuXWzdigg/
2023-12-05 11:57:14 +01:00
theodab 24e32559bf feat(DASH): Handle mixed-codec variants. (#5950)
With the addition of the changeType API for MediaSource, it is theoretically possible for a variant to change between multiple codecs for a given buffer, over the course of playback.
This adds support for the DASH player to stitch together periods which have such multi-codec variants, but only as a last resort. For example, if one period only has audio in aac, and another period only has opus audio, the player will now stitch those periods together as one, but if there is a throughline that does not involve changing codecs it will go for that instead.

Closes #5961
2023-12-01 00:37:32 -08:00
Álvaro Velad Galván 82ab8937e6 fix: Fix init segment comparison (#5920) 2023-11-22 23:02:34 +01:00
Álvaro Velad Galván 766b0a139e feat: Add partial info to shaka.media.SegmentReference (#5822) 2023-10-30 07:35:51 +01:00
Álvaro Velad Galván 2a3557915f perf(HLS): Improve detection of all partial segments (#5761)
This reduces calls to getUris that use regular expressions which are
slow on low-end devices.
2023-10-11 10:40:55 +02:00
Álvaro Velad Galván 96ae7f2fe6 feat(DASH): Add support for AES-128 (#5656)
Closes https://github.com/shaka-project/shaka-player/issues/5622
2023-09-16 07:34:42 +02:00
Álvaro Velad Galván 7874667645 chore: Rename hlsAes128Key to aes128Key (#5653)
This change is required in preparation for
https://github.com/shaka-project/shaka-player/issues/5622
2023-09-13 20:52:01 +02:00
Álvaro Velad Galván 9e6655a04a feat(HLS): Optimization of LL-HLS with byterange (#5319)
This solution is based on
https://www.akamai.com/blog/performance/-using-ll-hls-with-byte-range-addressing-to-achieve-interoperabi
2023-06-21 11:20:56 +02:00
Álvaro Velad Galván 022f6b96fb fix: Get the correct timescale when there are two trak boxes (#5327)
Stream used for test it:
https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/master.m3u8
2023-06-20 22:41:52 +02:00
Álvaro Velad Galván ed5915e437 fix(HLS): Fix load of LL-HLS when the partial segment is not independent (#5277) 2023-06-12 12:03:57 +02:00
Álvaro Velad Galván ec8804d0be feat(HLS): Add support to _HLS_part query param in LL streams (#5265) 2023-06-07 18:53:04 +02:00
Álvaro Velad Galván f80bf208b1 feat(MSS): Add support for Microsoft Smooth Streaming (VOD only) (#5002)
Closes https://github.com/shaka-project/shaka-player/issues/703

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-03-24 07:47:33 +01:00
Ashwin Bhat 71affe7e85 fix(HLS): support discontinuities in segments mode (#5102) 2023-03-21 09:03:23 +01:00
Joey Parrish 50c9df49a7 fix: Sync each segment against EXT-X-PROGRAM-DATE-TIME (#4870)
Closes #4589
2023-01-12 14:22:40 -08:00
Joey Parrish 35033bb2db fix(HLS): Fix AV sync over ad boundaries (#4824)
If server-side ad segments aren't aligned, AV could get out of sync by
accumulating errors in the timestampOffset of the SourceBuffers.

This improves the issue by tracking discontinuity boundaries and
resetting timestampOffset to theoretical segment start times when a
boundary is crossed.

Issue #4589
2022-12-13 10:14:17 -08:00
Álvaro Velad Galván 86cb3e714c feat: Add external thumbnails with sprites support (#4584)
Continuation of https://github.com/shaka-project/shaka-player/pull/4497
2022-10-18 07:31:15 +02:00
Dave Nicholas 89777dd704 feat: Parse and surface "prft" boxes as events (#4389)
Closes #4382
2022-09-14 13:39:58 +02:00
theodab 6194021a3d feat(hls): Support AES-128 in HLS (#4386)
Expands on the original PR (#3880) by adding support for MP4 and key rotation.

Close #850

Co-authored-by: wjywbs <wjywbs@users.noreply.github.com>
2022-08-12 10:50:32 -07:00
Joey Parrish 314a987ecf fix(hls): Fix AV sync issues, fallback to sequence numbers if PROGRAM-DATE-TIME ignored (#4289)
We now have an explicit fallback to sync on sequence numbers if
PROGRAM-DATE-TIME is explicitly ignored.  This is more robust than
relying on whatever happens to be first in the various media
playlists.

This also refactors how PROGRAM-DATE-TIME is used.  The date will now
be used to adjust segment reference start times, rather than
overriding the time used in StreamingEngine.  (This was hard to
discover when reading the HLS parser.)  Now all HLS sync logic is in
the HLS parser.

Closes #4287
2022-06-13 13:35:57 -07:00
Álvaro Velad Galván 42eecc84f9 feat(hls): parse EXT-X-GAP (#4134)
Parse EXT-X-GAP HLS tag and add a status enum to shaka.media.SegmentReference.

shaka.media.SegmentReference.Status.AVAILABLE --> Normal behaviour
shaka.media.SegmentReference.Status. UNAVAILABLE --> Related to https://github.com/shaka-project/shaka-player/issues/2541
shaka.media.SegmentReference.Status. MISSING --> EXT-X-GAP in HLS

Note: only the parsing is added, but the functionality is not yet implemented.

Issue https://github.com/shaka-project/shaka-player/issues/1308
2022-04-18 10:22:30 -07:00
theodab 89409cee3e feat(hls): Read EXT-X-PROGRAM-DATE-TIME (#4034)
This makes the HLS parser read the EXT-X-PROGRAM-DATE-TIME value
on manifests, and use it to make sure that segments are inserted at
the correct place in the timeline, when in sequence mode.

Issue #2337
2022-03-24 15:58:53 -07:00
Theodore Abshire 264c842496 fix(image): Fix HLS image track issues
This makes the HLS parser honor more attributes for image tracks.
It also makes some changes to player.getImageTracks, so that the
returned track shows the size of a single thumbnail rather than the
entire sheet.

Closes #3840

Change-Id: I2ae096f455864201e08a85e29f0f02a3e06eb07f
2022-01-11 03:41:12 +00:00
Aidan Ridley bd7b384c66 feat: Add media quality change events (#3700)
Closes ##3431
2021-11-12 15:07:18 -08:00
Joey Parrish d4a1255235 fix: Fix thumbnail duration, expose start time and duration
Thumbnail segments may be structured for a certain grid size and
duration, but the segment references may have their duration truncated
due to the end of a period or the end of the presentation.  This was
causing us to calculate the wrong duration for those individual
thumbnails, and therefore return the wrong
thumbnail.

We also did not have any way to indicate to an application how long a
thumbnail should be shown.

This fixes the duration calculation by retaining the original,
untruncated duration in SegmentReference.  This also exposes startTime
and duration information on the Thumbnail object, so that applications
know when/where and how long to show a given thumbnail.

Closes #3517

Change-Id: I84aa7705a19691fc6ae68eee9944fecbd7067fe0
2021-07-14 15:37:43 +00:00
Álvaro Velad Galván 2a4083bab8 feat: Add support to HLS Image Media Playlists (#3365)
Close: #2429
2021-06-02 10:53:32 -07:00
Theodore Abshire 8e1eeda965 fix: Exported SegmentReference.getUris.
Previously, SegmentReference.getUris was listed as public field,
but not actually exported. For an object that does not have externs,
there is no way to ensure that a member variable is not renamed.
So, instead, this CL makes an exported public getUris method, that
wraps the getUrisInner member variable. This allows for the method
to be exported, without having to make an extern for the class.

Closes #3096

Change-Id: I847439c444021bcf6af2b210f7138a51ba164d71
2021-03-11 19:49:03 +00:00
Álvaro Velad Galván 3484ac8c7c fix(media): Fix initSegment requests on manifest updates (#2942)
Fixes #2856
2020-11-10 10:38:35 -08:00
michellezhuo 109973c7e2 feat(LL-HLS):Enable preload hinted segments
LL-HLS hints a resource that is needed to playback in the upcoming
update. It's available for request, and may not be available for
download yet.

A preload hinted resource is either a partial segment, or an init
segment. If it's an init segment, treat it the same way as the Map tag
in ManifestTextParser.
A preload hinted segment contains no duration information, so its
start time and end time are the same. It will be replaced by a partial
segment in the next update.
We should fetch and append the preload hinted segment the same way as a
partial segment.

Issue #1525

Change-Id: I1e30f216ecdc843c3cd01681629a8886383d0b22
2020-07-08 22:11:06 +00:00
michellezhuo 965ef453b6 feat(LL-HLS):Enable Partial Segments streaming
Changed SegmentIndex and SegmentIterator to iterate through regular and
Partial SegmentReferences.

SegmentIndex:
merge(): Find all the old segments after the first new segment's start
time, and replace the old ones with new segments.

SegmentIterator:
Use the currentPosition and currentPartialPosition pointers to iterate
through the two-layer arrays.
current(): Get the current SegmentReference, and get its current Partial
SegmentReference if it has a Partial Segment list. Move to the next
regular segment if we reached the end of the current segment's partial
list.
next():
If the regular segment has a partial list, go to the next Partial
Segment. If reached the end of the current partial list, move to the
next regular segment.
If the regular segment doesn't have a partial list, move to the next
regular segment.

Issue #1525

Change-Id: Icb7f49e50314f15ea40bf3a74d008191ed1a9a6c
2020-07-06 00:34:55 +00:00
michellezhuo 244ebacac3 feat(LL-HLS): create SegmentReferences for Partial Segments
If a segment has partial segment tags, create a SegmentReference for
each partial tag, and add the list of partial SegmentReferences to the
parent SegmentReference as an attribute.
If the parent segment contains the segment tag(EXTINF tag), use the
duration information from EXTINF tag to create the SegmentReference.
Otherwise, calculate the parent segment's duration based on the partial
segments' durations.

Issue #1525

Change-Id: I946cc007aad2ff911b69bf1c6a46df145452bfaa
2020-06-17 17:09:23 +00:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Joey Parrish 342d35f4f9 Fix issues with nullability of numbers
Various issues with the nullability of number types led to various
fixes, including:
 - defaulting a nullable number to 0 to avoid propagating a null value
   through calculations
 - adding an assertion or runtime check that something is not null
 - moving an existing null check to before the calculation
 - returning early on null during an iteration
 - changing a nullable number to non-nullable
 - defaulting to NaN instead of null

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I86d516c74a42ee3624c33d7513d2d4c76d3ea589
2020-04-30 16:00:00 +00:00
Joey Parrish 1ab3f9c6db Remove position from SegmentReference
As part of Period-flattening, I'm trying to remove our dependence on
the "position" field of SegmentReference.  With that eliminated, we
can more easily concatenate Arrays of SegmentReferences without
modifying them.

 - Make SegmentIndex iterable
 - Add specialized seek() and current() methods to SegmentIterator
 - Remove position from SegmentReference
 - Make positions in SegmentIndex API stable without field in
   reference
 - Remove brittle hard-coded positions in tests (except SegmentIndex
   tests, where they would be hard to avoid in testing methods
   separately)
 - Use SegmentIterator in StreamingEngine to track the next segment
   between switches

Issue #892 (refactor StreamingEngine)
Issue #1339 (period flattening)

Change-Id: I666cc21249c34ee6cbc138a59109d9f1159fa127
2020-03-23 10:09:35 -07:00
Joey Parrish 270a547718 Clean up outdated references to "period-relative"
Segment times and positions are no longer period-relative.

Issue #1339

Change-Id: If2b1b7d56ac49d50439598403f681a2da88ce605
2020-03-03 21:53:11 +00:00
Joey Parrish c13830e535 Augment SegmentReference with offset and window
SegmentReference used to have presentationTimeOffset, which,
subtracted from the period start time, was then _added_ to the
timestamps in the segment by MediaSource.

Now, SegmentReference has a timestampOffset field, which is exactly
what MediaSource's timestampOffset field is set to on the SourceBuffer
before this segment is appended.  For DASH, this is periodStart minus
presentationTimeOffset.

This also adds append window start & end times to the
SegmentReference.  Now segments can be appended to SourceBuffers
without reference to the period.

Note that start & end times of the SegmentReference in each segment
index are still relative to the period.  This will change in a
follow-up.

Issue #1339 (flatten periods)
Issue #892 (refactor StreamingEngine)

Change-Id: I9d54eb2b529ec643c9475b8e9d218c3e2e826a26
2019-12-19 11:35:14 -08:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Joey Parrish 289d473dfd Drop the nearly-unused createUris method of SegmentReference
Change-Id: I0ec00e614b2870b8a18d2bb0cd0fc95232c6c28d
2019-11-06 10:51:04 -08:00
Joey Parrish 7fe97b841b Move fields to SegmentReference
To prepare for flattening out the manifest structure to remove
periods, this change moves initSegmentReference and
presentationTimeOffset fields into the SegmentReference object.  This
way, the segments on either side of a period transition or HLS
discontinuity can have different offsets or init segments, eventually
allowing us to create a single array of SegmentReferences for
multi-period content.

Issue #1339

Change-Id: Ic7eff0483789644881247ecf8044c5fb6a48f0e6
2019-08-01 11:04:36 -07:00
Michelle Zhuo a6beb0efdc Update media files to ES6
Issue #1157

Change-Id: I81ff0cee6e479bba728c1e65af70133ba6f28091
2019-05-20 23:11:16 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Jacob Trimble 8ec9e19c4a Add tests for progress events and aborts.
Closes #1051

Change-Id: I6d194751c9c248927688783805efe0335fffe312
2019-05-07 18:29:20 +00:00
Michelle Zhuo 40f9113bb2 Abort requests when network downgrading
When the network becomes slow, we check if stopping the current request
and download the content with lower resolution is faster. If so, abort
the current request and start a new one.

Issue #1051

Change-Id: I588e524469432e362361d1cfbde6cd45c2009959
2019-05-01 20:18:16 +00:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00