hi..
I am playing video in webview. when i take a screenshot it turns black. Does this mean that you can't capture screenshots in videos?
B4X:
......................
Bmp.Initialize3(WebViewExtras1.CaptureBitmap)
Dim Out As OutputStream
Out = File.OpenOutput(dir, "image.png", False)
WebViewExtras1.CaptureBitmap.WriteToStream(Out, 100, "
Out.Close
............................
here is 1 solution. for whatever reason, it was easier for me to do it this
way. it took 5 minutes to find the snippets in my tool box for cobbling
together.
i chose to capture the image as a jpg. should work for a .png. probably
even better and faster for a .webp.
you need webviewextras to excecute the javascript. you should also
add webviewextra's chromeclient (for possible debugging). i chose to
use marco romo's base64encodedecode library. i was curious about it.
you can roll your own or search for something in the forum.
i chose to skip over saving the bitmap to file. you can put that back in.
should be clear. worked for me. sample image attached showing webview
screen capture under the "capture" button. you can resize to suit.
am also attaching my version of your zipped archive.
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
if you ran my example, that couldn't have happened. so i'm guessing you forgot to copy and paste correctly. it looks like you forgot:
B4X:
wvx.addJavascriptInterface(WebView1,"B4A")
doesn't have to be "B4A"; that's just the convention we use. whatever it is, it has to be the same in the snippet above AND in the javascript snippet.
for simplicity, we use "B4A".