Skip to content

Commit

Permalink
fix: switch camera source output format to JPEG to make it shrinkable
Browse files Browse the repository at this point in the history
  • Loading branch information
nd0ut committed Feb 29, 2024
1 parent 95f0287 commit 6da4212
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions blocks/CameraSource/CameraSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,19 @@ export class CameraSource extends UploaderBlock {
this._canvas.width = this.ref.video['videoWidth'];
// @ts-ignore
this._ctx.drawImage(this.ref.video, 0, 0);
let date = Date.now();
let name = `camera-${date}.png`;
const date = Date.now();
const name = `camera-${date}.jpeg`;
const format = 'image/jpeg';
this._canvas.toBlob((blob) => {
let file = new File([blob], name, {
lastModified: date,
type: 'image/png',
type: format,
});
this.addFileFromObject(file, { source: UploadSource.CAMERA });
this.set$({
'*currentActivity': ActivityBlock.activities.UPLOAD_LIST,
});
});
}, format);
}

async initCallback() {
Expand Down

0 comments on commit 6da4212

Please sign in to comment.