2024-08-27 07:47:20 -04:00
|
|
|
/*
|
2024-09-06 10:22:13 +02:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2024-08-27 07:47:20 -04:00
|
|
|
|
2025-02-18 17:59:58 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-06 10:22:13 +02:00
|
|
|
Please see LICENSE in the repository root for full details.
|
2024-08-27 07:47:20 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { Subject } from "rxjs";
|
|
|
|
|
|
|
|
|
|
export interface Controls {
|
|
|
|
|
canEnterPip: () => boolean;
|
|
|
|
|
enablePip: () => void;
|
|
|
|
|
disablePip: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-17 04:01:56 +00:00
|
|
|
export const setPipEnabled$ = new Subject<boolean>();
|
2024-08-27 07:47:20 -04:00
|
|
|
|
|
|
|
|
window.controls = {
|
|
|
|
|
canEnterPip(): boolean {
|
2024-12-17 04:01:56 +00:00
|
|
|
return setPipEnabled$.observed;
|
2024-08-27 07:47:20 -04:00
|
|
|
},
|
|
|
|
|
enablePip(): void {
|
2024-12-17 04:01:56 +00:00
|
|
|
if (!setPipEnabled$.observed) throw new Error("No call is running");
|
|
|
|
|
setPipEnabled$.next(true);
|
2024-08-27 07:47:20 -04:00
|
|
|
},
|
|
|
|
|
disablePip(): void {
|
2024-12-17 04:01:56 +00:00
|
|
|
if (!setPipEnabled$.observed) throw new Error("No call is running");
|
|
|
|
|
setPipEnabled$.next(false);
|
2024-08-27 07:47:20 -04:00
|
|
|
},
|
|
|
|
|
};
|