android - InputStream of mp3 file to MediaPlayer -
my humble mp3 file:
and code play mp3 file: (i file doesnt exist error )
mediaplayer mp = new mediaplayer(); fileinputstream fis = (fileinputstream) getassets().open("skase.mp3"); mp.setdatasource(fis.getfd()); mp.prepare(); mp.start();
you missing part of path. path providing assumes mp3 straight in assets folder not. it's insude tracks folder in assets folder.
here's need:
fileinputstream inputstream = (fileinputstream) getassets().open("tracks/skase.mp3");
android media
No comments:
Post a Comment