Sp1nt3lGabT
Sp1nt3lGabT

Reputation: 11

Flutter RTSP Streaming with VlcPlayerController Works on Emulator but Fails on Physical Devices

I'm currently working on a Flutter project where I've implemented a video player component using VlcPlayerController to stream RTSP video feeds. While everything seems to work perfectly on both iOS and Android emulators, I'm encountering issues when testing on physical devices, with different behaviors observed on iOS and Android:

iOS Devices: The page containing the video player loads, but the player itself never appears, leaving me with just the blank space where the player should be. Android Devices: The app crashes abruptly before even reaching the page with the video player. I've ensured that there are no error messages in the console that could provide hints as to what might be going wrong. This has left me quite puzzled as to why this discrepancy between emulator and physical device behavior exists.

Given that the component works as expected on emulators, I'm leaning towards thinking this might be related to hardware acceleration, permissions, or perhaps some sort of network security policy that's only enforced on physical devices.

Has anyone else encountered similar issues with VlcPlayerController or RTSP streaming in Flutter on physical devices? Any insights into potential causes or suggestions for troubleshooting steps would be greatly appreciated.

Here's a simplified version of my code for reference:

class RTSPVideoPlayer extends StatefulWidget {
  @override
  _RTSPVideoPlayerState createState() => _RTSPVideoPlayerState();
}

class _RTSPVideoPlayerState extends State<RTSPVideoPlayer> {
  late VlcPlayerController _vlcPlayerController;

  @override
  void initState() {
    super.initState();
    _vlcPlayerController = VlcPlayerController.network(
      'rtsp://example.com/stream',
      autoPlay: true,
      options: VlcPlayerOptions(),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: VlcPlayer(
        controller: _vlcPlayerController,
        aspectRatio: 16 / 9,
        placeholder: Center(child: CircularProgressIndicator()),
      ),
    );
  }

  @override
  void dispose() {
    _vlcPlayerController.dispose();
    super.dispose();
  }
}

Upvotes: 1

Views: 238

Answers (1)

mars000
mars000

Reputation: 141

you need to request Multicast from Apple Developer Program in your Certificates area of your Apple Developer Account. Its a web form. Then apple will eventually repond and you can then add it in Xcode. It worked for me but only on WiFi network but not on 4G/5G.

Upvotes: 0

Related Questions