mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 22:02:54 +00:00
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:
1 parent
62d0a366ee
commit
2943fbb9f7
5 files changed
+204
-1
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user