use-pip

A custom react hook for triggering Picture in Picture functionality

Usage no npm install needed!

<script type="module">
  import usePip from 'https://cdn.skypack.dev/use-pip';
</script>

README

usePip

A custom React hook to use Picture in Picture mode in supported browsers.

Usage:

const { loading, error, toggle } = usePip(videoRef);

Parameters:

Parameter description required? default
videoRef Ref for the video element true null

Return:

Name Description Type
loading boolean Manages loading time for setting for detecting support
error string Error state as described by spec
toggle function toggles state of PiP in document