2020-11-04 08:32:06 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { NativeModules } from 'react-native';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enabled/Disables the PictureInPicture mode in PiP native module.
|
|
|
|
*
|
2022-06-21 05:49:46 +00:00
|
|
|
* @param {boolean} enabled - Whether the PiP mode should be enabled.
|
2020-11-04 08:32:06 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-06-21 05:49:46 +00:00
|
|
|
export function setPictureInPictureEnabled(enabled: boolean) {
|
2020-11-04 08:32:06 +00:00
|
|
|
const { PictureInPicture } = NativeModules;
|
|
|
|
|
2021-03-05 15:33:53 +00:00
|
|
|
if (PictureInPicture) {
|
2022-06-21 05:49:46 +00:00
|
|
|
PictureInPicture.setPictureInPictureEnabled(enabled);
|
2021-03-05 15:33:53 +00:00
|
|
|
}
|
2020-11-04 08:32:06 +00:00
|
|
|
}
|