Why the data captured from the webcam gets modified if i put it in an image field:
a = canvas.toDataURL("image/jpeg")
document.getElementById("avatar").src = a
src
will be corrupted and will show only blank file, but when accessing to canvas.toDataURL("image/jpeg")
in console, i get healthy' image.
using:
document.getElementById("avatar").src
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMD…gAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//Z"
But:
a = canvas.toDataURL("image/jpeg")
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMD…vtP7ypIi8kA5zUDTCJSDyw7kUrOjzF0dmAOADSTFpJTJM49TxyaG3e0np6joNx0lHTp1+fY//Z"
the code is here