mirror of
https://bitbucket.org/myhomie/myhomie_app.git
synced 2025-12-06 17:11:19 +00:00
54 lines
1.3 KiB
Dart
54 lines
1.3 KiB
Dart
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<VideoPlayerNetwork> {
|
|
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()),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|