mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 22:59:39 +00:00
Fix playback speed from localstorage and then modifying speed
This commit is contained in:
@@ -123,9 +123,15 @@ const VideoPlayer = ({
|
|||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const searchParamVideoProgress = searchParams.get('t');
|
const searchParamVideoProgress = searchParams.get('t');
|
||||||
|
|
||||||
|
const playBackSpeedFromStorage = Number(localStorage.getItem('playerSpeed') || 1);
|
||||||
|
const playBackSpeedIndex =
|
||||||
|
VIDEO_PLAYBACK_SPEEDS.indexOf(playBackSpeedFromStorage) !== -1
|
||||||
|
? VIDEO_PLAYBACK_SPEEDS.indexOf(playBackSpeedFromStorage)
|
||||||
|
: 3;
|
||||||
|
|
||||||
const [skippedSegments, setSkippedSegments] = useState<SponsorSegmentsSkippedType>({});
|
const [skippedSegments, setSkippedSegments] = useState<SponsorSegmentsSkippedType>({});
|
||||||
const [isMuted, setIsMuted] = useState(false);
|
const [isMuted, setIsMuted] = useState(false);
|
||||||
const [playbackSpeedIndex, setPlaybackSpeedIndex] = useState(3);
|
const [playbackSpeedIndex, setPlaybackSpeedIndex] = useState(playBackSpeedIndex);
|
||||||
const [lastSubtitleTack, setLastSubtitleTack] = useState(0);
|
const [lastSubtitleTack, setLastSubtitleTack] = useState(0);
|
||||||
const [showHelpDialog, setShowHelpDialog] = useState(false);
|
const [showHelpDialog, setShowHelpDialog] = useState(false);
|
||||||
const [showInfoDialog, setShowInfoDialog] = useState(false);
|
const [showInfoDialog, setShowInfoDialog] = useState(false);
|
||||||
@@ -329,9 +335,7 @@ const VideoPlayer = ({
|
|||||||
}}
|
}}
|
||||||
onLoadStart={(videoTag: VideoTag) => {
|
onLoadStart={(videoTag: VideoTag) => {
|
||||||
videoTag.currentTarget.volume = Number(localStorage.getItem('playerVolume') ?? 1);
|
videoTag.currentTarget.volume = Number(localStorage.getItem('playerVolume') ?? 1);
|
||||||
videoTag.currentTarget.playbackRate = Number(
|
videoTag.currentTarget.playbackRate = Number(playBackSpeedFromStorage ?? 1);
|
||||||
localStorage.getItem('playerSpeed') ?? 1,
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
onTimeUpdate={handleTimeUpdate(
|
onTimeUpdate={handleTimeUpdate(
|
||||||
videoId,
|
videoId,
|
||||||
|
|||||||
Reference in New Issue
Block a user