Rtsp Live Stream Android Player

All your problems with Audio, Video and Images.

Rtsp Live Stream Android Player

Postby filizgokce » Thu May 26, 2011 9:18 am

Hi, I try to make live stream on android, I try lots of ways, but none of them doesnt work. Could you help me ?

This is example of rtsp;
Code: Select all
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(KralStream.getTvStreamUrl().toString());
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepareAsync();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnVideoSizeChangedListener(this);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setLooping(true);


Exeption :05-26 10:22:46.186: ERROR/MediaPlayerService(10157): create PVPlayer 05-26 10:23:06.382: ERROR/PlayerDriver(10157): Command PLAYER_INIT completed with an error or info -1 05-26 10:23:06.382: ERROR/MediaPlayer(23800): error (1, -1) 05-26 10:23:06.382: ERROR/MediaPlayer(23800): Error (1,-1)


rtsp;

Code: Select all
VideoView videoView=(VideoView)findViewById(R.id.videoView1);
Uri uri = Uri.parse("rtsp://strm-3.tr.medianova.tv/rkraltv/rkraltv");
videoView.setVideoURI(uri);
videoView.start();


Gives message;"Sorry, this video connot ve played." Exeptions;05-26 10:40:08.979: ERROR/MediaPlayerService(10157): create PVPlayer 05-26 10:40:09.188: INFO/ActivityManager(10163): Displayed activity com.giantrabbit.nagare/.KralTvNow: 433 ms (total 433 ms) 05-26 10:40:11.702: WARN/PowerManagerService(10163): Timer 0x3->0x3|0x1 05-26 10:40:29.061: WARN/MediaPlayer(24284): info/warning (1, 26) 05-26 10:40:29.061: INFO/MediaPlayer(24284): Info (1,26) 05-26 10:40:29.100: ERROR/PlayerDriver(10157): Command PLAYER_INIT completed with an error or info -1 05-26 10:40:29.104: ERROR/MediaPlayer(24284): error (1, -1) 05-26 10:40:29.108: ERROR/MediaPlayer(24284): Error (1,-1)


rtsp;
Code: Select all
mPreview = (SurfaceView) findViewById(R.id.surface);
        holder = mPreview.getHolder();
        holder.addCallback(this);
        holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        extras = getIntent().getExtras();
public void play() {

        try {
            Uri video = KralStream.getTvStreamUrl();
            Toast.makeText(this, video.toString(), Toast.LENGTH_SHORT).show();
             mMediaPlayer = new MediaPlayer();
             mMediaPlayer.setDataSource(path);
             mMediaPlayer.setDisplay(holder);
             mMediaPlayer.prepare();
             mMediaPlayer.setOnBufferingUpdateListener(this);
             mMediaPlayer.setOnCompletionListener(this);
             mMediaPlayer.setOnPreparedListener(this);
             mMediaPlayer.setOnVideoSizeChangedListener(this);
             mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
             } catch (Exception e) {
                    Log.e(TAG, "error: " + e.getMessage(), e);
                }
    }


Exeption ;

