OGPlayer Web SDK
    Preparing search index...

    Class OGPlayer

    The OGPlayer playback engine HLS via hls.js (MSE) everywhere, natively on Safari; MPEG-DASH via dash.js (MSE), loaded on the first DASH item; progressive files directly. UI is <og-player> from the ui module; the engine also works fully headless.

    Index
    adsProvider: AdsProvider | null = null

    Opt-in client-side ads integration (e.g. ImaAdsProvider). Set before load()ing an item with adBreaks.

    fallbackToMutedAutoplay: boolean = false

    See OGPlayerOptions.fallbackToMutedAutoplay; mutable so a host (or the vertical feed pool) can flip it per lifecycle phase.

    holdPlayback: boolean = false

    While true, nothing may start playback — play() and every internal resume path no-op. Used by the hard ad-block policy; equally useful for host-side gates (paywalls, age gates).

    locale: string = "en"

    BCP-47 language the engine names tracks in when it derives a name from the track's language code ("de" → "German" under "en", "Duits" under "nl"). Default "en" — never the browser's language. <og-player> sets it from OGUIConfig.locale (or its lang attribute) on every mount.

    subtitleStyle: SubtitleStyle = ...
    subtitleTextScale: number = 1.0
    videoElement: HTMLVideoElement
    volumeControlMode: VolumeControlMode = "PLAYER"

    Web routes all volume to the element; kept for API parity.

    • get adCuePoints(): number[]

      VMAP cue-point times in seconds (negative = postroll).

      Returns number[]

    • get adCuePositionsMs(): number[]

      Ad-break cue positions in ms (postroll = duration).

      Returns number[]

    • get adProgress(): | {
          adCount: number;
          adIndex: number;
          durationMs: number;
          positionMs: number;
      }
      | null

      Progress of the current ad (drives the yellow ad bar), or null.

      Returns
          | {
              adCount: number;
              adIndex: number;
              durationMs: number;
              positionMs: number;
          }
          | null

    • get adsPending(): boolean

      True between an autoplay load-with-ads and the first provider verdict (content pause OR resume) — the UI keeps controls hidden meanwhile.

      Returns boolean

    • get currentPlaylistIndex(): number

      Index of the playing item within the playlist (−1 without one).

      Returns number

    • get hasThumbnails(): boolean

      True when the current item carries a storyboard (trick-play) track.

      Returns boolean

    • get isAdUiDialogOpen(): boolean

      True while the ads provider's own dialog (IMA's "About this ad") is up: the chrome steps aside and leaves every key to it.

      Returns boolean

    • get isInPip(): boolean

      True while the video is in picture-in-picture — entered through enterPip() or by the browser itself (its auto-enter, its own PiP control).

      Returns boolean

    • get isLooping(): boolean

      Loop the current item seamlessly (native <video loop>); survives across load() calls,.

      Returns boolean

    • get isQualitySwitchPending(): boolean

      True from a manual quality pick until that rung is the one playing (or 10 s). The chrome shows its ring meanwhile.

      Returns boolean

    • get nextPlaylistItem(): OGMediaItem | null

      The item that plays after the current one — null on the last item or without a playlist. The UI's "Up next" card keys off this.

      Returns OGMediaItem | null

    • get sessionId(): string | null

      Id of the current analytics session — a fresh UUID minted by every load(), stamped on each AnalyticsEvent of that load so consumers can key their pipelines without inventing their own ids. Null before the first load.

      Returns string | null

    • get strings(): OGStrings

      The words of the track names the engine builds itself: audioFallback, subtitlesFallback and audioChannels (the other keys are the chrome's). Assign a partial map — it is merged over English. <og-player> sets it from OGUIConfig.strings on every mount.

      Returns OGStrings

    • set strings(s: Partial<OGStrings>): void

      Parameters

      Returns void

    • Supplied by <og-player>: the element IMA renders its ad UI into.

      Parameters

      • el: HTMLElement

      Returns void

    • Puts the video into picture-in-picture: the standard requestPictureInPicture(), or Safari's presentation mode where only that exists. Resolves true once the video is in PiP (or already was); false — never a rejection — when the browser has no PiP API (Firefox, smart-TV engines) or refuses the request, before anything is loaded, after release(), and while an ad break is on screen (PiP of an ad is not offered). Browsers grant PiP to a user gesture: call it from a click or key handler. There is no PiP button in the chrome — entering is the host's decision, or the browser's (OGPlayerOptions.autoEnterPip). onPipChanged and the PictureInPictureChanged analytics event report every transition.

      Returns Promise<boolean>

    • Leaves picture-in-picture; a no-op when the video is not in it. Resolves once the browser has closed the window.

      Returns Promise<void>

    • Moves focus into the ads provider's own UI (IMA's skip button, icons) — the remote chrome's deliberate step into the ad on Right/Up. True when the provider took focus; false without a break, a provider, or provider support (the mobile focusAdUi()).

      Returns boolean

    • The storyboard frame covering positionMs, or null (mobile parity: getThumbnail). The frame is a crop within a sprite image.

      Parameters

      • positionMs: number

      Returns Promise<ThumbnailFrame | null>

    • Queues items and starts playback at startIndex. Each item keeps its own DRM/ads/subtitle pipeline; when one ends (postrolls included) the next loads automatically and onPlaylistItemChanged fires. The UI's "Up next" countdown card appears in the lead window before each advance; skipToNext() jumps immediately.

      Parameters

      • items: OGMediaItem[]
      • options: { autoplay?: boolean; startIndex?: number } = {}

      Returns void

    • The player surface was resized — keep the ad UI matched.

      Parameters

      • width: number
      • height: number
      • fullscreen: boolean

      Returns void

    • Watches the licensed flag (the watermark follows it). Returns an unsubscribe — a host element that re-mounts must drop its old closure, or every mount leaks one that retains the element.

      Parameters

      • cb: (licensed: boolean) => void

      Returns () => void

    • Reloads the last loaded item after a fatal error — VOD resumes at the last healthy playback position, live streams rejoin at the edge. The built-in error overlay's Retry button calls this; hosts building their own UI can too. No-op before the first load().

      Returns void

    • Parameters

      • id: string | null

      Returns void

    • Buffer discipline for pooled players (the vertical feed): STANDBY caps appetite (10s forward / 8MB, no back-buffer, metadata-only preload for progressive sources); ACTIVE restores full defaults.

      Parameters

      • role: "STANDBY" | "ACTIVE"

      Returns void

    • Skips to the next playlist item now (the "Up next" card's tap action). No-op on the last item or without a playlist.

      Returns void

    • Skips to the previous playlist item now, from its start (the remote's previous key, the TV chrome's previous button). No-op on the first item or without a playlist. Fires onPlaylistItemSkipped(from, from − 1), then onPlaylistItemChanged — the same pair skipToNext() fires.

      Returns void

    • Stops playback and releases the media pipeline (hls.js instance, media resource, decoder and any DRM session), keeping the player instance reusable — the next load() re-attaches everything. Use it when a player stays mounted but must stop holding a decode session (a paused card in a feed, a hidden tab, a route the viewer left). A picture-in- picture window closes with it (PictureInPictureChanged reports it).

      Returns void