android - error using multiple instance of VideoView

1

I want an activity that show two (or more) videoview in a linear layout.

Using videoview with local files as datasource all works fine, but using video by stream rtsp I have a Mediaplayer error code like (1,1), usually the first video show correctly and second show error.

I try the two stream one at time, and they works, so there aren't format errors.

I read something about resource release of mediaplayer (link) , but I need that each real-time video are shown.

this is code in my Activity :

   try{
    videoView = (VideoView) findViewById(R.id.videoView1);
    Uri video = Uri.parse(urlVideo+"1"); 
    videoView.setVideoURI(video);
    videoView.start();

    videoView2 = (VideoView) findViewById(R.id.videoView2);
    Uri video2 = Uri.parse(urlVideo+"0");
    videoView2.setVideoURI(video2);
    videoView2.start();
}
catch (Exception e) { 
    e.printStackTrace(); 
}

and this is the complete error on logcat :

    01-14 10:57:26.627: I/Crayon_Player(148): <== setDataSource(rtsp://192.168.4.125:554/0)
01-14 10:57:26.627: V/MediaPlayerService(148): [200] setVideoSurfaceTexture(0x1b808e0)
01-14 10:57:26.627: I/Crayon_Player(148): ==> setVideoSurfaceTexture(0x1b808e0)
01-14 10:57:26.627: I/RTSPEngine(148): @@@VOLOG Info THD 019EBA08:    utility.cpp  MakeLog  990    2419010028 DESCRIBE rtsp://192.168.4.125:554/1 RTSP/1.0

01-14 10:57:26.627: I/RTSPEngine(148): CSeq: 1

01-14 10:57:26.627: I/RTSPEngine(148): Accept: application/sdp

01-14 10:57:26.627: I/RTSPEngine(148): Accept-Encoding: identity

01-14 10:57:26.627: I/RTSPEngine(148): Content-Encoding: identity

01-14 10:57:26.627: I/RTSPEngine(148): Content-Language: en-US

01-14 10:57:26.627: I/RTSPEngine(148): User-Agent: Player/LG Player 1.0 for Android(stagefright alternative)

01-14 10:57:26.627: I/RTSPEngine(148): 

01-14 10:57:26.627: I/RTSPEngine(148): @@@VOLOG Info THD 019EBA08:    utility.cpp  MakeLog  990    2419010028 

01-14 10:57:26.627: I/Crayon_Player(148): <== setVideoSurfaceTexture(0x1b808e0) return=0
01-14 10:57:26.627: V/MediaPlayerService(148): [200] setVideoSurfaceTexture(0x18fb118)
01-14 10:57:26.627: V/MediaPlayerService(148): [200] setAudioStreamType(3)
01-14 10:57:26.627: V/MediaPlayerService(148): [200] prepareAsync
01-14 10:57:26.627: I/Crayon_Player(148): ==> prepareAsync
01-14 10:57:26.627: I/Crayon_Player(148): <== prepareAsync return=0
01-14 10:57:26.627: I/CrayonGraph-PlayerOMX(148): [SetURL] url=rtsp://192.168.4.125:554/0
01-14 10:57:26.627: E/CRTSPSource(148): @@@VOLOG Error THD 019ECCC8:   CRTSPSource.cpp  LoadSource  247    The RTSP Source didn't close correctly!
01-14 10:57:26.627: E/voCOMXFileSource(148): @@@VOLOG Error THD 019ECCC8:   voCOMXFileSource.cpp  LoadFile  1010    m_pSource->LoadSource was failed. 0X80000007
01-14 10:57:26.627: W/CrayonGraph-Base(148): [setParameter] comp=OMX.VisualOn.FileSource, paramIndex=0x100000d, pData=0x1915120, eRet = 0x80001001 
01-14 10:57:26.627: E/CrayonGraph-PlayerOMX(148): [setURI] OMX_IndexParamContentURI fail 1
01-14 10:57:26.627: E/CrayonGraph-PlayerBuilder(148): setURI fail 1
01-14 10:57:26.627: E/Crayon_PlayerEngine(148): ERROR!! notifyListener_l msg[100] ext1[1] ext2[1]
01-14 10:57:26.627: V/MediaPlayerService(148): [200] notify (0x190da70, 100, 1, 1)
01-14 10:57:26.627: E/MediaPlayer(31866): error (1, 1)
java
android
android-mediaplayer
android-videoview
asked on Stack Overflow Jan 14, 2014 by tulkas85 • edited May 23, 2017 by Community

1 Answer

1

I have not seen a device that could support more than 4 concurrent active instances of VideoView (or meadia player, or stagefright, or OpenMAX). If your CPU is powerful enough, you should use a software solution (ffmpeg, or gstreamer).

answered on Stack Overflow Jan 28, 2014 by Alex Cohn

User contributions licensed under CC BY-SA 3.0