bugfix
This commit is contained in:
parent
b61af304a9
commit
b216d0ad1f
@ -132,13 +132,19 @@ bricks.SysVideoRecorder = class extends bricks.MediaRecorder {
|
|||||||
this.preview.add_widget(this.imgw);
|
this.preview.add_widget(this.imgw);
|
||||||
this.task = schedule_once(this.show_picture.bind(this), this.task_period);
|
this.task = schedule_once(this.show_picture.bind(this), this.task_period);
|
||||||
}
|
}
|
||||||
|
get_camera_size(){
|
||||||
|
const track = stream.getVideoTracks()[0];
|
||||||
|
const settings = track.getSettings();
|
||||||
|
return [settings.width, settings.height]
|
||||||
|
}
|
||||||
show_picture(){
|
show_picture(){
|
||||||
if (this.task_period == 0){
|
if (this.task_period == 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
canvas.height = this.video.videoHeight;
|
var size = this.get_camera_size();
|
||||||
canvas.width = this.video.videoWidth;
|
canvas.height = size[1];
|
||||||
|
canvas.width = size[0];
|
||||||
const context = canvas.getContext('2d');
|
const context = canvas.getContext('2d');
|
||||||
context.drawImage(this.video, 0, 0);
|
context.drawImage(this.video, 0, 0);
|
||||||
this.dataurl = canvas.toDataURL('image/jpeg', 0.95);
|
this.dataurl = canvas.toDataURL('image/jpeg', 0.95);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user