I have a Samsung Galaxy Tab (Android 2.2 Froyo, etc) that I am developing on. I need the application to access a stream via IP, and the stream is originating from an Axis 241Q. The Axis is set to use .mp4 encoding, and I see that Android supports .mp4 natively. The Axis server also provides an RTSP URI to access the stream from media players via the local network.
Let me lead in to this by saying that I know less than nothing about video encoding standards and containers, so I apologize if this is a "no duh" issue.
My question is, how do I get to this stream using an Android VideoView? The Cliff's Notes version of the code I would use to start up the view in my Activity's onCreate():
VideoView v = (VideoView) findViewById(R.id.feed);
Uri video = Uri.parse("rtsp://local/path/to/feed.amp");
v.setVideoURI(video);
v.start();
I've used this with some test .3gp stream URI's that I've found on the internet and it seems to work fine, but all of the test streams that I found were done over HTTP and not RTSP so maybe I have to do a little more magic to get RTSP going; I can't imagine why that'd be though. I do know that Android supports RTSP in URI String resources for its MediaPlayers. Then again, I know nothing about streaming video so I may be wrong in assuming that it works the exact same way.
Regardless, when I attempt to access the Axis feed locally, the feed will not load; my assumption is that this results from use of the .amp extension instead of the ones listed in the Android docs but I have absolutely no idea. I can pass this URI to QuickTime and other such media players with positive results so I'm also assuming that the .amp file extension isn't THAT bizarre. I've had a hard time really finding out because Googling .amp with anything else, even using quotes and whatnot, yields a tedious set of results because of "amp" showing up in HTML escape characters.
The first question is, am I missing something obvious? I'm thinking not but there's a good chance that it's so.
The second question: is there a simple way to access this RTSP stream without having to brew up an insane solution on my own? Any existing and FREE libraries that are already in the wild and could make this easier on me would be a huge help. I was initially going to try out the gstreamer java bindings but after looking at the project page I saw that gstreamer relies on Swing and I don't believe Swing is included in the Android Java jars.
Can you provide the MPEG4 configuration of the stream?
Extension .amp
can be replaced with .3gp
on all Axis products. So try Uri.parse("rtsp://local/path/to/feed.3gp");
. But, extension shouldn't make any difference in RTSP because media stream is determined by SDP, and not its "extension". So it can be media.jpg
and server will actually stream H264
video, and not JPEG image.
If that doesn't work, try to configure your MPEG4 stream and be sure that you check ISMA compliant
and set Video object type: SIMPLE
(not Advanced Simple). That stream now can be played on all media players that decode MPEG4.
If you have difficulties, comment here, and I will update my answer to add new stuff.