FrameworkStyle

selectPiP

Select the picture-in-picture state slice from the player store

Pass selectPiP to PlayerController to subscribe to picture-in-picture state. Returns undefined if the PiP feature is not configured.

The returned state includes whether PiP is active and its availability on the current platform.

import { createPlayer, MediaElement } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
import { selectPiP } from '@videojs/core/dom';

const { PlayerController, context } = createPlayer({ features: videoFeatures });

class PiPButton extends MediaElement {
  #pip = new PlayerController(this, context, selectPiP);
}

API Reference

Parameters

Parameter Type Default
state* object

Return Value

MediaPictureInPictureState | undefined

VideoJS