Comrades, please help. The task is to output the RTSP stream to VideoView. There is an IP camera with which I need to pick up the stream. I launch the vlc player and specify the url of the camera (rtsp: // admin: admin@xx.xxx.xxx.xxx: 554 / RVi / 1/0) After a few seconds, a video appears, the vlc player tells me the data type: H264-MPEG4-AVC (part 10) (h264), on the website for developers, I see that this data type is supported.
I write the stream to a file via vlc, the resulting file is obtained in H264-MPEG4-AVC format. I stuff it into the raw folder. And the following code reproduces it safely:
String videoSource = "android.resource://" + getActivity().getPackageName() + "/" + R.raw.video1; final VideoView videoView = (VideoView) rootView.findViewById(R.id.videoView); videoView.setVideoURI(Uri.parse(videoSource)); MediaController vidControl = new MediaController(getActivity()); videoView.setMediaController(vidControl); vidControl.setAnchorView(videoView); videoView.requestFocus(); videoView.start(); But as soon as I specify as url - rtsp: // admin: admin@xx.xxx.xxx.xxx: 554 / RVi / 1/0, the System issues "Can't play video", and falls into the log "MediaPlayer Error 1 -2147483648 "; Here is the code:
String videoSource = "rtsp://admin:admin@xx.xxx.xxx.xxx:554/RVi/1/0"; final VideoView videoView = (VideoView) rootView.findViewById(R.id.videoView); videoView.setVideoURI(Uri.parse(videoSource)); MediaController vidControl = new MediaController(getActivity()); videoView.setMediaController(vidControl); vidControl.setAnchorView(videoView); videoView.requestFocus(); videoView.start(); If you transfer rtps to the drain to the native player, then the video will work (on android 4.4 Lenovo), and will not work on android (4.2.2 Samsung Tab)
Tell me where to dig? Can third-party libraries?
android rtsp videoviewa lot of results are issued, the first 4 links (who would have thought) give answers. - Vladyslav Matviienko