Live Streaming issue for the RTSP

We have the application 'ADS Smart', a companion application for our ADS Dashcam. We offer a feature that lets users stream the live footage of the dashcam cameras through the app. Currently, we are experiencing a time delay of 30+ seconds to see the live stream, i.e the first frame of the live footage is taking around 30+ seconds to display in the app. We are using the MobileVLCKit library to stream the videos in the app. The current flow of the code,

  1. Flutter triggers the native playback via a method channel

    • The Dart side calls the iOS method channel <identifier_name>/ts_player with method playTSFromURL passing:
    • url(e.g rtsp://.... for live),
    • playerId
    • viewId (stable ID used to host native UI)
    • showControls
    • optional localIp
  2. AppDelegate receives the call and prepares networking

    • Entry point: AppDelegate.tsChannel handler for "playTSFromURL" in AppDelegate.swift.
    • It resolves the Wi‑Fi interface and local IP if possible:
    • Sets VLC_SOURCE_ADDRESS to the Wi‑Fi IP (when available) to prefer Wi‑Fi for the stream.
    • Uses NWPathMonitor and direct interface inspection to find the Wi‑Fi interface (e.g., en0) and IP.
    • Kicks off best-effort route priming to the dashcam IP/ports (non-blocking), see establishWiFiRoutePriority.
  3. AppDelegate chooses the right player implementation

    • createPlayerForURL(_: ) decides:
      • RTSP(rasp://..) --> use VLCKit-backed player (class TSStreamPlayer -> TSStreamPlayer class provides a VLC-backed video player for iOS, handling playback of Transport Stream(TS) URLs with strict main-thread UI updates, view safety, and stream management, using MobileVLCKit)
      • .ts files --> use VLCKit-based player for playing already recorded videos in the app.
      • If the selected player supports extras (e.g. TSStreamPlayerExtras), it sets
        • LocalIP (if resolved)
        • Wi-fi interface name
  4. AppDeletegate creates the native 'platform view' container and overlay

    • platformView(for:parent:showControls:):
      • Creates a container UIView attached to the Flutter root view
      • Adds a dedicated child videoHost[viewId]-the host UIView for rendering video.
      • If showControls == true, adds TSPlayerControlsOverlay over the video and wires overlay callbacks back to the Flutter via controlChannel (<identifier>/player_controls)
      • If showControls == false, adds a minimal back button and wires it to onGalleryBack.
  5. The player starts playback inside the host view

    • Class player.playTSFromURL(urlString, in:host){ success, error in...} on the main thread.
    • For RTSP/TS streams: this is handled by TSStreamPlayer(VLCKit).
  6. Success/failure is reported back to Flutter

    • The completion closure invoked in step 5 returns true on first real playback or an error message on failure.
    • The method channel result responds:
      • true --> Flutter knows playback started
      • FlutterError -> Flutter can show an error
  7. Stopping and cleanup

    • "stop" on tsChannel stops and disposes the player(s).
    • "removePlatformView" removes the overlay, back button, the host, and the container, and disposes any remaining players.

I am attaching the logs of the app while running.

The actual issue happening is that when the iOS device is connected to the dashcam's Wi-Fi, for the app's live streaming-related information, the iOS is using Mobile Data even though the wifi is the main communication channel. The iOS device takes approximately 30 seconds to display the first frame of live footage in the app. Despite being connected to the dashcam’s Wi-Fi, the iOS device sets the value of ES (en0) to Wi-Fi after multiple attempts, causing the live footage to appear in the app after this delay. So, how can we set up the configuration to display the live footage from the dashcam cameras within just 2 to 3 seconds in the iOS device?

Live Streaming issue for the RTSP
 
 
Q