mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 18:33:33 +00:00
Add MPRIS support (#25)
* Stop mpv on app close for linux/macOS (#20) * Add initial MPRIS support * Fix mpv path check
This commit is contained in:
parent
0f7f4b969f
commit
23f84d68e8
19 changed files with 1672 additions and 144 deletions
|
|
@ -34,6 +34,8 @@ import { useHandleTableContextMenu } from '/@/renderer/features/context-menu';
|
|||
import { QUEUE_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items';
|
||||
|
||||
const mpvPlayer = isElectron() ? window.electron.mpvPlayer : null;
|
||||
const utils = isElectron() ? window.electron.utils : null;
|
||||
const mpris = isElectron() && utils?.isLinux() ? window.electron.mpris : null;
|
||||
|
||||
type QueueProps = {
|
||||
type: TableType;
|
||||
|
|
@ -68,6 +70,11 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref<any>) => {
|
|||
|
||||
const handleDoubleClick = (e: CellDoubleClickedEvent) => {
|
||||
const playerData = setCurrentTrack(e.data.uniqueId);
|
||||
mpris?.updateSong({
|
||||
currentTime: 0,
|
||||
song: playerData.current.song,
|
||||
status: 'Playing',
|
||||
});
|
||||
|
||||
if (playerType === PlaybackType.LOCAL) {
|
||||
mpvPlayer.setQueue(playerData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue