Video constructor
Video({
- Key? key,
- @Deprecated('playerId is deprecated. Use player instead.') int? playerId,
- Player? player,
- double? width,
- double? height,
- BoxFit fit = BoxFit.contain,
- AlignmentGeometry alignment = Alignment.center,
- double scale = 1.0,
- bool showControls = true,
- Color? progressBarActiveColor,
- Color? progressBarInactiveColor = Colors.white24,
- Color? progressBarThumbColor,
- Color? progressBarThumbGlowColor = const Color.fromRGBO(0, 161, 214, .2),
- Color? volumeActiveColor,
- Color? volumeInactiveColor = Colors.grey,
- Color volumeBackgroundColor = const Color(0xff424242),
- Color? volumeThumbColor,
- double? progressBarThumbRadius = 10.0,
- double? progressBarThumbGlowRadius = 15.0,
- bool showTimeLeft = false,
- TextStyle progressBarTextStyle = const TextStyle(),
- FilterQuality filterQuality = FilterQuality.low,
- bool showFullscreenButton = false,
- Color fillColor = Colors.black,
Widget for showing Video inside the Widget tree. Creation of Player instance is necessary as a controller, for this Widget to show Video output.
An example configuration between a Player and a Video can be as follows.
The Player.id
and Video.playerId
must be same for two to work together.
class _MyAppState extends State<MyApp> {
Player player = Player(id: 0);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Video(
player: player,
height: 420.0,
width: 320.0
),
),
);
}
}
This Widget internally uses StreamController.
Prefer calling Player.stop & Video.dispose
to freed the resources.
A global Key may be used for this purpose.
Implementation
Video({
Key? key,
@Deprecated('playerId is deprecated. Use player instead.') int? playerId,
Player? player,
this.width,
this.height,
this.fit: BoxFit.contain,
this.alignment: Alignment.center,
this.scale: 1.0,
this.showControls: true,
this.progressBarActiveColor,
this.progressBarInactiveColor = Colors.white24,
this.progressBarThumbColor,
this.progressBarThumbGlowColor = const Color.fromRGBO(0, 161, 214, .2),
this.volumeActiveColor,
this.volumeInactiveColor = Colors.grey,
this.volumeBackgroundColor = const Color(0xff424242),
this.volumeThumbColor,
this.progressBarThumbRadius = 10.0,
this.progressBarThumbGlowRadius = 15.0,
this.showTimeLeft = false,
this.progressBarTextStyle = const TextStyle(),
this.filterQuality = FilterQuality.low,
this.showFullscreenButton = false,
this.fillColor: Colors.black,
}) : player = player ?? players[playerId]! as Player,
super(key: key);