I'm trying to use the following code to play an H.264 RTSP video
stream from a network camera on Android "1.5 CUPCAKE 150240":
-----
final MediaPlayer mp = new MediaPlayer ();
try
{
// motion jpeg (I tried this too, but don't think Android
supports motion jpeg)
//mp.setDataSource ("http://server/axis-cgi/mjpg/video.cgi");
// h264
mp.setDataSource ("rtsp://server/axis-media/media.amp?
videocodec=h264");
mp.prepare ();
mp.start ();
}
catch (final IOException ioe)
{
AlertDialog.Builder builder = new AlertDialog.Builder (this);
builder.setMessage (ioe.toString ()).setCancelable
(false).setPositiveButton (
"OK", new DialogInterface.OnClickListener ()
{
public void onClick(
DialogInterface dialog, int id )
{
dialog.cancel ();
}
});
AlertDialog alert = builder.create ();
alert.show ();
}
-----
What happens is Android just shows "java.io.IOException: Prepare
failed.: status=0x1" in the dialog. When I run Wireshark, I see the
following conversation:
-----
OPTIONS rtsp://192.168.0.61/axis-media/media.amp?videocodec=h264 RTSP/
1.0
CSeq: 0
User-Agent: PVCore/05.02.00.00
ClientChallenge: 9e26d33f2984236010ef6253fb1887f7
PlayerStarttime: [28/03/2003:22:50:23 00:00]
CompanyID: KnKV4M4I/B2FjJ1TToLycw==
GUID: 00000000-0000-0000-0000-000000000000
RTSP/1.0 200 OK
CSeq: 0
Public: DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER,
TEARDOWN
Date: Sun, 21 Dec 2008 16:03:16 GMT
DESCRIBE rtsp://192.168.0.61/axis-media/media.amp?videocodec=h264 RTSP/
1.0
CSeq: 1
User-Agent: PVCore/05.02.00.00
Accept: application/sdp
Accept-Encoding:
RTSP/1.0 200 OK
CSeq: 1
Content-Type: application/sdp
Content-Base: rtsp://192.168.0.61/axis-media/media.amp/
Date: Sun, 21 Dec 2008 16:03:16 GMT
Content-Length: 489
v=0
o=- 1229875396592509 1229875396592509 IN IP4 192.168.0.61
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:50000
t=0 0
a=control:rtsp://192.168.0.61/axis-media/media.amp?videocodec=h264
a=range:npt=0.000000-
m=video 0 RTP/AVP 96
b=AS:50000
a=framerate:30.0
a=control:rtsp://192.168.0.61/axis-media/media.amp/trackID=1?
videocodec=h264
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=420029; sprop-
parameter-sets=Z0IAKeNQFAe2AtwEBAaQeJEV,aM48gA==
-----
It looks like Android doesn't like something in the DESCRIBE response,
because it never issues a PLAY, but I have no way of knowing what's
wrong.
Shouldn't this work? And to confirm, Android cannot play a motion jpeg
stream via HTTP?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---