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

fix(browser): Make data uri be returned as actual URI strings #912

Merged
merged 1 commit into from
Oct 27, 2024
Merged
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
5 changes: 2 additions & 3 deletions src/browser/CameraProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function takePicture (success, error, opts) {

const imageData = readerEvent.target.result;

return success(imageData.substr(imageData.indexOf(',') + 1));
return success(imageData);
};

reader.readAsDataURL(inputEvent.target.files[0]);
Expand Down Expand Up @@ -78,8 +78,7 @@ function capture (success, errorCallback, opts) {
canvas.getContext('2d').drawImage(video, 0, 0, targetWidth, targetHeight);

// convert image stored in canvas to base64 encoded image
let imageData = canvas.toDataURL('image/png');
imageData = imageData.replace('data:image/png;base64,', '');
const imageData = canvas.toDataURL('image/png');

// stop video stream, remove video and button.
// Note that MediaStream.stop() is deprecated as of Chrome 47.
Expand Down
Loading