Ashley
Hi, Ashley
I'm making screen capture plugin.
I made this code by IntelRobert 's help, but still can't capture screen (c2canvas canvas capture).
By which canvas, can I take base64 string?
I need your help.
Thanks
See the code below:
//cranberrygame start
Acts.prototype.SaveScreenCaptureToImageFile = function ()
{
/*
//works <============
var c = document.createElement("canvas");
c.width = 150;
c.height = 75;
var ctx = c.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,75);
var base64 = c.toDataURL();
var img = document.createElement("img");
img.src = base64;
//document.body.appendChild(img);
document.getElementById("c2canvas").parentNode.insertBefore(img, document.getElementById("c2canvas"));
*/
//works in phonegap but don't work in crosswalk android: black screen capture <============
var c = document.getElementById("c2canvas");
var base64 = c.toDataURL();
var img = document.createElement("img");
img.src = base64;
//document.body.appendChild(img);
document.getElementById("c2canvas").parentNode.insertBefore(img, document.getElementById("c2canvas"));
};
//cranberrygame end
[/code:3r1ietn5]