05-26 10:36:57.589: ERROR/MediaPlayerService(10157): create PVPlayer 05-26 10:37:20.542: ERROR/PlayerDriver(10157): Command PLAYER_INIT completed with an error or info -1 05-26 10:37:20.542: ERROR/MediaPlayer(24240): error (1, -1) 05-26 10:37:20.565: WARN/PlayerDriver(10157): PVMFInfoErrorHandlingComplete 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): error: Prepare failed.: status=0x1 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): java.io.IOException: Prepare failed.: status=0x1 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.media.MediaPlayer.prepare(Native Method) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at com.giantrabbit.nagare.KralTvNow.play(KralTvNow.java:162) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at com.giantrabbit.nagare.KralTvNow.surfaceCreated(KralTvNow.java:215) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.SurfaceView.updateWindow(SurfaceView.java:536) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:339) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.View.draw(View.java:6796) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.widget.FrameLayout.draw(FrameLayout.java:352) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewGroup.drawChild(ViewGroup.java:1640) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.View.draw(View.java:6796) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.widget.FrameLayout.draw(FrameLayout.java:352) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1894) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewRoot.draw(ViewRoot.java:1407) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.os.Handler.dispatchMessage(Handler.java:99) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.os.Looper.loop(Looper.java:123) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at android.app.ActivityThread.main(ActivityThread.java:4627) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at java.lang.reflect.Method.invokeNative(Native Method) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at java.lang.reflect.Method.invoke(Method.java:521) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 05-26 10:37:20.682: ERROR/MediaPlayerDemo(24240): at dalvik.system.NativeStart.main(Native Method) 05-26 10:37:20.737: INFO/MediaPlayer(24240): Info (1,26) 05-26 10:37:20.737: ERROR/MediaPlayer(24240): Error (1,-1) 05-26 10:37:20.868: INFO/ActivityManager(10163): Displayed activity com.giantrabbit.nagare/.KralTvNow: 25864 ms (total 25864 ms) 05-26 10:37:23.777: WARN/PowerManagerService(10163): Timer 0x3->0x3|0x1


This is example of http ;

Code: Select all
mMediaPlayer = new MediaPlayer();
   mMediaPlayer.setDataSource("http://ikral.garantisistem.com:1935/ikral/smil:kral.smil/playlist.m3u8");
   mMediaPlayer.setDisplay(holder);
   mMediaPlayer.prepareAsync();
   mMediaPlayer.setOnBufferingUpdateListener(this);
   mMediaPlayer.setOnCompletionListener(this);
   mMediaPlayer.setOnPreparedListener(this);
   mMediaPlayer.setOnVideoSizeChangedListener(this);
   mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
   mMediaPlayer.setLooping(true);


Exeption:

05-26 10:16:24.276: ERROR/MediaPlayerService(10157): create PVPlayer 05-26 10:16:24.292: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferWriteDataStreamImpl 05-26 10:16:24.346: INFO/PlayerDriver(10157): buffering (100) 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.346: ERROR/(10157): IIIIIII Inside Constructor of PVMFMemoryBufferReadDataStreamImpl 05-26 10:16:24.350: WARN/MediaPlayer(23736): info/warning (1, 26) 05-26 10:16:24.354: ERROR/PlayerDriver(10157): Command PLAYER_INIT completed with an error or info -10 05-26 10:16:24.354: ERROR/MediaPlayer(23736): error (-10, -10) 05-26 10:16:24.354: WARN/PlayerDriver(10157): PVMFInfoErrorHandlingComplete 05-26 10:16:24.393: INFO/MediaPlayer(23736): Info (1,26) 05-26 10:16:24.393: ERROR/MediaPlayer(23736): Error (-10,-10)


Htttp;

Code: Select all
VideoView videoView=(VideoView)findViewById(R.id.videoView1);
Uri uri = Uri.parse("http://ikral.garantisistem.com:1935/ikral/smil:kral.smil/playlist.m3u8");
videoView.setVideoURI(uri);
videoView.start();


Gives message;"Sorry, this video connot ve played."
filizgokce
Freshman
Freshman
 
Posts: 8
Joined: Mon Oct 04, 2010 8:03 am

Top

Re: Rtsp Live Stream Android Player

Postby abhijitphatak28 » Wed Jun 01, 2011 8:45 am

Which kind of video file is this? You probably also need to check whether the codec is supported by your device.

Sometimes back, i played a RTSP stream succesfully on the device. I was using MP4 with H.264 and was using Darwing Streaming Server to stream video on Android device.

Thanks

Regards
-Abhijit
User avatar
abhijitphatak28
Senior Developer
Senior Developer
 
Posts: 102
Joined: Sat Feb 12, 2011 1:18 pm
Location: Indore

Re: Rtsp Live Stream Android Player

Postby filizgokce » Wed Jun 01, 2011 9:00 am

