mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-11 14:53:47 +02:00
allow transcode on waveform streamURL (#2060)
This commit is contained in:
@@ -8,7 +8,7 @@ import { QueueSong } from '/@/shared/types/domain-types';
|
|||||||
export function useSongUrl(
|
export function useSongUrl(
|
||||||
song: QueueSong | undefined,
|
song: QueueSong | undefined,
|
||||||
current: boolean,
|
current: boolean,
|
||||||
transcode: TranscodingConfig,
|
transcode: Partial<TranscodingConfig>,
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
const prior = useRef(['', '']);
|
const prior = useRef(['', '']);
|
||||||
const shouldReusePrior = Boolean(
|
const shouldReusePrior = Boolean(
|
||||||
@@ -24,7 +24,7 @@ export function useSongUrl(
|
|||||||
bitrate: transcode.bitrate,
|
bitrate: transcode.bitrate,
|
||||||
format: transcode.format,
|
format: transcode.format,
|
||||||
id: song!.id,
|
id: song!.id,
|
||||||
transcode: transcode.enabled,
|
transcode: transcode.enabled ?? false,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
queryKey: [
|
queryKey: [
|
||||||
@@ -63,7 +63,7 @@ export function useSongUrl(
|
|||||||
|
|
||||||
export const getSongUrl = async (
|
export const getSongUrl = async (
|
||||||
song: QueueSong,
|
song: QueueSong,
|
||||||
transcode: TranscodingConfig,
|
transcode: Partial<TranscodingConfig>,
|
||||||
skipAutoTranscode?: boolean,
|
skipAutoTranscode?: boolean,
|
||||||
) => {
|
) => {
|
||||||
const url = await api.controller.getStreamUrl({
|
const url = await api.controller.getStreamUrl({
|
||||||
@@ -73,7 +73,7 @@ export const getSongUrl = async (
|
|||||||
format: transcode.format,
|
format: transcode.format,
|
||||||
id: song.id,
|
id: song.id,
|
||||||
skipAutoTranscode,
|
skipAutoTranscode,
|
||||||
transcode: transcode.enabled,
|
transcode: transcode.enabled ?? false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,13 @@ import styles from './playerbar-waveform.module.css';
|
|||||||
import { useSongUrl } from '/@/renderer/features/player/audio-player/hooks/use-stream-url';
|
import { useSongUrl } from '/@/renderer/features/player/audio-player/hooks/use-stream-url';
|
||||||
import { PlayerbarSeekSlider } from '/@/renderer/features/player/components/playerbar-seek-slider';
|
import { PlayerbarSeekSlider } from '/@/renderer/features/player/components/playerbar-seek-slider';
|
||||||
import { usePlayer } from '/@/renderer/features/player/context/player-context';
|
import { usePlayer } from '/@/renderer/features/player/context/player-context';
|
||||||
import { BarAlign, usePlayerbarSlider, usePlayerSong, usePlayerTimestamp } from '/@/renderer/store';
|
import {
|
||||||
|
BarAlign,
|
||||||
|
usePlaybackSettings,
|
||||||
|
usePlayerbarSlider,
|
||||||
|
usePlayerSong,
|
||||||
|
usePlayerTimestamp,
|
||||||
|
} from '/@/renderer/store';
|
||||||
import { useAppThemeColors, useColorScheme } from '/@/renderer/themes/use-app-theme';
|
import { useAppThemeColors, useColorScheme } from '/@/renderer/themes/use-app-theme';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
|
|
||||||
@@ -30,7 +36,12 @@ export const PlayerbarWaveform = () => {
|
|||||||
|
|
||||||
const songDuration = currentSong?.duration ? currentSong.duration / 1000 : 0;
|
const songDuration = currentSong?.duration ? currentSong.duration / 1000 : 0;
|
||||||
|
|
||||||
const streamUrl = useSongUrl(currentSong, true, { bitrate: 64, enabled: false, format: 'mp3' });
|
const { transcode } = usePlaybackSettings();
|
||||||
|
const streamUrl = useSongUrl(currentSong, true, {
|
||||||
|
bitrate: 64,
|
||||||
|
enabled: transcode.enabled,
|
||||||
|
format: 'mp3',
|
||||||
|
});
|
||||||
|
|
||||||
const { color } = useAppThemeColors();
|
const { color } = useAppThemeColors();
|
||||||
const primaryColor = (color['--theme-colors-primary'] as string) || 'rgb(53, 116, 252)';
|
const primaryColor = (color['--theme-colors-primary'] as string) || 'rgb(53, 116, 252)';
|
||||||
|
|||||||
Reference in New Issue
Block a user