Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/screen-name/view/VideoPlayerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ export class VideoPlayerNode extends Node {

/** Reset the video source selection to the initial state. */
public reset(): void {
if (this.currentBlobUrl) {
URL.revokeObjectURL(this.currentBlobUrl);
this.currentBlobUrl = null;
}
this.videoSourceControlNode.reset();
this.videoElement.removeAttribute("src");
this.videoElement.load();
Expand Down
8 changes: 2 additions & 6 deletions src/screen-name/view/VideoSourceControlNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ export class VideoSourceControlNode extends HBox {
const fps = frameCount > 0 && duration > 0 ? frameCount / duration : DEFAULT_FRAME_RATE;
storeAndLoad(duration, fps, frameCount > 0 ? frameCount : undefined);
})
.catch(() => storeAndLoad(0));
.catch(() => storeAndLoad(0)); // Frame counting failed; load with unknown duration (0)
} else {
// Read duration via a temporary video element, then store and load
const tempUrl = URL.createObjectURL(blob);
Expand Down Expand Up @@ -506,11 +506,7 @@ export class VideoSourceControlNode extends HBox {
listener: async () => {
isPlayingProperty.value = false;
this.webcamPanel.visible = true;
try {
await this.webcamPanel.open();
} catch {
this.webcamPanel.visible = false;
}
await this.webcamPanel.open();
},
});

Expand Down
22 changes: 13 additions & 9 deletions src/screen-name/view/WebcamPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,20 @@ export class WebcamPanel extends Node {
this.setStatus(this.webcamStrings.requestingAccessStringProperty.value);
this._startButton.enabled = false;

const granted = await this.recorder.requestPermission();
if (!granted) {
try {
const granted = await this.recorder.requestPermission();
if (!granted) {
this.setStatus(this.webcamStrings.accessDeniedStringProperty.value);
return;
}

await this.populateCameras();
await this.recorder.startPreview(this.previewElement, this.cameraSelect.value || undefined);
this.clearStatus();
this._startButton.enabled = true;
} catch {
this.setStatus(this.webcamStrings.accessDeniedStringProperty.value);
return;
}

await this.populateCameras();
await this.recorder.startPreview(this.previewElement, this.cameraSelect.value || undefined);
this.clearStatus();
this._startButton.enabled = true;
}

// Reset visibility to preview phase without touching the camera stream.
Expand Down Expand Up @@ -425,7 +429,7 @@ export class WebcamPanel extends Node {
blob = fixed.blob;
duration = fixed.duration;
} catch {
// Fall back to the raw blob with unknown duration
this.clearStatus(); // Metadata fix failed; continue with raw blob and unknown duration
}
}

Expand Down