allow transcode on waveform streamURL (#2060)

This commit is contained in:
jeffvli
2026-05-26 20:35:23 -07:00
parent 329d028edd
commit 1aa6b88cfa
2 changed files with 17 additions and 6 deletions
@@ -8,7 +8,7 @@ import { QueueSong } from '/@/shared/types/domain-types';
export function useSongUrl(
song: QueueSong | undefined,
current: boolean,
transcode: TranscodingConfig,
transcode: Partial<TranscodingConfig>,
): string | undefined {
const prior = useRef(['', '']);
const shouldReusePrior = Boolean(
@@ -24,7 +24,7 @@ export function useSongUrl(
bitrate: transcode.bitrate,
format: transcode.format,
id: song!.id,
transcode: transcode.enabled,
transcode: transcode.enabled ?? false,
},
}),
queryKey: [
@@ -63,7 +63,7 @@ export function useSongUrl(
export const getSongUrl = async (
song: QueueSong,
transcode: TranscodingConfig,
transcode: Partial<TranscodingConfig>,
skipAutoTranscode?: boolean,
) => {
const url = await api.controller.getStreamUrl({
@@ -73,7 +73,7 @@ export const getSongUrl = async (
format: transcode.format,
id: song.id,
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 { PlayerbarSeekSlider } from '/@/renderer/features/player/components/playerbar-seek-slider';
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 { Text } from '/@/shared/components/text/text';
@@ -30,7 +36,12 @@ export const PlayerbarWaveform = () => {
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 primaryColor = (color['--theme-colors-primary'] as string) || 'rgb(53, 116, 252)';