import 'package:flutter/material.dart'; import 'package:flutter_vlc_player/flutter_vlc_player.dart'; class VideoPlayerNetwork extends StatefulWidget { final String initialFluxUrl; VideoPlayerNetwork({required this.initialFluxUrl}); @override _VideoPlayerNetworkState createState() => _VideoPlayerNetworkState(); } class _VideoPlayerNetworkState extends State { late VlcPlayerController _videoPlayerController; @override void initState() { super.initState(); _videoPlayerController = VlcPlayerController.network( 'rtsp://192.168.31.110/live0', // 'http://192.168.31.140:8084' hwAcc: HwAcc.full, autoPlay: true, options: VlcPlayerOptions(rtp: VlcRtpOptions([ VlcRtpOptions.rtpOverRtsp(true), ])), ); } @override void dispose() async { super.dispose(); await _videoPlayerController.stopRendererScanning(); await _videoPlayerController.dispose(); } @override Widget build(BuildContext context) { return Center( child: Container( width: 500, height: 500, child: InteractiveViewer( child: VlcPlayer( controller: _videoPlayerController, aspectRatio: 16 / 9, placeholder: Center(child: CircularProgressIndicator()), ), ), ), ); } }