mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-19 03:42:04 +00:00
clear embedID and sourceID when switching ep
This commit is contained in:
parent
0ed0496692
commit
583599d6a3
4 changed files with 7 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ export function usePlayer() {
|
|||
const setCaption = usePlayerStore((s) => s.setCaption);
|
||||
const setSourceId = usePlayerStore((s) => s.setSourceId);
|
||||
const status = usePlayerStore((s) => s.status);
|
||||
const setEmbedId = usePlayerStore((s) => (s as any).setEmbedId);
|
||||
const shouldStartFromBeginning = usePlayerStore(
|
||||
(s) => s.interface.shouldStartFromBeginning,
|
||||
);
|
||||
|
|
@ -66,6 +67,7 @@ export function usePlayer() {
|
|||
) {
|
||||
const start = startAtOverride ?? getProgress(progressStore.items, meta);
|
||||
setCaption(null);
|
||||
setEmbedId(null);
|
||||
setSource(source, captions, start);
|
||||
setSourceId(sourceId);
|
||||
setStatus(playerStatus.PLAYING);
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ export function useSourceScraping(sourceId: string | null, routerId: string) {
|
|||
|
||||
const [request, run] = useAsyncFn(async () => {
|
||||
if (!sourceId || !meta) return null;
|
||||
setEmbedId(null);
|
||||
const scrapeMedia = metaToScrapeMedia(meta);
|
||||
const providerApiUrl = getLoadbalancedProviderApiUrl();
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ export const createDisplaySlice: MakeSlice<DisplaySlice> = (set, get) => ({
|
|||
set((s) => {
|
||||
s.status = playerStatus.IDLE;
|
||||
s.meta = null;
|
||||
s.embedId = null;
|
||||
s.sourceId = null;
|
||||
s.thumbnails.images = [];
|
||||
s.progress.time = 0;
|
||||
s.progress.duration = 0;
|
||||
|
|
|
|||
|
|
@ -162,6 +162,8 @@ export const createSourceSlice: MakeSlice<SourceSlice> = (set, get) => ({
|
|||
setMeta(meta, newStatus) {
|
||||
set((s) => {
|
||||
s.meta = meta;
|
||||
s.embedId = null;
|
||||
s.sourceId = null;
|
||||
s.interface.hideNextEpisodeBtn = false;
|
||||
if (newStatus) s.status = newStatus;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue