You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interstitials live start, buffering, and manager fixes and docs update (#7030)
* Interstitials improvements
- Add interstitialPlayer to InterstitialsManager and simplify interface
- Fix and cover expected playback state in interstitial event callbacks (where currentTime is derived from transitional controller state)
- Fix live start in append-in-place interstitial seeking to second start position when primary starts buffering after starting in interstitial
- Simplify playout-limit handling in asset player
- Add padding to flush front buffer call (prevents start of audio segment from being removed in Safari)
- Fix an issue where buffering an interstitial in place gets stuck when the video buffer is full, but the audio buffer is not (use combined buffer in stream-controller when there is no alt-audio source)
- Fix typos (Interstitals > Interstitials)
* Add `interstitialsManager.interstitialPlayer.assetPlayers` tests - verify playingIndex player is present for relevant asset events
// Warning: (ae-missing-release-tag) "InterstitialPlayer" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
2717
+
//
2718
+
// @public (undocumented)
2719
+
exportinterfaceInterstitialPlayer {
2720
+
// (undocumented)
2721
+
assetPlayers: (HlsAssetPlayer|null)[];
2722
+
// (undocumented)
2723
+
currentTime:number;
2724
+
// (undocumented)
2725
+
duration:number;
2726
+
// (undocumented)
2727
+
playingIndex:number;
2728
+
// (undocumented)
2729
+
scheduleItem:InterstitialScheduleEventItem|null;
2730
+
}
2731
+
2714
2732
// Warning: (ae-missing-release-tag) "InterstitialsBufferedToBoundaryData" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "InterstitialsPrimaryResumed" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -4131,7 +4145,6 @@ export type PlayheadTimes = {
4131
4145
currentTime:number;
4132
4146
duration:number;
4133
4147
seekableStart:number;
4134
-
seekTo: (time:number) =>void;
4135
4148
};
4136
4149
4137
4150
// Warning: (ae-missing-release-tag) "PlaylistContextType" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Copy file name to clipboardExpand all lines: docs/API.md
+55-10
Original file line number
Diff line number
Diff line change
@@ -2019,34 +2019,79 @@ HLS.js supports playback of X-ASSET-URI and X-ASSET-LIST m3u8 playlists schedule
2019
2019
2020
2020
The data includes the list of Interstitial events with their asset lists, the schedule of event and primary segment items, information about which items and assets are buffering and playing, the player instance currently buffering media, and the queue of players responsible for the streaming of assets.
2021
2021
2022
-
Use `skip()` to skip the current interstitial. Use `primary`, `playout`, and `integrated` to get `currentTime`, `duration` and to seek along the respective timeline.
2022
+
Use `skip()` to skip the current interstitial.
2023
+
Use `primary` and `integrated` playhead objects to get `currentTime`, `duration` and to seek along the respective timeline.
2024
+
Use `interstitialPlayer` to get active intersititial info (playing or upcoming buffering break) like `currentTime`, `duration`, and `playingIndex` within an Interstital break.
2023
2025
2024
2026
```ts
2025
2027
interface InterstitialsManager {
2026
-
events: InterstitialEvent[]; // An array of Interstitials (events) parsed from the latest media playlist update
2027
2028
schedule: InterstitialScheduleItem[]; // An array of primary and event items with start and end times representing the scheduled program
2028
-
playerQueue: HlsAssetPlayer[]; // And array of child Hls instances created to preload and stream Interstitial asset content
2029
-
bufferingPlayer: HlsAssetPlayer |null; // The child Hls instance assigned to streaming media at the edge of the forward buffer
2029
+
integrated: PlayheadTimes; // playhead mapping and control that applies the X-TIMELINE-OCCUPIES attribute to each event item
2030
+
primary: PlayheadTimes; // playhead mapping and control based on the primary content
2031
+
2032
+
interstitialPlayer: InterstitialPlayer |null; // interface for interstitial playback state
2033
+
2030
2034
bufferingAsset: InterstitialAssetItem |null; // The Interstitial asset currently being streamed
2031
2035
bufferingItem: InterstitialScheduleItem |null; // The primary item or event item currently being streamed
2032
2036
bufferingIndex: number; // The index of `bufferingItem` in the `schedule` array
2037
+
2033
2038
playingAsset: InterstitialAssetItem |null; // The Interstitial asset currently being streamed
2034
2039
playingItem: InterstitialScheduleItem |null; // The primary item or event item currently being played
2035
2040
playingIndex: number; // The index of `playingItem` in the `schedule` array
2036
-
waitingIndex: number; // The index of the item whose asset list is being loaded in the `schedule` array
2037
-
primary: PlayheadTimes; //playhead mapping and seekTo method based on the primary content
2038
-
playout: PlayheadTimes; //playhead mapping and seekTo method based on playout of all items in the `schedule` array
2039
-
integrated: PlayheadTimes; // playhead mapping and seekTo method that applies the X-TIMELINE-OCCUPIES attribute to each event item
2041
+
2042
+
events: InterstitialEvent[]; //An array of Interstitials (events) parsed from the latest media playlist update
2043
+
playerQueue: HlsAssetPlayer[]; //And array of child Hls instances created to preload and stream Interstitial asset content
2044
+
2040
2045
skip: () =>void; // A method for skipping the currently playing event item, provided it is not jump restricted
2041
2046
}
2042
2047
2043
2048
type PlayheadTimes = {
2044
2049
bufferedEnd: number; // The buffer end time relative to the playhead in the scheduled program
2045
-
currentTime: number; // The current playhead time in the scheduled program
2050
+
currentTime: number; //(get/set) The current playhead time in the scheduled program
2046
2051
duration: number; // The time at the end of the scheduled program
2047
2052
seekableStart: number; // The earliest available time where media is available (maps to the start of the first segment in primary media playlists)
2048
-
seekTo: (time:number) =>void; // A method for seeking to the designated time the scheduled program
2049
2053
};
2054
+
2055
+
interface InterstitialPlayer {
2056
+
currentTime: number; // (get/set) The current playhead time within the interstitial break (no-op prior to playback)
2057
+
duration: number; // the playout duration of the interstitial break
2058
+
assetPlayers: (HlsAssetPlayer |null)[]; // The asset players assigned to the break asset list
2059
+
playingIndex: number; // The index of the currently playing asset (or -1 prior to playback)
2060
+
scheduleItem: InterstitialScheduleEventItem |null; // The interstitial schedule item for the break
2061
+
}
2062
+
```
2063
+
2064
+
The interstials manager can be used to get various apects of interstitial playback.
// Option to disable internal playback handling of Interstitials (set to false to disable Interstitials playback without disabling parsing and schedule events)
310
310
enableInterstitialPlayback: boolean;
311
-
// Option to disable appending Interstitals inline on same timeline and MediaSource as Primary media
311
+
// Option to disable appending Interstitials inline on same timeline and MediaSource as Primary media
312
312
interstitialAppendInPlace: boolean;
313
313
// How many seconds past the end of a live playlist to preload Interstitial assets
0 commit comments