hi
i am trying to play a local audio file inside my webview but the file is not loaded.
i am able load the file from url but i want to allow the user to download the file and play it if he has not internet connection (offline play)
i use this in my webview:
i pass the url to the html code and try to play it.
the file url i get like this:
the log looks like this:
but the player looks like it is not able to load the file (it is grey)
before i load the player i make sure that the file exists in the folder (xui.DefaultFolder)
if i load it from online url it works.
i read that it is not possible to access local files from webview but i dont think it is true since i can do it with images but audio files do not work. maybe the url is not correct?
thanx
i am trying to play a local audio file inside my webview but the file is not loaded.
i am able load the file from url but i want to allow the user to download the file and play it if he has not internet connection (offline play)
i use this in my webview:
HTML:
<!DOCTYPE html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<head>
<meta charset="UTF-8">
<title>${title}</title>
</head>
<body>
<div id="main">
<img id="img" src="data:image/jpg;base64, ${base64image}"/>
<div>
<audio controls controlsList="nodownload" id="audioplayer">
<source src="${url}" Type="audio/mp3"> <------ HERE IS THE URL
</audio>
</div>
</div>
</body>
</html>
"$
i pass the url to the html code and try to play it.
the file url i get like this:
B4X:
Dim url As String = xui.FileUri(File.Combine(xui.DefaultFolder,"mp3"),m.Get("filename"))
Log("fileurl: " & url)
the log looks like this:
fileurl: file:///data/user/0/www.sagital.halachaan/files/mp3/9InfwtcS.mp3
but the player looks like it is not able to load the file (it is grey)
before i load the player i make sure that the file exists in the folder (xui.DefaultFolder)
if i load it from online url it works.
i read that it is not possible to access local files from webview but i dont think it is true since i can do it with images but audio files do not work. maybe the url is not correct?
thanx