This extension uses a trick involving drawing the GM canvas onto another canvas to get base64 of it, but surfaces are not canvases on WebGL.
I think your best bet would be to grab pixels using buffer_get_surface, then grab a raw buffer object (Uint8Array I think? Or maybe ArrayBuffer) using buffer_get_address, then convert those pixels into ImageData, then putImageData it onto canvas, and then you can finally get base64 of it and use the rest of the existing code.