mirror of
https://github.com/jeffvli/feishin.git
synced 2024-11-20 14:37:06 +01:00
Minor player adjustments
This commit is contained in:
parent
cdb5cdf442
commit
60219c2522
@ -41,6 +41,12 @@ ipcMain.on('player-seek-to', async (_event, time: number) => {
|
||||
|
||||
// Sets the queue in position 0 and 1 to the given data. Used when manually starting a song or using the next/prev buttons
|
||||
ipcMain.on('player-set-queue', async (_event, data: PlayerData) => {
|
||||
if (!data.queue.current && !data.queue.next) {
|
||||
await mpv.clearPlaylist();
|
||||
await mpv.pause();
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.queue.current) {
|
||||
await mpv.load(data.queue.current.streamUrl, 'replace');
|
||||
}
|
||||
@ -48,6 +54,8 @@ ipcMain.on('player-set-queue', async (_event, data: PlayerData) => {
|
||||
if (data.queue.next) {
|
||||
await mpv.load(data.queue.next.streamUrl, 'append');
|
||||
}
|
||||
|
||||
await mpv.play();
|
||||
});
|
||||
|
||||
// Replaces the queue in position 1 to the given data
|
||||
|
@ -12,9 +12,10 @@ import {
|
||||
RiEraserLine,
|
||||
} from 'react-icons/ri';
|
||||
import { Song } from '/@/renderer/api/types';
|
||||
import { useQueueControls } from '/@/renderer/store';
|
||||
import { usePlayerControls, useQueueControls } from '/@/renderer/store';
|
||||
import { PlaybackType, TableType } from '/@/renderer/types';
|
||||
import { usePlayerType } from '/@/renderer/store/settings.store';
|
||||
import { useSetCurrentTime } from '../../../store/player.store';
|
||||
|
||||
const mpvPlayer = isElectron() ? window.electron.mpvPlayer : null;
|
||||
|
||||
@ -27,7 +28,10 @@ export const PlayQueueListControls = ({ type, tableRef }: PlayQueueListOptionsPr
|
||||
const { clearQueue, moveToBottomOfQueue, moveToTopOfQueue, shuffleQueue, removeFromQueue } =
|
||||
useQueueControls();
|
||||
|
||||
const { pause } = usePlayerControls();
|
||||
|
||||
const playerType = usePlayerType();
|
||||
const setCurrentTime = useSetCurrentTime();
|
||||
|
||||
const handleMoveToBottom = () => {
|
||||
const selectedRows = tableRef?.current?.grid.api.getSelectedRows();
|
||||
@ -70,8 +74,11 @@ export const PlayQueueListControls = ({ type, tableRef }: PlayQueueListOptionsPr
|
||||
|
||||
if (playerType === PlaybackType.LOCAL) {
|
||||
mpvPlayer.setQueue(playerData);
|
||||
mpvPlayer.stop();
|
||||
mpvPlayer.pause();
|
||||
}
|
||||
|
||||
setCurrentTime(0);
|
||||
pause();
|
||||
};
|
||||
|
||||
const handleShuffleQueue = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user