|
@@ -2,12 +2,8 @@
|
|
|
|
|
|
import 'package:fis_measure/index.dart';
|
|
|
import 'package:fis_measure/interfaces/process/player/play_controller.dart';
|
|
|
-import 'package:fis_measure/interfaces/process/workspace/application.dart';
|
|
|
-import 'package:fis_measure/process/workspace/application.dart';
|
|
|
import 'package:fis_vid/data_host/data_host.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:get/get.dart';
|
|
|
-import 'package:vid/us/vid_us_image.dart';
|
|
|
|
|
|
class ImagePlayerView extends StatefulWidget {
|
|
|
const ImagePlayerView({Key? key}) : super(key: key);
|
|
@@ -21,6 +17,7 @@ class _ImagePlayerViewState extends State<ImagePlayerView> {
|
|
|
IPlayerController get playerController => _playerController!;
|
|
|
VidDataHost? _vidDataHost;
|
|
|
VidDataHost get dataHost => _vidDataHost!;
|
|
|
+ bool _ifInit = false;
|
|
|
List<String> mockData = [
|
|
|
"http://cdn-bj.fis.plus/093BE20682B14BFB95D811F221A2B2FD.vid"
|
|
|
];
|
|
@@ -33,17 +30,22 @@ class _ImagePlayerViewState extends State<ImagePlayerView> {
|
|
|
|
|
|
void startPlay() {
|
|
|
print("${DateTime.now()} Click play");
|
|
|
- dataHost.load().then((value) {
|
|
|
- if (value == null) {
|
|
|
- // TOOO: add log
|
|
|
- } else {
|
|
|
- playerController.setLoadState(value != null);
|
|
|
- Future.delayed(const Duration(milliseconds: 100), () {
|
|
|
- playerController.play();
|
|
|
- });
|
|
|
- print("${DateTime.now()} Load vid data host success");
|
|
|
- }
|
|
|
- });
|
|
|
+ if (_ifInit) {
|
|
|
+ playerController.play();
|
|
|
+ } else {
|
|
|
+ dataHost.load().then((value) {
|
|
|
+ if (value == null) {
|
|
|
+ // TOOO: add log
|
|
|
+ } else {
|
|
|
+ playerController.setLoadState(value != null);
|
|
|
+ Future.delayed(const Duration(milliseconds: 100), () {
|
|
|
+ playerController.play();
|
|
|
+ });
|
|
|
+ print("${DateTime.now()} Load vid data host success");
|
|
|
+ }
|
|
|
+ _ifInit = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -85,8 +87,8 @@ class _ImagePlayerViewState extends State<ImagePlayerView> {
|
|
|
@override
|
|
|
void dispose() {
|
|
|
print("ImagePlayerView dispose");
|
|
|
- _playerController?.dispose();
|
|
|
- Get.delete<IPlayerController>();
|
|
|
+ playerController.dispose();
|
|
|
+ dataHost.release();
|
|
|
super.dispose();
|
|
|
}
|
|
|
}
|