Android Kitkat Webview Plays Only the Sound of the Video - android

Before you downgrade I know there are similar questions related to this topic when you google it. Even it had been answered for several times here in Stackoverflow.
Yet although I read all of those topics none of them solved my problem. My code works great for Jelly Bean, lollipop and marshmallow variations. Only for kitkat it is impossible to play a video via webview. For example on Youtube you can hear the audio but you can't see the video at all. This is also happening in vimeo.You can see in this screenshot from emulator. I can actually listen the audio but cannot see the video.
I know with 4.4.4 Webview started using chromium. I know I should add this: mWebView.setWebChromeClient(new WebChromeClient(){}); Also I should add android:hardwareAccelerated="false" to my manifest file. However when accelaration is false video never loads. If I add android:hardwareAccelerated="true" This time audio comes but video doesn't appear.
At last I am still unable to play videos. If you could help me with this I will very much appreciate it. Thanks in advance.
If it helps these are some of the error logs:
E/chromium: [ERROR:gles2_cmd_decoder.cc(5942)] [.Compositor-Onscreen-0xb8bb47f8]GL ERROR :GL_INVALID_OPERATION : glUseProgram: program not linked
E/chromium: [ERROR:gles2_cmd_decoder.cc(5718)] [.Compositor-Onscreen-0xb8bb47f8]GL ERROR :GL_INVALID_OPERATION : glUniformMatrix4fv: wrong uniform function for type

Set software Accelerated in webview activity,
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

Related

Picture is too late to be displayed VLC Android

I used libvlc in my android application and I got it to work. The problem now is, it keeps giving me an error of:
core video output: picture is too late to be displayed (missing 29787 ms)
Using the VLC player, I don't get any lags. What seems to be the problem?
Are you using any LibVLC options? If not, you should. Here is what VLC for Android uses https://github.com/videolan/vlc-android/blob/master/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
My guess is you have not properly configured hardware decoding, which leads to the video output displaying the picture later than it should.

Can't play video VideoView Android 12 (error (1, -2147483648))

I have an app with a VideoView to display an MP4 file. Everything was working perfectly fine, on all devices and all Android versions, until Android 12.
We have one user reporting that the VideoView is unable to play the videos, for every video he gets the following popup (the app doesn't crash, just this popup is shown):
My question: does anyone know what the problem might be? I'm expecting - or hoping - it has to do with the fact that it's the beta version of Android 12. If that's not the case, then how can I solve this issue? Anything that changed for Android 12 w.r.t. displaying videos?
Many thanks.
EDIT: The video files are located in local storage (R.raw folder)
EDIT 2: When running the emulator with Android 12, I get the MediaPlyaer error (1, -2147483648). This corresponds to MediaPlayer.MEDIA_ERROR_UNKNOWN and UNKNOWN_ERROR respectively, as explained in this SO post. However, the proposed solutions there don't solve the problem here (the format should not be the issue, since they are .mp4 files). Any ideas?
EDIT 3: I submitted an issue with Google about this. If you're interested in a solution, star it here. Hope we can find the cause soon!
What fixed it was saving the video in AVC/H264 format and using that file.
From reporting this issue on Google's Issuetracker here, it turned out that the problem was actually with the encoding of the video files in this case. The video that wasn't playing was encoded in MPEG-4 format (.mp4) and exceeded the capabilities of the MPEG-4 software decoder.
I don't know why this wasn't an issue before Android 12 (videos were playing fine before), but at least this does fix the issue.

Android Youtube : Video turns black

I was working on YouTube player in my Android app using the Javascript API. I had faced some issue, which I raised on a separate question:
https://stackoverflow.com/questions/34786950/android-youtube-remove-buffering-indicator
I have faced another problem that sometimes on Samsung Note 4, the Youtube video becomes invisible, though the webview for Youtube is visible. Here are a couple of screenshots:
As evident from the screenshot, the YouTube ads and subtitles are completely visible, but the video itself is not.
Can anyone point out a solution, or a possible cause why this is happening?
PS : I have not added the code in this question, because the code is the same as this question : https://stackoverflow.com/questions/34786950/android-youtube-remove-buffering-indicator

Hardware accelerated Android Webview crashes on multiple devices + HTML5 video issue

I'm using WebViews in my apps, and many users reported some issues. It appears that most of them seem to happen on 4.1.1, not before.
The configuration:
A Webview, inside a HW accelerated activity.
JS enabled, Plugins enabled, File access enabled, DOM storage enabled.
Custom WebChromeClient and WebViewClient.
Webview has a transparent background (0X00000000) but removing it seems to have no good improvement.
The problem:
Random black outs when showing some URLs: black out meaning, the activity just dies, there is no JAVA exception.
Usually, logs report a SIGSEGV, in glDrawArrays(), but could also be somewhere else (not enough information from users).
A workaround?
Simply disable the HW acceleration on the webview! Yeah, no more black out, that's right... But then (even if we consider this workaround is just so so, as the display performance decreases quite a lot):
A new problem:
Without HW acceleration, HTML5 videos (youtube) are not working: Sound starts, but video doesn't.
A solution could be to catch a playback starting event, to make the video play in a videoView, the same way we can do for fullscreen playback (using onShowCustomView, see Playing HTML5 video on fullscreen in android webview). Nevertheless, I'm currently not able to catch such an event. Please note that I'm not owner of the HTML pages, and the HTML code cannot be changed to append some kind of Javascript code in it.
Questions:
Does anyone has the same kind of crash, using HW acceleration + webview, on many devices? If so, how do you solve that?
About the workaround, deos anyone know how to solve this problem? Would be great to do like on IOS: clicking on the does not try to play the video inline, but instead it just opens the video application.
Thanks for reading!

Android SoundPool logs info as error

I'm developing an Android App using the SoundPool. Every time I play a sound, an error gets logged in LogCat of the type:
E/SoundPool(11873): sampleID=33, leftVolume=0.779528, rightVolume=0.779528, priority=1, loop=0, rate=1.000000
What does this error mean? Is it possible to disable these logs, I guess logging these errors is quite time consuming since I play a lot of sounds.
Thanks
I'm using API 8 and test the App on a Samsung Galaxy S Plus with Android 2.3.6
A took a quick look over the SoundPool class and didn't find anything immediately, but you should definitely look into what type of audio files you are playing. I think you should try maybe uncompressed file types like .wav to see if that alleviates the problem.

Categories

Resources