Closed rajathongal closed 3 years ago
@rajathongal could you share some sample code how you're using the component?
The getScreenshot
method returns a base64 string not an object.
@rajathongal could you share some sample code how you're using the component?
The
getScreenshot
method returns a base64 string not an object.
Thank you for the response, I have resolved the issue, regarding the return method when I consoled i got object. here is what I did to resolve
var imgaeString = JSON.stringify(imgSrc);
var buf = Buffer.from(imgSrc.replace(/^data:image\/\w+;base64,/, ""),'base64')
body: buf,
ContentType: imageString.split('"data:')[1].split(';')[0],
ContentEncoding: 'base64'
and now for showing the image
u8 - unint8Array
const tobase64 = (u8) => {
return btoa(String.fromCharCode.apply(null, u8));
}
var base64Flag = `data:${img.ContentType};base64,`;
var imgConverted = tobase64(img.Body)
setImage(base64Flag + imgConverted);
Bug reports:
the data returned from react webcam is of object type but when stored in s3 bucket and retrieved it is not possible to view the image as it is not binary or base 64, please do guide