Videos stopped playing in Android Webview

601 views
Skip to first unread message

Soy Yo

unread,
Jul 23, 2020, 7:11:38 AM7/23/20
to android-webview-dev
I'm desperate.

I have a Android Webview application. Everything was working fine but then one day after some update in Android or Webview videos stopped to play.

I am not an Android developer. I paid to someone in Freelancer to fix the problem but then the problem disappered itself without fixing anyhing.

After a few months I started to receive support requests from my users that videos are not playing in the app.

I checked it on 2 my phones and videos were playing just fine but after a few days the problem appeared on my phones too.

I upload original mp4 video file to the server and it plays in all browsers, including Android webview app but if I resize it with avconv, it doe snot play.

<video class="video" id="bVideo" controls autobuffer> <source src="video.mp4" type="video/mp4"> Your browser does not support the video tag. </video>  

I have read in Stackoverflow that in some cases adding "controls autobuffer" may help. But it does not help.

I tried to access video file by clicking on a link: 

<a href="video.mp4">Video</a> 

but video does not play.

But I need to resize videos to make them smaller.

After risizing videos play in all browsers, except Android web view. Whats wrong with this? 

$resized = exec("avconv -y -i $file -map 0 -c:v libx264 -crf 22 -filter:v scale=\"750:trunc(ow/a/2)*2\" -c:a copy $file2");  

Soy Yo

unread,
Jul 25, 2020, 12:43:48 PM7/25/20
to android-webview-dev, Soy Yo
I had this code in my app:

public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
aswm_view("file:///android_res/raw/error.html", false);
}

When video started to play I got just error.html file

I changed the code to:

public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
Toast.makeText(getApplicationContext(), "Something Went Wrong!", Toast.LENGTH_SHORT).show();
}

now videos are playing but when a video starts appears message "Someting went wrong". What went wrong if the video is playing?
How can I debug this problem?

Thanks.
Reply all
Reply to author
Forward
0 new messages