|
|
@ -1,6 +1,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:chewie/chewie.dart'; |
|
|
|
import 'package:chewie/chewie.dart'; |
|
|
|
|
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter_html/flutter_html.dart'; |
|
|
|
import 'package:flutter_html/flutter_html.dart'; |
|
|
|
import 'package:flutter_html/image_render.dart'; |
|
|
|
import 'package:flutter_html/image_render.dart'; |
|
|
|
import 'package:chewie/src/chewie_progress_colors.dart' as chewie; |
|
|
|
import 'package:chewie/src/chewie_progress_colors.dart' as chewie; |
|
|
@ -106,15 +107,7 @@ class _WebContent extends State<WebContent> { |
|
|
|
|
|
|
|
|
|
|
|
Widget videoWidget(double width, double height, src, sandboxMode) { |
|
|
|
Widget videoWidget(double width, double height, src, sandboxMode) { |
|
|
|
print("src : $src"); |
|
|
|
print("src : $src"); |
|
|
|
return MediaQuery( |
|
|
|
chewieAudioController = ChewieController( |
|
|
|
data: MediaQuery.of(context).copyWith( |
|
|
|
|
|
|
|
textScaleFactor: 0.9, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width - 17, |
|
|
|
|
|
|
|
height: (MediaQuery.of(context).size.width) / (width / height), |
|
|
|
|
|
|
|
child: chewies = Chewie( |
|
|
|
|
|
|
|
controller: chewieAudioController = ChewieController( |
|
|
|
|
|
|
|
videoPlayerController: videoPlayerController = |
|
|
|
videoPlayerController: videoPlayerController = |
|
|
|
VideoPlayerController.network( |
|
|
|
VideoPlayerController.network( |
|
|
|
src, |
|
|
|
src, |
|
|
@ -125,6 +118,11 @@ class _WebContent extends State<WebContent> { |
|
|
|
//自动播放 |
|
|
|
//自动播放 |
|
|
|
looping: false, |
|
|
|
looping: false, |
|
|
|
//循环播放 |
|
|
|
//循环播放 |
|
|
|
|
|
|
|
allowFullScreen: true, |
|
|
|
|
|
|
|
// systemOverlaysAfterFullScreen: [], |
|
|
|
|
|
|
|
// systemOverlaysOnEnterFullScreen: [], |
|
|
|
|
|
|
|
// deviceOrientationsAfterFullScreen: [], |
|
|
|
|
|
|
|
// deviceOrientationsOnEnterFullScreen: [], |
|
|
|
// 拖动条样式颜色 |
|
|
|
// 拖动条样式颜色 |
|
|
|
materialProgressColors: chewie.ChewieProgressColors( |
|
|
|
materialProgressColors: chewie.ChewieProgressColors( |
|
|
|
playedColor: Colors.white, |
|
|
|
playedColor: Colors.white, |
|
|
@ -133,12 +131,36 @@ class _WebContent extends State<WebContent> { |
|
|
|
bufferedColor: Colors.transparent, |
|
|
|
bufferedColor: Colors.transparent, |
|
|
|
), |
|
|
|
), |
|
|
|
autoInitialize: true, |
|
|
|
autoInitialize: true, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chewieAudioController.addListener(_fullScreenListener); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return MediaQuery( |
|
|
|
|
|
|
|
data: MediaQuery.of(context).copyWith( |
|
|
|
|
|
|
|
textScaleFactor: textScaleFactor, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width - 17, |
|
|
|
|
|
|
|
height: (MediaQuery.of(context).size.width) / (width / height), |
|
|
|
|
|
|
|
child: chewies = Chewie( |
|
|
|
|
|
|
|
controller: chewieAudioController, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _fullScreenListener() async { |
|
|
|
|
|
|
|
print("object: isPlaying: ${videoPlayerController.value.isPlaying}"); |
|
|
|
|
|
|
|
print("object: isFullScreen: ${chewieAudioController.isFullScreen}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!chewieAudioController.isFullScreen) { |
|
|
|
|
|
|
|
textScaleFactor = 1; |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double textScaleFactor = 0.9; |
|
|
|
|
|
|
|
|
|
|
|
Widget audioWidget(showControls, loop, autoplay, src, width) { |
|
|
|
Widget audioWidget(showControls, loop, autoplay, src, width) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
width: width, |
|
|
|
width: width, |
|
|
|