项目需要用Android 播放RTSP视频,用Android Studio自带的videoView 发现延时很大,达10秒左右,用NodeMedia播放RTSP视频,可设置缓存时间,将时延降至毫秒。
1、在settings.gradle中在下图位置加入
maven { url 'https://jitpack.io' }
2、菜单File->Project structrue,在弹出的对计算机框中依次点击Dependencies->All Dependencies->"+"号->1 Library Dependency.
在弹出的对话框中输入
com.github.nodemedia:nodemediaclient-android:2.9.20
然后依次点击下图的1、2、3
3、xml文件
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match