Comments (6)
Happened the same to me. Using the android emulator (Nexus 5 API 22) the canvas is visible, but not in my smartphone (android 6.0.1).
from cordova-screenshot.
Same problem
from cordova-screenshot.
A way to overcome this is using a img element instead of a canvas, and put a canvas capture as the src attribute of the image.
from cordova-screenshot.
@matiasmicheletto is that supported by the plugin?
from cordova-screenshot.
@satheeq The plugin works well with different html elements but somehow it fails when capturing canvas drawings. Because there is no problem on capturing img images you can use one of these instead of a canvas.
Depending on whether the canvas has dinamic or static content, the img element can be visible and the canvas an auxiliary hide element or the img be an auxiliary element that turns visible only at the time of taking the capture.
For example:
html file:
...
<img id="auximg"/>
...
js file:
...
var cvs = document.createElement('canvas'); // Create a canvas or use existing
...
// Draw on the canvas
...
var auximg = document.getElementById('auximg'); // Get the img element
// Set the image dimensions (not sure if required)
auximg.width = cvs.width;
auximg.height = cvs.height;
auximg.src = cvs.toDataURL(); // Pass the canvas content to the img element
...
If the img is an auxiliary element that turns visible only during the screen capture, it is necessary to give a few milliseconds before perfoming the screenshot. Use setTimeout.
Hope this help.
from cordova-screenshot.
That worked well.
Thanks alot @matiasmicheletto
from cordova-screenshot.
Related Issues (20)
- Camera Preview not captured HOT 2
- Google maps marker, directions and route not captured HOT 3
- I got black image as screenshot in android 5+ Versions HOT 1
- screen capture of video element (html5 video) comes in as black HOT 2
- not able to install via cordova HOT 4
- Cannot capture chart? HOT 1
- Multiscreen wrong focus capture
- How Do I get correctly the Url and display on IOS? HOT 2
- custom quality ?
- how to change the path ?
- Remove permission from URI function HOT 3
- Feature request :: Saving to custom folder
- Cordova plugin install; nog git binary found HOT 2
- do not save image return as base64 HOT 1
- Missing SVGs
- Cordova 9 support HOT 1
- Screenshot plugin does not compile
- Can't found URI in null
- Cannot read property URI of undefined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-screenshot.