mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
[enhancement]: support viewing current/setting current time in remote
This commit is contained in:
parent
b347b794b9
commit
5b2977e5e8
9 changed files with 61 additions and 13 deletions
|
|
@ -131,16 +131,15 @@ export const CenterControls = ({ playersRef }: CenterControlsProps) => {
|
|||
const formattedTime = formatDuration(currentTime * 1000 || 0);
|
||||
|
||||
useEffect(() => {
|
||||
let interval: any;
|
||||
let interval: ReturnType<typeof setInterval>;
|
||||
|
||||
if (status === PlayerStatus.PLAYING && !isSeeking) {
|
||||
if (!isElectron() || playbackType === PlaybackType.WEB) {
|
||||
// Update twice a second for slightly better performance
|
||||
interval = setInterval(() => {
|
||||
setCurrentTime(currentPlayerRef.getCurrentTime());
|
||||
}, 1000);
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
return () => clearInterval(interval);
|
||||
|
|
|
|||
|
|
@ -669,11 +669,11 @@ export const useCenterControls = (args: { playersRef: any }) => {
|
|||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (utils?.isLinux()) {
|
||||
if (remote) {
|
||||
const unsubCurrentTime = usePlayerStore.subscribe(
|
||||
(state) => state.current.time,
|
||||
(time) => {
|
||||
mpris?.updatePosition(time);
|
||||
remote.updatePosition(time);
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue