Android Question RTSPVideoPlayer play error

dlh_007

Member
Licensed User
Longtime User
B4X:
Private Player As RTSPVideoPlayer

Dim v As View = Player.Initialize("RTSP")
                    If Player.IsInitialised Then
                        Dim Width,Height As Int
                        If p.Width>p.Height Then                           
                            Height =Ceil(p.Height / 2) * 2 - 2dip                    '一定要注意,宽高尺寸必须是2的倍数
                            Width = Ceil(p.Width/ 2) * 2 - 2dip
                            'Height =p.Height - 2dip                                       '用这个会报错。
                            'Width = p.Width - 2dip
                            Log($"W:${Width},H:${Height}"$)           
                            p.AddView(v,1dip,1dip,Width,Height)
                        End If                   
                        v.SendToBack
                        Player.SetMedia("rtsp://admin:xxxxxx@192.168.1.15:554/ch01.264","admin","xxxxxx","")
                        Player.Start(True,False)
                    End If

如果宽高不为2的倍数会报如下错误:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/util/Util;
at com.alexvas.rtsp.codec.VideoDecodeThread.getDecoderSafeWidthHeight(VideoDecodeThread.kt:36)
at com.alexvas.rtsp.codec.VideoDecodeThread.run(VideoDecodeThread.kt:45)
at com.alexvas.rtsp.codec.VideoDecodeThread.run(VideoDecodeThread.kt:45)
at com.alexvas.rtsp.codec.VideoDecodeThread.run(VideoDecodeThread.kt:45)
 
Top