Fix warnings and update tracability
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!-- TRACES: UR-003, UR-005, UR-020, UR-021, UR-026 | DR-010, DR-023, DR-024 -->
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
@@ -312,8 +313,8 @@
|
||||
console.log("[VideoPlayer] Video element configured: muted=", videoElement.muted, "volume=", videoElement.volume);
|
||||
|
||||
// DIAGNOSTIC: Check if video has audio tracks
|
||||
if (videoElement.audioTracks) {
|
||||
console.log("[VideoPlayer] Audio tracks count:", videoElement.audioTracks.length);
|
||||
if ((videoElement as any).audioTracks) {
|
||||
console.log("[VideoPlayer] Audio tracks count:", (videoElement as any).audioTracks.length);
|
||||
|
||||
// Set initial audio track (prefer default track)
|
||||
if (selectedAudioTrackIndex === null && audioTracks().length > 0) {
|
||||
@@ -322,11 +323,11 @@
|
||||
console.log("[VideoPlayer] Selected default audio track:", selectedAudioTrackIndex);
|
||||
}
|
||||
}
|
||||
if (videoElement.mozHasAudio !== undefined) {
|
||||
console.log("[VideoPlayer] mozHasAudio:", videoElement.mozHasAudio);
|
||||
if ((videoElement as any).mozHasAudio !== undefined) {
|
||||
console.log("[VideoPlayer] mozHasAudio:", (videoElement as any).mozHasAudio);
|
||||
}
|
||||
if (videoElement.webkitAudioDecodedByteCount !== undefined) {
|
||||
console.log("[VideoPlayer] webkitAudioDecodedByteCount:", videoElement.webkitAudioDecodedByteCount);
|
||||
if ((videoElement as any).webkitAudioDecodedByteCount !== undefined) {
|
||||
console.log("[VideoPlayer] webkitAudioDecodedByteCount:", (videoElement as any).webkitAudioDecodedByteCount);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -359,7 +360,7 @@
|
||||
const subtitles = media.mediaStreams.filter(s => s.type === "Subtitle");
|
||||
for (const sub of subtitles) {
|
||||
try {
|
||||
const url = getSubtitleUrl(sub.index);
|
||||
const url = await getSubtitleUrl(sub.index);
|
||||
if (url) {
|
||||
subtitleTracks.push({
|
||||
index: sub.index,
|
||||
@@ -617,7 +618,7 @@
|
||||
videoElement?.removeEventListener("seeked", onSeeked);
|
||||
resolve();
|
||||
};
|
||||
videoElement.addEventListener("seeked", onSeeked);
|
||||
videoElement!.addEventListener("seeked", onSeeked);
|
||||
// Fallback timeout in case seeked event doesn't fire
|
||||
setTimeout(() => {
|
||||
videoElement?.removeEventListener("seeked", onSeeked);
|
||||
@@ -951,7 +952,7 @@
|
||||
target: {
|
||||
value: newTime.toString()
|
||||
}
|
||||
} as Event;
|
||||
} as unknown as Event;
|
||||
|
||||
await handleSeekBarChange(syntheticEvent);
|
||||
}
|
||||
@@ -1120,7 +1121,7 @@
|
||||
videoElement?.removeEventListener("canplay", onCanPlay);
|
||||
resolve();
|
||||
};
|
||||
videoElement.addEventListener("canplay", onCanPlay);
|
||||
videoElement!.addEventListener("canplay", onCanPlay);
|
||||
|
||||
// Timeout fallback
|
||||
setTimeout(() => {
|
||||
@@ -1214,11 +1215,11 @@
|
||||
}
|
||||
|
||||
// Get subtitle URL for a given stream index
|
||||
function getSubtitleUrl(streamIndex: number): string {
|
||||
async function getSubtitleUrl(streamIndex: number): Promise<string> {
|
||||
if (!media || !mediaSourceId) return "";
|
||||
try {
|
||||
const repo = auth.getRepository();
|
||||
return repo.getSubtitleUrl(media.id, mediaSourceId ?? "", streamIndex, "vtt");
|
||||
return await repo.getSubtitleUrl(media.id, mediaSourceId ?? "", streamIndex, "vtt");
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user