react-video-renderer
react-video-renderer copied to clipboard
Add support for "picture in picture"
I tried adding unit tests, but it seems like the TS transpiler (ts-react-toolbox) has an outdated TS version and thus, it does not support PictureInPicture API. I didn't take the time to see how to upgrade the underlying tooling. Maybe @zzarcon can have a look at that?
yarn test __tests__/index.tsx
yarn run v1.22.19
$ ts-react-toolbox test __tests__/index.tsx
FAIL __tests__/index.tsx
● Test suite failed to run
src/video.tsx:262:29 - error TS2339: Property 'pictureInPictureElement' does not exist on type 'Document'.
262 return !!getDocument()?.pictureInPictureElement;
~~~~~~~~~~~~~~~~~~~~~~~
src/video.tsx:267:29 - error TS2339: Property 'pictureInPictureEnabled' does not exist on type 'Document'.
267 return !!getDocument()?.pictureInPictureEnabled && sourceType === 'video';
~~~~~~~~~~~~~~~~~~~~~~~
src/video.tsx:271:53 - error TS2339: Property 'exitPictureInPicture' does not exist on type 'Document'.
271 this.isPictureInPictureActive && getDocument()?.exitPictureInPicture();
~~~~~~~~~~~~~~~~~~~~
src/video.tsx:280:36 - error TS2339: Property 'requestPictureInPicture' does not exist on type 'HTMLVideoElement'.
280 await this.videoRef.current?.requestPictureInPicture();
~~~~~~~~~~~~~~~~~~~~~~~
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 3.193 s
Ran all test suites matching /__tests__\/index.tsx/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command