mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-05-13 11:07:29 +08:00
fix: Update outro start time calculation to handle cases with undefined durationMillis
This commit is contained in:
@@ -226,7 +226,8 @@ const usePlayerStore = create<PlayerState>((set, get) => ({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Set the time
|
// Set the time
|
||||||
const newOutroStartTime = status.positionMillis;
|
if (!status.durationMillis) return;
|
||||||
|
const newOutroStartTime = status.durationMillis - status.positionMillis;
|
||||||
set({ outroStartTime: newOutroStartTime });
|
set({ outroStartTime: newOutroStartTime });
|
||||||
get()._savePlayRecord({ outroStartTime: newOutroStartTime });
|
get()._savePlayRecord({ outroStartTime: newOutroStartTime });
|
||||||
Toast.show({
|
Toast.show({
|
||||||
@@ -270,7 +271,11 @@ const usePlayerStore = create<PlayerState>((set, get) => ({
|
|||||||
|
|
||||||
const { detail, currentEpisodeIndex, episodes, outroStartTime, playEpisode } = get();
|
const { detail, currentEpisodeIndex, episodes, outroStartTime, playEpisode } = get();
|
||||||
|
|
||||||
if (outroStartTime && newStatus.positionMillis >= outroStartTime) {
|
if (
|
||||||
|
outroStartTime &&
|
||||||
|
newStatus.durationMillis &&
|
||||||
|
newStatus.positionMillis >= newStatus.durationMillis - outroStartTime
|
||||||
|
) {
|
||||||
if (currentEpisodeIndex < episodes.length - 1) {
|
if (currentEpisodeIndex < episodes.length - 1) {
|
||||||
playEpisode(currentEpisodeIndex + 1);
|
playEpisode(currentEpisodeIndex + 1);
|
||||||
return; // Stop further processing for this update
|
return; // Stop further processing for this update
|
||||||
|
|||||||
Reference in New Issue
Block a user