mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-26 04:09:08 +00:00
report embed id in debug copy
This commit is contained in:
parent
579d0a15ca
commit
b859ad1b23
3 changed files with 16 additions and 0 deletions
|
|
@ -32,6 +32,7 @@ export function useEmbedScraping(
|
|||
const setSource = usePlayerStore((s) => s.setSource);
|
||||
const setCaption = usePlayerStore((s) => s.setCaption);
|
||||
const setSourceId = usePlayerStore((s) => s.setSourceId);
|
||||
const setEmbedId = usePlayerStore((s) => (s as any).setEmbedId);
|
||||
const progress = usePlayerStore((s) => s.progress.time);
|
||||
const meta = usePlayerStore((s) => s.meta);
|
||||
const router = useOverlayRouter(routerId);
|
||||
|
|
@ -75,6 +76,7 @@ export function useEmbedScraping(
|
|||
]);
|
||||
if (isExtensionActiveCached()) await prepareStream(result.stream[0]);
|
||||
setSourceId(sourceId);
|
||||
setEmbedId(embedId);
|
||||
setCaption(null);
|
||||
setSource(
|
||||
convertRunoutputToSource({ stream: result.stream[0] }),
|
||||
|
|
@ -96,6 +98,7 @@ export function useSourceScraping(sourceId: string | null, routerId: string) {
|
|||
const setSource = usePlayerStore((s) => s.setSource);
|
||||
const setCaption = usePlayerStore((s) => s.setCaption);
|
||||
const setSourceId = usePlayerStore((s) => s.setSourceId);
|
||||
const setEmbedId = usePlayerStore((s) => (s as any).setEmbedId);
|
||||
const progress = usePlayerStore((s) => s.progress.time);
|
||||
const router = useOverlayRouter(routerId);
|
||||
const { report } = useReportProviders();
|
||||
|
|
@ -135,6 +138,7 @@ export function useSourceScraping(sourceId: string | null, routerId: string) {
|
|||
|
||||
if (result.stream) {
|
||||
if (isExtensionActiveCached()) await prepareStream(result.stream[0]);
|
||||
setEmbedId(null);
|
||||
setCaption(null);
|
||||
setSource(
|
||||
convertRunoutputToSource({ stream: result.stream[0] }),
|
||||
|
|
@ -190,6 +194,7 @@ export function useSourceScraping(sourceId: string | null, routerId: string) {
|
|||
),
|
||||
]);
|
||||
setSourceId(sourceId);
|
||||
setEmbedId(result.embeds[0].embedId);
|
||||
setCaption(null);
|
||||
if (isExtensionActiveCached()) await prepareStream(embedResult.stream[0]);
|
||||
setSource(
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ export interface SourceSlice {
|
|||
status: PlayerStatus;
|
||||
source: SourceSliceSource | null;
|
||||
sourceId: string | null;
|
||||
embedId: string | null;
|
||||
qualities: SourceQuality[];
|
||||
audioTracks: AudioTrack[];
|
||||
currentQuality: SourceQuality | null;
|
||||
|
|
@ -97,6 +98,7 @@ export interface SourceSlice {
|
|||
setMeta(meta: PlayerMeta, status?: PlayerStatus): void;
|
||||
setCaption(caption: Caption | null): void;
|
||||
setSourceId(id: string | null): void;
|
||||
setEmbedId(id: string | null): void;
|
||||
enableAutomaticQuality(): void;
|
||||
redisplaySource(startAt: number): void;
|
||||
setCaptionAsTrack(asTrack: boolean): void;
|
||||
|
|
@ -129,6 +131,7 @@ export function metaToScrapeMedia(meta: PlayerMeta): ScrapeMedia {
|
|||
export const createSourceSlice: MakeSlice<SourceSlice> = (set, get) => ({
|
||||
source: null,
|
||||
sourceId: null,
|
||||
embedId: null,
|
||||
qualities: [],
|
||||
audioTracks: [],
|
||||
captionList: [],
|
||||
|
|
@ -146,6 +149,11 @@ export const createSourceSlice: MakeSlice<SourceSlice> = (set, get) => ({
|
|||
s.sourceId = id;
|
||||
});
|
||||
},
|
||||
setEmbedId(id) {
|
||||
set((s) => {
|
||||
s.embedId = id;
|
||||
});
|
||||
},
|
||||
setStatus(status: PlayerStatus) {
|
||||
set((s) => {
|
||||
s.status = status;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export interface ErrorDebugInfo {
|
|||
player: {
|
||||
status: string;
|
||||
sourceId: string | null;
|
||||
embedId: string | null;
|
||||
currentQuality: string | null;
|
||||
meta: {
|
||||
title: string;
|
||||
|
|
@ -120,6 +121,7 @@ export function gatherErrorDebugInfo(error: any): ErrorDebugInfo {
|
|||
player: {
|
||||
status: playerStore.status,
|
||||
sourceId: playerStore.sourceId,
|
||||
embedId: (playerStore as any).embedId ?? null,
|
||||
currentQuality: playerStore.currentQuality,
|
||||
meta: playerStore.meta
|
||||
? {
|
||||
|
|
@ -210,6 +212,7 @@ export function formatErrorDebugInfo(info: ErrorDebugInfo): string {
|
|||
`=== PLAYER STATE ===`,
|
||||
`Status: ${info.player.status}`,
|
||||
`Source ID: ${info.player.sourceId || "null"}`,
|
||||
`Embed ID: ${info.player.embedId || "null"}`,
|
||||
`Quality: ${info.player.currentQuality || "null"}`,
|
||||
info.player.meta
|
||||
? [
|
||||
|
|
|
|||
Loading…
Reference in a new issue