import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:location/base/base_controller.dart';
import 'package:video_player/video_player.dart';

import '../../resource/assets.gen.dart';

class LocationAnalyseController extends BaseController {
  late final VideoPlayerController bgController;

  final RxBool _videoReady = RxBool(false);

  bool get videoReady => _videoReady.value;

  @override
  void onInit() {
    super.onInit();
    bgController = VideoPlayerController.asset(
      Assets.video.locationAnalyseRobot,
    )
      ..setLooping(true)
      ..setVolume(0.0)
      ..initialize().then((_) {
        _videoReady.value = true;
        bgController.play();
      }).catchError((error) {
        debugPrint('Error initializing video: $error');
      });
  }

  void back() {
    Get.back();
  }
}
