ogplayer 0.2.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -155,7 +155,52 @@ export declare class OGPlayer {
155
155
  removeAdListener(l: AdListener): void;
156
156
  private dispatch;
157
157
  private emit;
158
+ /** The queue set by loadPlaylist() — empty when a single item was loaded. */
159
+ private playlistItems;
160
+ private playlistPosition;
161
+ /** Content ended with the item's ad schedule not yet settled (postroll
162
+ * still to play, or the VMAP still loading after an early seek-to-end).
163
+ * The playlist advance waits for all-ads-completed / an ad error, with a
164
+ * timeout so a hung ads request can never wedge the queue. */
165
+ private pendingPlaylistAdvanceAfterAds;
166
+ private playlistAdvanceFallback;
167
+ /** False from the moment an ad session actually starts for the current
168
+ * item until the provider reports all ads completed — the playlist
169
+ * advance gate. True when the item has no session (or a watched one).
170
+ * Works for every provider (IMA and FreeWheel alike), unlike a cue-point
171
+ * or session-key heuristic. */
172
+ private adScheduleSettled;
173
+ get playlist(): OGMediaItem[];
174
+ /** Index of the playing item within the playlist (−1 without one). */
175
+ get currentPlaylistIndex(): number;
176
+ /** The item that plays after the current one — null on the last item or
177
+ * without a playlist. The UI's "Up next" card keys off this. */
178
+ get nextPlaylistItem(): OGMediaItem | null;
179
+ /** Loads a single item, clearing any playlist set earlier. */
158
180
  load(item: OGMediaItem, options?: LoadOptions): void;
181
+ /**
182
+ * Queues `items` and starts playback at `startIndex`. Each item keeps its
183
+ * own DRM/ads/subtitle pipeline; when one ends (postrolls included) the
184
+ * next loads automatically and `onPlaylistItemChanged` fires. The UI's
185
+ * "Up next" countdown card appears in the lead window before each advance;
186
+ * `skipToNext()` jumps immediately.
187
+ */
188
+ loadPlaylist(items: OGMediaItem[], options?: {
189
+ startIndex?: number;
190
+ autoplay?: boolean;
191
+ }): void;
192
+ /** Skips to the next playlist item now (the "Up next" card's tap action).
193
+ * No-op on the last item or without a playlist. */
194
+ skipToNext(): void;
195
+ /** Content already ended and the ad schedule just settled (all ads done
196
+ * or the session errored) — run the deferred playlist advance. A tick
197
+ * later: the advance tears down the ad session, which must not happen
198
+ * inside the provider's own callback. */
199
+ private releasePendingPlaylistAdvance;
200
+ /** Advances to the next queued item, if any. Called from the completion
201
+ * funnels (content end / postroll end) and from skipToNext(). */
202
+ private maybeAdvancePlaylist;
203
+ private loadItemInternal;
159
204
  /** Wire the media pipeline for `item` — everything about the SOURCE, none
160
205
  * of the session state. Reused to restore content after a provider that
161
206
  * plays ads in the content element (FreeWheel) hands it back. */
@@ -135,6 +135,14 @@ export interface PlaybackListener {
135
135
  /** The browser blocked autoplay-with-audio and `fallbackToMutedAutoplay`
136
136
  * restarted playback muted — show your own unmute affordance. */
137
137
  onMutedAutoplayFallback?(): void;
138
+ /** A playlist item became current — fired for the start item of
139
+ * `loadPlaylist`, every auto-advance, and every `skipToNext()`. */
140
+ onPlaylistItemChanged?(index: number, item: OGMediaItem): void;
141
+ /** The user skipped ahead via `skipToNext()` (the "Up next" card's tap) —
142
+ * fired before the resulting onPlaylistItemChanged. Auto-advances at the
143
+ * end of an item do NOT fire this, so analytics can tell an impatient
144
+ * skip from natural completion. */
145
+ onPlaylistItemSkipped?(fromIndex: number, toIndex: number): void;
138
146
  onError?(error: OGPlayerError): void;
139
147
  }
140
148
  /** One frame of a storyboard/trick-play track: a crop within a sprite. */