i got this error error-1-2147483648-on-android while using media player to play audio file specifcally from server using remote url structure like http://remoteserver/file.mp3
i have generated xml file using bunch of mp3 files links as format below
<menu>
<item>
<name>
my file name
</name>
<link>
http://remoteserver/file.mp3
</link>
</item>
<item>
<name>
my file name
</name>
<link>
http://remoteserver/file.mp3
</link>
</item>
</menu>
as you see i parse the xml file and use links in my media player to play from specefic url i got above said error i tried and searched a lot though google and stackoverflow and tried all sorts of method mp.setdatasource(context,uri) and mp.setdatasource(link)
error was at mp.prepare() finally after hours of hecktick work i found the solution while reading from xml
links his having some white spaces infront and back of it so i used simple trim() and it worked
so solution is to use trim() link.trim() before set it as media data source
i have generated xml file using bunch of mp3 files links as format below
<menu>
<item>
<name>
my file name
</name>
<link>
http://remoteserver/file.mp3
</link>
</item>
<item>
<name>
my file name
</name>
<link>
http://remoteserver/file.mp3
</link>
</item>
</menu>
as you see i parse the xml file and use links in my media player to play from specefic url i got above said error i tried and searched a lot though google and stackoverflow and tried all sorts of method mp.setdatasource(context,uri) and mp.setdatasource(link)
error was at mp.prepare() finally after hours of hecktick work i found the solution while reading from xml
links his having some white spaces infront and back of it so i used simple trim() and it worked
so solution is to use trim() link.trim() before set it as media data source
No comments:
Post a Comment