mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
Support changing playback rate (#275)
* initial idea for playback rate * Add transparency to dropdown * Move playback speed component to right controls * Set mpv speed on startup --------- Co-authored-by: jeffvli <jeffvictorli@gmail.com>
This commit is contained in:
parent
742b13d65e
commit
2664a80851
7 changed files with 85 additions and 12 deletions
|
|
@ -10,6 +10,7 @@ import {
|
|||
import { useSettingsStore } from '/@/renderer/store/settings.store';
|
||||
import type { CrossfadeStyle } from '/@/renderer/types';
|
||||
import { PlaybackStyle, PlayerStatus } from '/@/renderer/types';
|
||||
import { useSpeed } from '/@/renderer/store';
|
||||
|
||||
interface AudioPlayerProps extends ReactPlayerProps {
|
||||
crossfadeDuration: number;
|
||||
|
|
@ -59,6 +60,7 @@ export const AudioPlayer = forwardRef(
|
|||
const [isTransitioning, setIsTransitioning] = useState(false);
|
||||
const audioDeviceId = useSettingsStore((state) => state.playback.audioDeviceId);
|
||||
const playback = useSettingsStore((state) => state.playback.mpvProperties);
|
||||
const playbackSpeed = useSpeed();
|
||||
|
||||
const [webAudio, setWebAudio] = useState<WebAudio | null>(null);
|
||||
const [player1Source, setPlayer1Source] = useState<MediaElementAudioSourceNode | null>(
|
||||
|
|
@ -307,6 +309,7 @@ export const AudioPlayer = forwardRef(
|
|||
}}
|
||||
height={0}
|
||||
muted={muted}
|
||||
playbackRate={playbackSpeed}
|
||||
playing={currentPlayer === 1 && status === PlayerStatus.PLAYING}
|
||||
progressInterval={isTransitioning ? 10 : 250}
|
||||
url={player1?.streamUrl}
|
||||
|
|
@ -325,6 +328,7 @@ export const AudioPlayer = forwardRef(
|
|||
}}
|
||||
height={0}
|
||||
muted={muted}
|
||||
playbackRate={playbackSpeed}
|
||||
playing={currentPlayer === 2 && status === PlayerStatus.PLAYING}
|
||||
progressInterval={isTransitioning ? 10 : 250}
|
||||
url={player2?.streamUrl}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue