Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Save snapshot button #524

Closed
dbuezas opened this issue Jul 11, 2023 · 2 comments · Fixed by #527
Closed

Feature request: Save snapshot button #524

dbuezas opened this issue Jul 11, 2023 · 2 comments · Fixed by #527
Labels
enhancement New feature or request
Milestone

Comments

@dbuezas
Copy link
Contributor

dbuezas commented Jul 11, 2023

Parts of this snippet may be handy
https://gist.github.com/lukejacksonn/a5dd4bb03dc8dad3d489379fd5d26339

@AlexxIT AlexxIT added the enhancement New feature or request label Jul 11, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Jul 11, 2023

VideoRTC has similar code

onmp4() {
/** @type {HTMLCanvasElement} **/
const canvas = document.createElement('canvas');
/** @type {CanvasRenderingContext2D} */
let context;
/** @type {HTMLVideoElement} */
const video2 = document.createElement('video');
video2.autoplay = true;
video2.playsInline = true;
video2.muted = true;
video2.addEventListener('loadeddata', () => {
if (!context) {
canvas.width = video2.videoWidth;
canvas.height = video2.videoHeight;
context = canvas.getContext('2d');
}
context.drawImage(video2, 0, 0, canvas.width, canvas.height);
this.video.controls = false;
this.video.poster = canvas.toDataURL('image/jpeg');
});
this.ondata = data => {
video2.src = 'data:video/mp4;base64,' + VideoRTC.btoa(data);
};
this.send({type: 'mp4', value: this.codecs('mp4')});
}

@AlexxIT AlexxIT added this to the v3.3.0 milestone Aug 24, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Aug 24, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants