I'm developing an Android app (Android 5.1) for playing the video stream from IP camera using the RTSP protocol.
I receive and display video stream using the Android VideoView
's standard methods:
videoView.setVideoURI(Uri.parse("rtsp://192.168.1.13:8888/test"));
try {
videoView.start();
}
catch (Exception ex) {
ex.printStackTrace();
}
Everything works fine, but the connection to the camera takes too long. It takes about 5-7 seconds (too long for my needs) before video starts playing.
Is there any way to speed up the connection time?
Finally found a solution. The problem was that Android' MediaPlayer
, that is a part of VideoView
, has fixed buffer size that cannot be changed. So i used Google' ExoPlayer
, which provides such feature. Making buffer size smaller resolved my problem.
PS Maintaining the resource/connection with VideoView.suspend()
or VideoView.pause()
to resume stream later doesn't make a thing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.