Home » Android » android – VideoView RTSP delay

android – VideoView RTSP delay

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m currently working on a project which involves the rtsp streaming from an ip camera to an android device.

The phone and ip camera are connected to the same access point / router.

The problem is that the stream has a very big delay, ~ 5 seconds, if you watch a stream from the internet I assume that is ok for the buffer, but for my kind of application is just unacceptable, is not that real time anymore, it’s useless… Of course, just to be sure that the camera is not the one to blame, I tested my ip cam stream to my pc in VLC with cache set to 0 and it’s perfectly working.

I didn’t find any property for the videoview class regarding my problem, so I started looking in the opencore sources hoping to find something in which I can modify and reduce the cache/buffer for the rtsp, I tried to understand how those work, but since those are very complicated I didn’t manage to do that.

Now I’m stuck at this point in my project and can’t see to find a way out… and the applications deadline is coming very fast. 😐

Everyone who has any idea in getting this thing resolved please help me, because I’m kind of desperate right now.

How to&Answers:

As it’s stated here, buffer size for standard VideoView is hardcoded into firmware. So, you will have to use a custom library like Vitamio to have some control over buffer size (more on that particular matter in their tutorial)

Answer:

Set buffer size as 1000 before you start playing

mVideoView.setBufferSize(1000);