Fix embed player crash and prevent duplicate initialization

- Fix `TypeError: this.videoModal.resetStats is not a function` by implementing `resetStats` (no-op) in `EmbedVideoModal` and adding a safety guard in `Application.resetTorrentStats`.
- Prevent duplicate `NostrClient` initialization within the same frame by adding idempotent guards in `js/embed.js` and `js/nostr/client.js`.
- Add documentation (`docs/embed-notes.md`) on embed architecture and recommendations for multi-frame resource sharing (SharedWorker).
- Add regression test `tests/embed_playback_check.spec.mjs`.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-24 21:42:37 +00:00
1 parent 62d0a366ee
commit 2943fbb9f7
5 files changed
+204 -1

No files matched your search

+9
View File
@@ -75,6 +75,10 @@ class EmbedVideoModal {
return this.video;
}
resetStats() {
// No-op for embed view
}
updateStatus(message) {
setStatus(message, "default");
}
@@ -353,6 +357,11 @@ const setPointerState = ({ video, hint } = {}) => {
};
const startEmbed = async () => {
if (window.__bitvidEmbedStarted) {
return;
}
window.__bitvidEmbedStarted = true;
if (!(videoEl instanceof HTMLVideoElement)) {
setStatus("Embed video element is missing.", "error");
return;