@bitmovin/player-integration-webxr - v1.2.0
    Preparing search index...

    Class BitmovinWebXR

    Immersive playback of a Bitmovin Player's video inside an A-Frame scene.

    Created through BitmovinWebXR.create, which attaches the integration to a player and a scene. The instance owns the entities it adds — the video element, the projection surface, the stereo pair, the sky, the caption panel, the poster panel and pointer input — and the setters below reconfigure them for as long as it lives.

    After destroy, the set… methods, on and requestDeviceOrientation throw. The get…, has… and is… methods and off do not; getVideoSampling returns null.

    Index
    • Attach immersive playback to a player and a scene.

      Must be called before the player loads its first source: the integration hands the player its own video element, and setVideoElement only takes effect ahead of load.

      Resolves once the scene has loaded, so callers never have to work around A-Frame's asynchronous setup themselves.

      The scene's active camera is taken once, here. To use another camera, destroy the integration and create a new one. The canvas follows the size of its box, so fullscreen the scene's container directly; nothing needs a manual resize.

      A source's poster shows until the first frame: inline, in the player's own poster layer; in an immersive session, on a panel in the scene.

      Parameters

      • player: PlayerAPI

        An existing player, configured by the application.

      • scene: Element

        The <a-scene> to render into.

      • config: BitmovinWebXRConfig = {}

        Any section left out takes its DEFAULT_* value.

      Returns Promise<BitmovinWebXR>

      If scene is not an <a-scene>, if it has no camera entity, if the player has a source loaded — including one loaded while the scene was still loading — or if the scene does not load within 30s of the page finishing loading.

    • The player this integration was attached to.

      Returns PlayerAPI

    • The video element the player renders into, and the scene textures from.

      Returns HTMLVideoElement

    • Whether the surfaces are showing a frame of the current source.

      False from a load() until the first frame of what was loaded decodes, and for as long as nothing arrives — a source whose manifest resolves but whose segments never do leaves this false indefinitely, with no timeout. An application drawing its own indicator over the gap wants this and WebXREvent.FrameStateChanged rather than the video element's own events, which are the integration's business and may change.

      It says nothing about why there is no frame. A load that fails after its manifest parses looks identical from here, so an application that has to stop waiting needs the player's own error events as well.

      False after destroy: the surfaces are gone.

      Returns boolean

    • Whether the scene is showing the current source's poster: in an immersive session, from the image loading until the first frame. An indicator drawn over the gap can leave the poster undimmed while this is true. False after destroy.

      Returns boolean

    • The projection in effect, after clamping: the last one given to setProjection or to create(), with every field filled in.

      A copy. Changing it changes nothing; reshape the surface through setProjection. Cheap enough to read every frame, which is how an indicator of where the video's front lies can follow a reshape without being told.

      Returns Required<ProjectionConfig>

    • Where a world-space direction lands in the video, for an effect drawn from the frame the viewer sees — a blurred copy behind a translucent panel, say.

      Null while there is no frame to sample: before the first one decodes, across a load(), before A-Frame has made the surface's texture, and after destroy, which disposes that texture. A snapshot, like getProjection: read it again after a reshape or a stereo switch. Cheap enough to read every frame.

      Returns VideoSampling | null

    • Switch stereo layout, or return to monoscopic playback.

      Merges onto the current configuration rather than the defaults, so changing the layout does not silently reset the desktop eye, and { desktopEye } alone switches the eye the desktop camera renders.

      Parameters

      Returns void

    • Turn input models on or off, or hand them back to detection with "auto".

      Merges onto the current configuration, so switching one model does not reset the rest.

      Parameters

      Returns void

    • Turn the view clamp on or off, or change how far inside the arc it stops.

      Merges onto the current configuration, so switching it on does not reset an inset that was configured with it.

      Parameters

      Returns void

    • Ask the browser for access to the device's orientation sensors, so tilting the device looks around ("magic window").

      Call this from a click handler, on every platform. WebKit prompts only from a user gesture, and rejects the call without one on an origin that has not answered — reported as "needs-gesture", meaning nothing was asked rather than that the viewer refused. pointerdown does not count as that gesture (verified on iPadOS 18), so wiring this to a drag raises no prompt.

      An origin already granted resolves without prompting, so calling this on every load shows the dialog only on the first visit. Chrome (151 and later) has the same call: under its default sensor setting it answers "granted" without prompting, and "denied" where the viewer blocked motion sensors. It plans to make asking the default, after which it needs the gesture as WebKit does. A browser without the call answers "unsupported", which needs no handling.

      The integration never asks on its own — A-Frame's own attempt, at scene setup and outside any gesture, is what this replaces. To keep A-Frame's flow instead, call scene.setAttribute("device-orientation-permission-ui", "enabled", true) before create(). The same attribute in the markup does not work: A-Frame 1.8 clears it during startup.

      Returns Promise<DeviceOrientationPermission>

      What the platform answered. "granted" also switches A-Frame's magic-window tracking on, whether the camera has set up yet or not.

    • Replace what fills the area the projection does not cover. Unlike the other setters this does not merge: each mode takes its own fields. A missing or unknown mode keeps the current background.

      Parameters

      Returns void

    • Reconfigure the caption panel.

      Merges onto the current configuration, so moving the panel does not reset how it is drawn. Which track is on stays the application's decision, made through player.subtitles — the panel renders whatever cues result.

      Parameters

      Returns void

    • Point the viewer in a direction now, regardless of where they were looking. Head tracking and drag-to-look take over again immediately. An axis left out keeps where the viewer looks now.

      Parameters

      Returns void

    • Remove everything the integration added to the scene.

      The player is left alone: the application created it and owns its lifetime.

      Note that it is still bound to the video element removed here, because setVideoElement is only defined before a source is loaded and there is no supported way to hand the player back its original element afterwards. A player is therefore not reusable across integrations: destroy it alongside this instance, or keep this instance for as long as the player lives.

      Returns void