mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13: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
|
|
@ -21,7 +21,7 @@ import { Tooltip } from '/@/renderer/components/tooltip';
|
|||
import { Rating } from '/@/renderer/components/rating';
|
||||
|
||||
export const RemoteContainer = () => {
|
||||
const { repeat, shuffle, song, status, volume } = useInfo();
|
||||
const { position, repeat, shuffle, song, status, volume } = useInfo();
|
||||
const send = useSend();
|
||||
const showImage = useShowImage();
|
||||
|
||||
|
|
@ -154,6 +154,16 @@ export const RemoteContainer = () => {
|
|||
</div>
|
||||
)}
|
||||
</Group>
|
||||
{id && position !== undefined && (
|
||||
<WrapperSlider
|
||||
label={(value) => formatDuration(value * 1e3)}
|
||||
leftLabel={formatDuration(position * 1e3)}
|
||||
max={song.duration / 1e3}
|
||||
rightLabel={formatDuration(song.duration)}
|
||||
value={position}
|
||||
onChangeEnd={(e) => send({ event: 'position', position: e })}
|
||||
/>
|
||||
)}
|
||||
<WrapperSlider
|
||||
leftLabel={<RiVolumeUpFill size={20} />}
|
||||
max={100}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,12 @@ export const useRemoteStore = create<SettingsSlice>()(
|
|||
});
|
||||
break;
|
||||
}
|
||||
case 'position': {
|
||||
set((state) => {
|
||||
state.info.position = data;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'proxy': {
|
||||
set((state) => {
|
||||
if (state.info.song) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import type { QueueSong } from '/@/renderer/api/types';
|
|||
import type { PlayerRepeat, PlayerStatus, SongState } from '/@/renderer/types';
|
||||
|
||||
export interface SongUpdateSocket extends Omit<SongState, 'song'> {
|
||||
position?: number;
|
||||
song?: QueueSong | null;
|
||||
}
|
||||
|
||||
|
|
@ -20,6 +21,10 @@ export interface ServerPlayStatus {
|
|||
event: 'playback';
|
||||
}
|
||||
|
||||
export interface ServerPosition {
|
||||
data: number;
|
||||
event: 'position';
|
||||
}
|
||||
export interface ServerProxy {
|
||||
data: string;
|
||||
event: 'proxy';
|
||||
|
|
@ -59,6 +64,7 @@ export type ServerEvent =
|
|||
| ServerError
|
||||
| ServerFavorite
|
||||
| ServerPlayStatus
|
||||
| ServerPosition
|
||||
| ServerRating
|
||||
| ServerRepeat
|
||||
| ServerShuffle
|
||||
|
|
@ -93,8 +99,14 @@ export interface ClientAuth {
|
|||
header: string;
|
||||
}
|
||||
|
||||
export interface ClientPosition {
|
||||
event: 'position';
|
||||
position: number;
|
||||
}
|
||||
|
||||
export type ClientEvent =
|
||||
| ClientAuth
|
||||
| ClientPosition
|
||||
| ClientSimpleEvent
|
||||
| ClientFavorite
|
||||
| ClientRating
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue