import 'package:chat/utils/controller_widget_builder.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ijkplayer/flutter_ijkplayer.dart';

class VideoPage extends StatefulWidget {
  final String videoPath;
  VideoPage({this.videoPath});
  @override
  _VideoPageState createState() => _VideoPageState();
}

class _VideoPageState extends State<VideoPage> {

  IjkMediaController controller = IjkMediaController();
  bool hideMenu = true;

  @override
  void initState() {
    super.initState();

    WidgetsBinding.instance.addPostFrameCallback((_) {
      controller.setNetworkDataSource(widget.videoPath, autoPlay: true);
    });
  }

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

  Widget build(BuildContext context) {
    return Container(
        // height: 400, // 这里随意
        child: IjkPlayer(
      controllerWidgetBuilder: (ctl) {
        return MyDefaultIJKControllerWidget(
          ///按钮修改
          controller: ctl,
        );
      },
      mediaController: controller,
    ));
  }
}
