Android Question mediaplayer with webview android 4.4.2 not working

joop

Active Member
Licensed User
Longtime User
I upgraded my samsung Tab 3 from 4.2.2 to kitkat 4.4.2 and now their is some strange behaviour.

When a button is pressed (html code) the mp3 file is loaded and played , but then a black screen
appears see the picture and stays on the screen

Kitkat 4.4.2 changed it's browser from webkit to chromium do I have to set something in
B4A or in HTML ?, I tried it with api 19 and 14 same result everything worked ok in 4.2.2 api 14.

Maybe someone has experienced this before and has a solution , or someone knows a
solution.?

HTML Code

HTML:
<img src="file:///android_asset/merel640.jpg" alt="merel.jpg"> <br>
    <input type="text"  value="Merel" readonly>
  <input type="button" class="knop"  onClick="parent.location='file:///android_asset/merelvak11025.mp3' " >
  <br> <br>

B4A code

B4X:
Sub WebView1_OverrideUrl(Url As String) As Boolean

Dim linkpart1,linkpart2,linkpart3,linkpart4  As String                            
               
'This SUB will grab the link the user clicked on and save it in URL
'bv 'file:///android_asset/sample.mp3'
' do something to show mp3 or pictures and utube
If Url.EndsWith("mp3") Then
  Url=Url.Replace("file:///android_asset/","") 'strip file:///android_asset
  Log(Url)
  Player.Load(File.DirAssets,Url)
  Player.Play
End If
 

Attachments

  • webview_output.png
    webview_output.png
    5.1 KB · Views: 173

joop

Active Member
Licensed User
Longtime User
No Erel, I am using the release(obfuscated) mode , the behaviour is something like this
- press the button on webpage
- the black screen is displayed with a small icon and the mp3 file is played.
- the icon on the sceen is some kind of play icon you can
press on it then it becomes a pauze icon press again than play and so on
nothing else happens
- the return button from tab can be use to close this black screen with icon but the webpage is also gone.
 
Upvote 0

joop

Active Member
Licensed User
Longtime User
Erel here is the test project:

Ofcourse the HTMLFiles must be put in the Webviewkit\Files directory
Somehow these files are not in the Zip from B4a
 

Attachments

  • WebViewkitkat4.4.2.zip
    7.9 KB · Views: 156
  • HTMLFiles.zip
    38.5 KB · Views: 195
Upvote 0

joop

Active Member
Licensed User
Longtime User
Yes thats it , strange that this mistake from me had no problems before 4.4.2 .
Thanks !
 
Upvote 0
Top