Skip to content

Commit 5379545

Browse files
authored
fix(browser): Make data uri be returned as actual URI strings (#912)
1 parent 2eaa9a3 commit 5379545

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/browser/CameraProxy.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function takePicture (success, error, opts) {
3939

4040
const imageData = readerEvent.target.result;
4141

42-
return success(imageData.substr(imageData.indexOf(',') + 1));
42+
return success(imageData);
4343
};
4444

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

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

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

0 commit comments

Comments
 (0)