import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:vid_player_demo/controller/player_controller.dart';
import 'package:vid_player_demo/pages/canvas_player/view.dart';
import 'package:vid_player_demo/pages/image_player/view.dart';

class BothPlayerPage extends StatelessWidget {
  BothPlayerPage({Key? key}) : super(key: key);
  final vidURL = "http://cdn-bj.fis.plus/093BE20682B14BFB95D811F221A2B2FD.vid";
  final _playerStateController = Get.put(PlayerStateController());
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("两个播放器对比"),
        ),
        body: Column(
          children: [
            const SizedBox(height: 24),
            ElevatedButton(
                onPressed: () => {_playerStateController.play(context)},
                child: const Text("Play Together")),
            const SizedBox(height: 24),
            Row(
              children: <Widget>[
                Expanded(
                  child: ImagePlayerView(vidURL),
                ),
                Expanded(
                  child: CanvasPlayerView(vidURL),
                ),
              ],
            ),
          ],
        ));
  }
}
