|
|
@@ -1,3 +1,6 @@ |
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:chat/data/UserData.dart';
|
|
|
|
import 'package:chat/data/constants.dart';
|
|
|
|
import 'package:chat/generated/i18n.dart';
|
|
|
|
import 'package:chat/utils/CustomUI.dart';
|
|
|
@@ -8,7 +11,6 @@ import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_ijkplayer/flutter_ijkplayer.dart';
|
|
|
|
import 'package:video_player/video_player.dart';
|
|
|
|
|
|
|
|
class VideoPage extends StatefulWidget {
|
|
|
|
final userId;
|
|
|
@@ -18,7 +20,6 @@ class VideoPage extends StatefulWidget { |
|
|
|
}
|
|
|
|
|
|
|
|
class _VideoPageState extends State<VideoPage> {
|
|
|
|
VideoPlayerController _controller;
|
|
|
|
bool isShowPlayButton = true;
|
|
|
|
|
|
|
|
bool isLoadingFish = false;
|
|
|
@@ -35,7 +36,7 @@ class _VideoPageState extends State<VideoPage> { |
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
|
|
|
_controller.dispose();
|
|
|
|
controller.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
@@ -52,26 +53,15 @@ class _VideoPageState extends State<VideoPage> { |
|
|
|
if (resData['code'] == 0) {
|
|
|
|
var videoUrl = resData['data']['AttestationValue'];
|
|
|
|
if (videoUrl != '' && videoUrl != null) {
|
|
|
|
// _controller = VideoPlayerController.network(videoUrl)
|
|
|
|
// ..initialize().then((_) {
|
|
|
|
// isLoadingFish = true;
|
|
|
|
// setState(() {});
|
|
|
|
// });
|
|
|
|
// _controller.addListener(() {
|
|
|
|
// if (_controller.value.position >= _controller.value.duration) {
|
|
|
|
// isShowPlayButton = true;
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
isLoadingFish = true;
|
|
|
|
var filePath = await UserData().getLoaclVideoPath(videoUrl);
|
|
|
|
controller.setFileDataSource(File(filePath), autoPlay: false);
|
|
|
|
setState(() {});
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
controller.setNetworkDataSource(videoUrl, autoPlay: false);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget appBar = new AppBar(
|
|
|
@@ -111,47 +101,5 @@ class _VideoPageState extends State<VideoPage> { |
|
|
|
},
|
|
|
|
mediaController: controller,
|
|
|
|
);
|
|
|
|
|
|
|
|
// Widget stack = Stack(
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// children: <Widget>[
|
|
|
|
//
|
|
|
|
// Container(
|
|
|
|
// width: Screen.width,
|
|
|
|
// child: _controller != null && _controller.value.initialized
|
|
|
|
// ? AspectRatio(
|
|
|
|
// aspectRatio: _controller.value.aspectRatio,
|
|
|
|
// child: VideoPlayer(_controller),
|
|
|
|
// )
|
|
|
|
// : Container(),
|
|
|
|
// ),
|
|
|
|
// InkWell(
|
|
|
|
// highlightColor: Colors.transparent,
|
|
|
|
// radius: 0,
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// if (!_controller.value.isPlaying) {
|
|
|
|
// _controller.seekTo(Duration());
|
|
|
|
// _controller.play();
|
|
|
|
// isShowPlayButton = false;
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// height: MediaQuery.of(context).size.height,
|
|
|
|
// color: Colors.black.withOpacity(
|
|
|
|
// _controller != null && _controller.value.isPlaying ? 0 : 0.5),
|
|
|
|
// padding: EdgeInsets.only(bottom: 20),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// child: Image.asset(
|
|
|
|
// 'assets/images/bofang.png',
|
|
|
|
// width:
|
|
|
|
// _controller != null && _controller.value.isPlaying ? 0 : 70,
|
|
|
|
// ),
|
|
|
|
// ))
|
|
|
|
// ],
|
|
|
|
// );
|
|
|
|
// return stack;
|
|
|
|
}
|
|
|
|
}
|