solid-software / flutter_vlc_player

📺 Flutter VLC powered video player.
521 stars 253 forks source link

`VlcPlayerController` constructor does not receive `VlcPlayerOptions` #425

Open ctwdtw opened 1 year ago

ctwdtw commented 1 year ago

I am streaming RTSP live videos using --rtsp-tcp on iOS device, the version for flutter_vlc_player is 7.2.0

My code looks like this:

final VlcPlayerController _videoPlayerController = VlcPlayerController.network(
    myRTSPURL,
    hwAcc: HwAcc.full,
    autoPlay: true,
    options: VlcPlayerOptions(
        rtp: VlcRtpOptions([VlcRtpOptions.rtpOverRtsp(true)]),
        video: VlcVideoOptions([VlcVideoOptions.skipFrames(true), VlcVideoOptions.dropLateFrames(true)]),
        //advanced: VlcAdvancedOptions([VlcAdvancedOptions.liveCaching(1000)]),
        //sout: VlcStreamOutputOptions([VlcStreamOutputOptions.soutMuxCaching(1000)]),
        extras: [],
    ),
  );

However, the log on my ip cam says that the client (my app) is requesting using UDP

Jul 31 17:01:08 streamd[21050]: setting up RTP (RTP/AVP;unicast;client_port=61816-61817)
Jul 31 17:01:08 streamd[21050]: client requested UDP port 61816

If I modify VLCViewController (the FlutterPlatformView for iOS):

init(frame: CGRect, viewId: Int64, messenger:FlutterBinaryMessenger) {
        ...
        // self.vlcMediaPlayer = VLCMediaPlayer()
        self.vlcMediaPlayer = VLCMediaPlayer(options: ["--rtsp-tcp"]) // I modify the above code with this
        ...

then my ip cam says that I am now using TCP:

Jul 31 17:21:58 streamd[6157]: client request: 'SETUP' 'rtsp://MyRTSPurl'
Jul 31 17:21:58 streamd[6157]: client_number = 1, max_num = 30
Jul 31 17:21:58 streamd[6157]: setting up RTP (RTP/AVP/TCP;unicast;interleaved=0-1)
Jul 31 17:21:58 streamd[6157]: requested interleave channels 0-1

This somehow proves that the constructor does not receive VlcPlayerOptions, how can I solve it or am I missing something?

pauloamarcon commented 1 year ago

I noticed this same problem. However, I notice that the problem occurs when the ios is using LTE connection. On wifi, with IPv4 network, it works fine. I made this change, but I'm still having problems with this. I used the ijkplayer package instead of VLC, which served me very well...