The video file type h.264 frame rate 50.
rtsp url is ;rtsp://strm-3.tr.medianova.tv/rkraltv/rkraltv
But ı dont know which server they used.
Also I play rtsp only when the mobile connection openned. If ı turned on wifi, ı couldnt play rtsp.
Why could be the problem? I tested on galaxy s 2.2 , huawe 2.3 , galaxy tablet 2.2 .
Also ı tested on acer tablet 3.0 , ıt ony played both of them ( wifi and mobile connection).
filizgokce
Freshman
Freshman
 
Posts: 8
Joined: Mon Oct 04, 2010 8:03 am

Re: Rtsp Live Stream Android Player

Postby abhijitphatak28 » Wed Jun 01, 2011 12:22 pm

Is this rtsp url is playable on VLC media player (or any other) on your desktop ?
User avatar
abhijitphatak28
Senior Developer
Senior Developer
 
Posts: 102
Joined: Sat Feb 12, 2011 1:18 pm
Location: Indore

Re: Rtsp Live Stream Android Player

Postby filizgokce » Wed Jun 01, 2011 1:21 pm

yes, of course. Iplayed it on pc vlc player.
I can play using edge or 3g connection on iphone, android devices.
But I couldnt play when wifi is open.
filizgokce
Freshman
Freshman
 
Posts: 8
Joined: Mon Oct 04, 2010 8:03 am

Re: Rtsp Live Stream Android Player

Postby abhijitphatak28 » Wed Jun 01, 2011 4:16 pm

Are you testing against company firewall ?

Check your WiFi is not retricting this URL to play.

Thanks

Regards
-Abhijit
User avatar
abhijitphatak28
Senior Developer
Senior Developer
 
Posts: 102
Joined: Sat Feb 12, 2011 1:18 pm
Location: Indore

Top

Re: Rtsp Live Stream Android Player

Postby raj_J2ME » Thu Jun 02, 2011 7:40 am

Hi,

Have you tried to play that file you store your file in the SD card and pass its own path?

otherwise maybe you need to set the display before preparing as such:

Code: Select all
mMediaPlayer = new MediaPlayer();
            mMediaPlayer.setDataSource(fileDescriptor.getFileDescriptor(), fileDescriptor.getStartOffset(), fileDescriptor.getDeclaredLength());
            mMediaPlayer.setDisplay(holder);
            mMediaPlayer.prepare();


those are the only ideas I have.
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Re: Rtsp Live Stream Android Player

Postby madhavanmaddy » Fri Jun 24, 2011 1:49 pm

hey can you please provide me the code of video streaming from android camera to vlc player on pc desktop
i am in major soup and i am in urgent need of it
please do help me please

thanks in advance
madhavanmaddy
Junior Developer
Junior Developer
 
Posts: 24
Joined: Wed Dec 15, 2010 7:04 am

Re: Rtsp Live Stream Android Player

Postby jinjian » Tue Aug 16, 2011 7:27 am

hi,i use mediaplayer to play rtsp strram ,but when displayed the video is later than the camera real time which i see in IE, do you konw why? thanks very much. :)
jinjian
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Aug 16, 2011 7:11 am

Re: Rtsp Live Stream Android Player

Postby khaitt » Tue Sep 06, 2011 6:04 pm

filizgokce wrote:The video file type h.264 frame rate 50.
rtsp url is ;rtsp://strm-3.tr.medianova.tv/rkraltv/rkraltv
But ı dont know which server they used.
Also I play rtsp only when the mobile connection openned. If ı turned on wifi, ı couldnt play rtsp.
Why could be the problem? I tested on galaxy s 2.2 , huawe 2.3 , galaxy tablet 2.2 .
Also ı tested on acer tablet 3.0 , ıt ony played both of them ( wifi and mobile connection).


I think problem is service port. Rtsp using two port: 1935 and 554. 1935 is better for wifi and 554 is better for mobile network
khaitt
Freshman
Freshman
 
Posts: 6
Joined: Sat Feb 26, 2011 5:32 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 18 guests