Reputation: 9
I'm using MediaPlayer library to stream some audio files from my server. The problem is when I want to play ogg audio file with media player in android version 4.2.2 and it's ok when I play it in android nougat. It gives me this error while preparing ogg audio file:
E/Tag: Prepare failed.: status=0x106
E/MediaPlayer: error (1, -2147483648)
E/MediaPlayer: Error (1,-2147483648)
E/MediaPlayer: stop called in state 0
Is there any alternative way to stream ogg format in all devices? by the way there is no problem with playing mp3 files in all android versions I'v tested.
Thank you ...
Upvotes: 0
Views: 1813
Reputation: 111
First you should add <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Then set data source, maybe:
mp = new MediaPlayer();
mp.setAudioStreamType(AudioManager.STREAM_RING);
will help;
And of course prepare file before start:
mp.prepare();
mp.start();
Upvotes: 0