I am building an app that playing live radio stream using android mediaplayer class(not using open source nagare project). The stream is playing fine in emulator and g1 phone. But when I tested the app on my samsung galaxy i9003 phone it did not work and it throws exception prepare called in wrong state. Do samsung phone have trouble playing live radio url. If anybody have experience playing live radio stream using mediaplayer please give your suggestions.
Thanks
By default android does not support m3u formats with URL. So, it needs to be implemented explicitly. may be in G1 it is implemented. In any case the codec used in case of Samsung is samsung specific and different from the one used in G1, so can be some issue with their codec. Can you share your code with me? I will try to fix the problem.
I wrote an app for playing radio stream (tried with shoutcast) using android MediaPlayer class and tested the application on samsung nesus. It is working fine for me. So, may be there is some issue with your code where you are doing playlist parsing. You can just have a relook into the parsing code.
Related
I am developing and testing an app which does playing a pcm file and recording the sound to a new pcm file at the same time on galaxy s4. I want to use both mics of this phone, but I have found that the data I got in my way are the same. This means the data I get are just replication of the same mic.
I used the AudioRecord class and AudioFormat.CHANNEL_IN_STEREO to record sound. I used the method described by Michael in this link How to access the second mic android such as Galaxy 3 to try to get both mic's data. However, it seems that it does not work because they are the same data.
I am wondering how can I use the other mic of this galaxy s4?
Any thoughts or comments are welcomed. Thanks a lot.
I think I have found the solution.
I solved it by referencing the answer to this question, Visit How can I record 2 microphone in Android simultaneously?
I have a server Icecast working with Liquidsoap to stream internet radio and I noticed there is a problem with receiving the music on some Android devices (Samsung Galaxy tab, for example) - after a few seconds of buffering of the music the playing of the music starts for about a second, then it abruptly stops, then there is a silence for a few more seconds, and only after that it starts playing normally. On some other Android devices, like HTC desire - no such thing occurs - music starts playing normally after the bufferization.
Here is the example of the stream in question: http://rdsradio.ru:8000/4th.mp3
That happens when I open the link in the browser (Google Chrome) on the Android device. With the same result I connected to the Icecast stream from the Android app, which I currently develop, using the android.media.MediaPlayer class: mediaPlayer.setDataSource("http://rdsradio.ru:8000/4th.mp3");
Also, even on those problem devices I could normally connect and listen the streams of other Icecast radio sources, like http://dancewave.hopto.org:9990/dance.mp3
- that is why I think there could be something wrong in my settings of Icecast + Liquidsoap - what makes that music stops playing in the beginning.
<burst-on-connect>1</burst-on-connect>
<burst-size>64000</burst-size>
I tried to change those parameters in /etc/icecast2/icecast.xml, like increasing the burst-size to 10-20 times or setting burst-on-connect to 0, but did not notice any difference at all (I run /etc/init.d/icecast2 reload after changing the parameters to reload the configuration).
Any idea - how to fix that behavior?
UPDATED: I tried to open the stream in VLC player on Android and it worked with no problem, so it seems the problem in using the android.media.MediaPlayer (probably the built-in HTML5 audio player in Google Chrome uses the same library). I will try to use a different Media Player in the app.
Actually, the solution was simple. The burst-size setting to 500000 in icecast.xml fixed the problem. Earlier I used /etc/init.d/icecast2 reload after changing the icecast.xml and for some reason I thought that the burst-size would also change in Icecast in the similar way, but it didn't happen. Only restart of icecast actually changed that setting.
I'm streaming the audio file (.mp3) from internet with Android Media Player.
It works quite well except Samsung Devices. As far as I see, it doesn't stream the audio but tries to download. It sometimes pushes Media Player Error (1 -1004). Nothing is getting played.
I also tried to redirect the Application to the Media Player with URL of audio file, it goes to Music Player application, indicating "Preparing..." for a while, but then It shows the message "sorry, player does not support this type of audio" with Toast.
Anybody else had the same error before ? Any advise to find a solution ?
Thanks.
There are some bugs in native sound libraries on Samsung Galaxy S2 for instance (look here). I had those problems (random crashes / freezes) and solved it by using OpenSL library for that specific case.
We are developing music streaming application for Android devices with adaptive bit rate support. We are using Wowza as streaming server which will stream songs using HLS. We have converted each song into four bitrates and have created smil files which are referred in HLS URLs. So basically final URL will look something like this.
http://streaming.server.name:1935/vod/smil:audiofile.smil/playlist.m3u8.
We have tested the app on multiple android devices ( Android version 4.0 or later ) including Galaxy S2, Galaxy Note I, Sony Experia, Google Nexus etc.. On all these devices the songs are getting streamed except on Galaxy S3. On Galaxy S3 the song starts and plays till 6 secs. After that the song goes in loop and plays again and again 6 sec part.
The same behavior is observed when the above URL is accessed through browser.
We have tried to check wowza logs but no errors were reported.
Has anyone tried such thing on S3 devices. Any guidance on how to debug this issue will be greatly appreciated.
The Android documentation states (not clearly enough though) that the TS container format only supports AAC audio. Your are trying to play HLS with TS segments containing MP3 audio data (which is supported by iOS).
I can share the observation that doing so works on most Android devices, but not on all.
The S-III is an example of that.
Please refer to the Android Supported Media Formats section in the documentation.
Using mediarecorder to record calls, with setting the audio source to
MediaRecorder.AudioSource.VOICE_CALL
does not work on Samsung Galaxy S2 (Android 2.3.4), in the application freezes and no recording is created (VOICE_UPLINK/VOICE_DOWNLINK both work, but only record up/downlink, not both party voice).
However, e.g. the CallRecorder application (from Android Market) does work (recording both party voices). So it's possible.
How is it done?
I am trying to record through AudioSource.CAMCORDER on a Galaxy S2, but I have the same issue; I get no samples. Actually, I tried to have two audio sources, .MIC and .CAMCORDER, recording separate samples, but I guess, just like khan said, .MIC will probably work.