Video constructor

Video({
  1. Key? key,
  2. @Deprecated('playerId is deprecated. Use player instead.') int? playerId,
  3. Player? player,
  4. double? width,
  5. double? height,
  6. BoxFit fit = BoxFit.contain,
  7. AlignmentGeometry alignment = Alignment.center,
  8. double scale = 1.0,
  9. bool showControls = true,
  10. Color? progressBarActiveColor,
  11. Color? progressBarInactiveColor = Colors.white24,
  12. Color? progressBarThumbColor,
  13. Color? progressBarThumbGlowColor = const Color.fromRGBO(0, 161, 214, .2),
  14. Color? volumeActiveColor,
  15. Color? volumeInactiveColor = Colors.grey,
  16. Color volumeBackgroundColor = const Color(0xff424242),
  17. Color? volumeThumbColor,
  18. double? progressBarThumbRadius = 10.0,
  19. double? progressBarThumbGlowRadius = 15.0,
  20. bool showTimeLeft = false,
  21. TextStyle progressBarTextStyle = const TextStyle(),
  22. FilterQuality filterQuality = FilterQuality.low,
  23. bool showFullscreenButton = false,
  24. 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);