Hot to get live streaming data in android - android

I am trying to make an app which gets livestreaming camera videos. I can stream my webcam from my laptop on the ip (for example ip:176.33.226.53:8070), by using the 1AVStreaming program but I can't reach the streaming video in my code.

Media Player can directly work with the url itself.
Look for something like
Uri myUri = Uri.parse("http://your/video/file/path");
MediaPlayer player = new MediaPlayer();
player.setDataSource(context, myUri);
player.prepare();
Use MediaPlayer.OnPreparedListener to show controls or start the video
Their are various examples available. Just Google It

Related

How to control remote rtsp server using playbin

I'm working with gstreamer and I can play RTSP stream using below code:
data->pipeline = gst_parse_launch("playbin", &error);
//avi.sdp is a video file that in server
g_object_set(data->pipeline, "uri", "rtsp://192.168.1.1/avi.sdp", NULL);
When stream playing , i can pause it,
gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
then when I set playing again, it restart playing!
gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
is playbin support rtsp stream play & pause? if not, how can I implement this?

URl not played in android MediaPlayer

I'm working media palyer app, in this i need to stream audio from URL. In my case some URL's are not streamed in some devices (Eg. Samsung Note III), after a long time i got this error message in onError() method.
E/MediaPlayer(24445): error (1, -1004)
I used the following code to pay url.
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(songPreViewUrl);
mediaPlayer.setOnPreparedListener(BackgroundAudioService.this);
mediaPlayer.setOnCompletionListener(BackgroundAudioService.this);
mediaPlayer.setOnBufferingUpdateListener(BackgroundAudioService.this);
mediaPlayer.prepareAsync();
Can any one please share the suggestion, why the urls are not streams in Samsung devices.

Streaming m3u8 HLS Audio on Android

i've found problems trying to reproduce m3u8 HLS audio streaming on Android. Right now i can reproduce video in m3u8 HLS link with:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(contentURL),"video/mp4");
startActivityForResult(i,0)
I've already tried this method:
number 1:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(contentURL),"video/mp4");
startActivityForResult(i,0)
number 2:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(contentURL),"audio/mp3");
startActivityForResult(i,0)
number 3:
MediaPlayer mediaPlayer = MediaPlayer.create(this, Uri.parse("http:\\testexample.m3u8"));
mediaPlayer.start();
In case 3 the error on log like "mediaserver Died", in case 1 and 2 simply the phone gallery said "can't reproduce video" or "can't reproduce this kind of file".
Last but not the least, if i send the http m3u8 link with an email at a Nexus 4 with Android 4.3, it open the link with chrome, then ask to open phone galleryplayer, and reproduce it. The same thing done with da SII with cyanogenmod and android 4.2.1 said, as before, "cannot reproduce video".
Put your code In try-catch block.
Set onPreparedListenet() and prepareAsync(), then on the onPrepared() callback start playback.

live audio streaming in android

I am facing problem to play a audio url using MediaPlayer as well as native Android audio player.
Here is my url
http://live.politiafm.com:8500/politiafm.mp3
Here is my code
Using native audio player
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(STREAM_URL), "audio/*");
StartActivity(intent);
Using Media Player
MediaPlayer mp = new MediaPlayer();
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.create(Landing.this, Uri.parse(STREAM_URL));
mp.prepareAsync();
mp.start();
In both the cases audio is not playing. Can some body help me out from this trouble.
Thanks & Regards
I guess it is to late a reply but in case if you are still facing the same problem,
you need to enable mime type for your server based on the type of the server. The MIME types are something you can learn from here how to enable them for Tomcat Server, IIS Server or Apache, whichever your mp3 file is hosted on : http://www.developershome.com/wap/wapServerSetup/tutorial.asp?page=settingUpMIME
Thanks
try changing
mp.prepare();
not
mp.prepareAsyunc();

Playing audio file into the call android

Say I make a call to someone with my android phone.
Is it possible to play some audio file into the call?
I just tried like this
if(state==TelephonyManager.CALL_STATE_OFFHOOK){
AudioManager am = (AudioManager) pccontext.getSystemService(Context.AUDIO_SERVICE);
am.setMode(AudioManager.MODE_NORMAL);
am.setSpeakerphoneOn(true);
MediaPlayer mp = MediaPlayer.create(pccontext, R.raw.beep);
mp.start();
}
But its not working in MODE_NORMAL. When I tried with MODE_IN_CALL phone is playing the audio but caller on the other side is not able to listen the audio played by the receiver phone.
Unfortunately, it is not possible, it is an Android security limitation.

Categories

Resources