1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-08-08 10:12:50 +00:00

Receivers: Added connect/disconenct notifications to player window

This commit is contained in:
Michael Hollister 2025-04-25 14:04:59 -05:00
parent a7cd81aa34
commit c54ce74dfd
11 changed files with 268 additions and 57 deletions

View file

@ -2,6 +2,8 @@ import dashjs from 'modules/dashjs';
import Hls, { LevelLoadedData } from 'modules/hls.js';
import { PlaybackUpdateMessage, PlayMessage, SeekMessage, SetSpeedMessage, SetVolumeMessage } from 'common/Packets';
import { Player, PlayerType } from './Player';
import * as connectionMonitor from '../ConnectionMonitor';
import { toast, ToastIcon } from '../components/Toast';
import {
targetPlayerCtrlStateUpdate,
targetKeyDownEventListener,
@ -330,6 +332,17 @@ function onPlay(_event, value: PlayMessage) {
window.targetAPI.onSetSpeed((_event, value: SetSpeedMessage) => { player.setPlaybackRate(value.speed); playerCtrlStateUpdate(PlayerControlEvent.SetPlaybackRate); });
};
connectionMonitor.setUiUpdateCallbacks({
onConnect: (connections: string[], connectionInfo: any) => {
console.log(`Device connected: ${JSON.stringify(connectionInfo)}`);
toast('Device connected', ToastIcon.INFO);
},
onDisconnect: (connections: string[], connectionInfo: any) => {
console.log(`Device disconnected: ${JSON.stringify(connectionInfo)}`);
toast('Device disconnected. If you experience playback issues, please reconnect.', ToastIcon.INFO);
},
});
window.targetAPI.onPlay(onPlay);
let scrubbing = false;