[Java for Android App Development] tulkas85:
I'm having compatibility problems using videoview (or MediaPlayer) for play rtsp streams in multiple videoviews in the same activity.

I have an error only using LG L9 phone, I can see first video, but second video get error.I know that isn't my code the responsible, because I test same software on different phones and it work.

This is logcat error :

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)

and this is a sample of my code, but I have same error using multiple MediaPlayer instead VideoView

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();
}

I test this code on different device, and only Lg L9 get above errors.

Viewing logcat Info messages for RTSP setup I see that each phone has different implementation of stagefright (android multimedia framework):

(A) I/RTSPEngine(147): User-Agent: Player/LG Player 1.0 for Android(stagefright alternative)
(B) I/ARTSPConnection(2252): User-Agent: stagefright/1.2 (Linux;Android 4.2.1)
(C) I/ARTSPConnection(10345): User-Agent: ALCATEL ONE TOUCH 997D-SVN/02001 (Linux;Android 4.1.1)
(D) W/ARTSPConnection(1948): User-Agent: User-Agent: Samsung GT-I9300 stagefright/Beyonce/1.1.9 (Linux;Android 4.3)

A is Lg l9 - android 4.1.2
B is Chinese jiayu g4 - Android 4.2.1
C is ALCATEL ONE TOUCH 997D - Android 4.1.1
D is Samsung galaxy S3 - Android 4.3

You can see that there are different android version and different stagefright here, but multiple rtsp fails only on Lg . Another interesting thing is that only Lg use RtspEngine, others use ARTSPConnection

There is a way to force application to use native stagefright (if it exist on device) ?

How an application can manage this compatibility issue ? It is not reasonable to develop an app that will not be compatible with some brands of phones