Android Media Player Streaming issue on Samsung Devices - android

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.

Related

HD Video Playback issue with android things

Has anyone been able to successfully play a HD video using Android Things on a Raspberry Pi? If so was there anything special you had to do to get it to work? If not does any one know why it isn't working?
I made a simple video player that plays a local video from disk. The app runs fine on a phone but with android things maximum frames are getting dropped.
I am using ExoPlayer for the video playback and the same issue is observed when Media Player is used.Hardware acceleration is also enabled in the manifest file.

Icecast: pause in the beginning of streaming on Android

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.

VideoView fails to play video on certain devices

After recording a .mp4 video from a Samsung Galaxy S4 and uploading it to a server, I try to stream it on my Nexus 5 device in a VideoView which fails and Logcat shows this
E/MediaPlayer﹕ Error (1,-2147483648)
D/MediaPlayer﹕ Couldn't open file on client side, trying server side
The video turns out to be around 4.82mb and is recorded via intents
//VIDEO CAMERA
Intent cameraIntent = new Intent( MediaStore.ACTION_VIDEO_CAPTURE);
cameraIntent.putExtra( MediaStore.EXTRA_DURATION_LIMIT, 20);
cameraIntent.putExtra( MediaStore.EXTRA_VIDEO_QUALITY, 1 );
startActivityForResult( cameraIntent, TAKE_VIDEO_REQUEST_CODE );
The recorded video is playing properly on the Samsung device, and also when I download the file from the server to my PC it plays properly. I have tried downloading the file to my Nexus device and it still fails to play, tried to stream it within the VideoView and it fails with errors mentioned above each time. I have tried uploading a video from Nexus 5 and the Samsung device plays it properly. I am at a lost as to why this is happening, has anyone encountered a similar problem and found a fix or maybe I am doing something wrong?
Edit
It fails to play in any of the systems video players as well, but still plays on the original Samsung device.
Also I have tested a lower resolution and it works then, so now I think I need to find a way to change the resolution after video capture or send an instruction to use a certain resolution if possible. Any help with this aspect?
These messages are not indicative of an error:
E/MediaPlayer﹕ Error (1,-2147483648)
D/MediaPlayer﹕ Couldn't open file on client side, trying server side
You get these because streaming content can only be opened on the server side. You should get another error after these, e.g. Error (1,-1001). Most likely the S4 uses a profile that is not supported on Nexus 5.
As for resolution, the intent API you are using only supports 2 quality settings (high and low). Low means really low, and is device dependent.
To have more control over a video capture, you could use the Camera and the MediaRecorder interface. There is a guide at http://developer.android.com/guide/topics/media/camera.html#capture-video.
For a more advanced example, there is a sample project at http://developer.android.com/samples/MediaRecorder/index.html.

How to Control media player android while Playing Rtsp Link on Samsung Galaxy S3?

I have made a small app for playing live stream.It is working good on other devices but on Samsung Galaxy S3 can not control the media player. I am using media player using the following code
sdrPlayer = new MediaPlayer();
sdrPlayer.setOnErrorListener(video.this);
sdrPlayer.setOnCompletionListener(video.this);
sdrPlayer.setOnPreparedListener(video.this);
sdrPlayer.setOnBufferingUpdateListener(video.this);
sdrPlayer.setDataSource(video.this, Uri.parse(url));
sdrPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
sdrPlayer.setScreenOnWhilePlaying(true);
sdrPlayer.prepareAsync();
but media player is throwing the issue media player error (1, -110) but I do not know the meaning of this error and also there is no proper documentation. I found this documentation but I can not get the error and also media player starts playing a bit late after calling start function in on prepare listener.I can not control the pause and play of the stream.
Any kind of help will be highly appreciable.
It is not enough of information. I think adding more code, may be even full file, would help. As per my experience, S3 is less troublesome device on playing rtsp streams, I have created rtsp player too. You might have done something wrong. Let's also ask what the stream you are trying to play, hls, anything else?
You could also do the following:
try to play the stream with some desktop player: quicktime, mplayer.
Do they play it right?
try to validate the stream with one of those rtsp streams validators, do they find it ok?

Playing shoutcast live radio url in samsung phones

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.

Categories

Resources