mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
wip
This commit is contained in:
@@ -116,8 +116,8 @@ export default function page() {
|
||||
}, [videoRef]);
|
||||
|
||||
const seek = useCallback(
|
||||
(ticks: number) => {
|
||||
videoRef.current?.seek(ticksToSeconds(ticks));
|
||||
(seconds: number) => {
|
||||
videoRef.current?.seek(seconds);
|
||||
},
|
||||
[videoRef]
|
||||
);
|
||||
@@ -151,20 +151,12 @@ export default function page() {
|
||||
if (isSeeking.value === true) return;
|
||||
if (isPlaybackStopped === true) return;
|
||||
|
||||
console.log({
|
||||
data,
|
||||
isSeeking: isSeeking.value,
|
||||
isPlaybackStopped,
|
||||
});
|
||||
|
||||
const ticks = secondsToTicks(data.currentTime);
|
||||
|
||||
progress.value = ticks;
|
||||
cacheProgress.value = secondsToTicks(data.playableDuration);
|
||||
setIsBuffering(data.playableDuration === 0);
|
||||
|
||||
console.log("progress.value", progress.value);
|
||||
|
||||
if (!playSettings?.item?.Id || data.currentTime === 0) return;
|
||||
|
||||
await getPlaystateApi(api).onPlaybackProgress({
|
||||
@@ -353,9 +345,6 @@ export function useVideoSource(
|
||||
|
||||
return {
|
||||
uri: playUrl,
|
||||
textTracks: {
|
||||
|
||||
},
|
||||
isNetwork: true,
|
||||
startPosition,
|
||||
headers: getAuthHeaders(api),
|
||||
|
||||
@@ -116,8 +116,8 @@ export const Controls: React.FC<Props> = ({
|
||||
!offline && enableTrickplay
|
||||
);
|
||||
|
||||
const [currentTime, setCurrentTime] = useState(0); // Seconds
|
||||
const [remainingTime, setRemainingTime] = useState(0); // Seconds
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
const [remainingTime, setRemainingTime] = useState(0);
|
||||
|
||||
const min = useSharedValue(0);
|
||||
const max = useSharedValue(item.RunTimeTicks || 0);
|
||||
@@ -254,7 +254,7 @@ export const Controls: React.FC<Props> = ({
|
||||
if (curr !== undefined) {
|
||||
const newTime = isVlc
|
||||
? Math.max(0, curr - secondsToMs(settings.rewindSkipTime))
|
||||
: Math.max(0, curr - settings.rewindSkipTime * 10000000);
|
||||
: Math.max(0, ticksToSeconds(curr) - settings.rewindSkipTime);
|
||||
await seek(newTime);
|
||||
if (wasPlayingRef.current === true) play();
|
||||
}
|
||||
@@ -268,10 +268,11 @@ export const Controls: React.FC<Props> = ({
|
||||
wasPlayingRef.current = isPlaying;
|
||||
try {
|
||||
const curr = progress.value;
|
||||
console.log(curr);
|
||||
if (curr !== undefined) {
|
||||
const newTime = isVlc
|
||||
? curr + secondsToMs(settings.forwardSkipTime)
|
||||
: curr + settings.forwardSkipTime * 10000000;
|
||||
: ticksToSeconds(curr) + settings.forwardSkipTime;
|
||||
await seek(Math.max(0, newTime));
|
||||
if (wasPlayingRef.current === true) play();
|
||||
}
|
||||
|
||||
@@ -95,3 +95,8 @@ export const secondsToMs = (seconds?: number | undefined) => {
|
||||
if (!seconds) return 0;
|
||||
return seconds * 1000;
|
||||
};
|
||||
|
||||
export const msToSeconds = (ms?: number | undefined) => {
|
||||
if (!ms) return 0;
|
||||
return Math.floor(ms / 1000);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user