feat:更新视频播放组件
This commit is contained in:
1 parent
5287f5f7cd
commit
f8d639b3d5
5 files changed
+61
-102
No files matched your search
@@ -1 +1 @@
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_gallery_saver_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver_plus-4.0.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_picker_ios-0.8.13+3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/package_info_plus-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"permission_handler_apple","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/permission_handler_apple-9.4.7/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"screen_brightness_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness_ios-2.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_foundation-2.5.6/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_ios-6.3.6/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_avfoundation","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/video_player_avfoundation-2.9.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"volume_controller","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/volume_controller-3.4.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"wakelock_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/wakelock_plus-1.4.0/","native_build":true,"dependencies":["package_info_plus"],"dev_dependency":false}],"android":[{"name":"device_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_plugin_android_lifecycle","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_plugin_android_lifecycle-2.0.33/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_gallery_saver_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver_plus-4.0.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_picker_android-0.8.13+12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/package_info_plus-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/path_provider_android-2.2.22/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"permission_handler_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/permission_handler_android-12.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"screen_brightness_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness_android-2.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_android-2.4.18/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/sqflite_android-2.4.2+2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_android-6.3.28/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_android","path":"/Users/wxl/.pub-cache/hosted/pub.flLine truncated
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_gallery_saver_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver_plus-4.0.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_picker_ios-0.8.13+3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/package_info_plus-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"permission_handler_apple","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/permission_handler_apple-9.4.7/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"screen_brightness_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness_ios-2.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_foundation-2.5.6/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_ios","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_ios-6.3.6/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_avfoundation","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/video_player_avfoundation-2.9.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"wakelock_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/wakelock_plus-1.4.0/","native_build":true,"dependencies":["package_info_plus"],"dev_dependency":false}],"android":[{"name":"device_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_plugin_android_lifecycle","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_plugin_android_lifecycle-2.0.33/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_gallery_saver_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver_plus-4.0.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_picker_android-0.8.13+12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/package_info_plus-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/path_provider_android-2.2.22/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"permission_handler_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/permission_handler_android-12.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"screen_brightness_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness_android-2.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_android-2.4.18/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/sqflite_android-2.4.2+2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_android-6.3.28/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_android","path":"/Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/video_player_android-2.9.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"wakelock_plus","path":"/Users/wxl/.pub-cache/hosted/pub.fluLine truncated
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:omni_video_player/omni_video_player.dart';
|
||||
import 'package:flutter_common/utils/showVideoPlay.dart';
|
||||
|
||||
class PlayVideoPage extends StatefulWidget {
|
||||
|
||||
@@ -13,7 +12,6 @@ class PlayVideoPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PlayVideoPageState extends State<PlayVideoPage> {
|
||||
OmniPlaybackController? _controller;
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
@@ -24,42 +22,10 @@ class _PlayVideoPageState extends State<PlayVideoPage> {
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
_controller?.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(bottom: 50.h,top: 150.h),
|
||||
color: Colors.black,
|
||||
child: OmniVideoPlayer(
|
||||
configuration: VideoPlayerConfiguration(
|
||||
videoSourceConfiguration: VideoSourceConfiguration.network(
|
||||
videoUrl: Uri.parse(widget.videoUrl),
|
||||
preferredQualities: [OmniVideoQuality.high1080],
|
||||
),
|
||||
), callbacks: VideoPlayerCallbacks(
|
||||
onControllerCreated: (controller) {
|
||||
setState(() {
|
||||
controller.play();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 60.h,
|
||||
left: 20.w,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios, color: Colors.white,),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
return ShowVideoPlayPage(url: widget.videoUrl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'dart:collection';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
|
||||
class ShowVideoPlayPage extends StatefulWidget {
|
||||
final String url;
|
||||
const ShowVideoPlayPage({super.key, required this.url});
|
||||
|
||||
@override
|
||||
State<ShowVideoPlayPage> createState() => _ShowVideoPlayPageState();
|
||||
}
|
||||
|
||||
class _ShowVideoPlayPageState extends State<ShowVideoPlayPage> {
|
||||
|
||||
InAppWebViewController? webViewController;
|
||||
InAppWebViewSettings settings = InAppWebViewSettings(
|
||||
isInspectable: kDebugMode,
|
||||
mediaPlaybackRequiresUserGesture: false,
|
||||
allowsInlineMediaPlayback: true,
|
||||
iframeAllow: "camera; microphone",
|
||||
iframeAllowFullscreen: true);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: Icon(
|
||||
Icons.navigate_before,
|
||||
color: Colors.white,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
body: Container(
|
||||
color: Colors.black,
|
||||
child:InAppWebView(
|
||||
initialUrlRequest: URLRequest(url: WebUri(widget.url)),
|
||||
initialUserScripts: UnmodifiableListView<UserScript>([]),
|
||||
initialSettings: settings,
|
||||
onWebViewCreated: (controller) async {
|
||||
webViewController = controller;
|
||||
},
|
||||
onLoadStart: (controller, url) {
|
||||
setState(() {
|
||||
});
|
||||
},
|
||||
onConsoleMessage: (controller, consoleMessage) {
|
||||
print(consoleMessage);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,14 +448,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "10.12.0"
|
||||
freezed_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
get:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -624,14 +616,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -744,14 +728,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
omni_video_player:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: omni_video_player
|
||||
sha256: e01ce74413c2eb1cfe042c81507ef2573af66e7ee2984b9ee45808d35a3ea9da
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.7.2"
|
||||
package_info_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1080,14 +1056,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
simple_sparse_list:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_sparse_list
|
||||
sha256: aa648fd240fa39b49dcd11c19c266990006006de6699a412de485695910fbc1f
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.1.4"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -1221,14 +1189,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
unicode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: unicode
|
||||
sha256: a6f7bcfc8ea1d5ce1f6c0b1c39117a9919f4953edd9fd7a64090a9796c499b57
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.9"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1349,14 +1309,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
visibility_detector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: visibility_detector
|
||||
sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.4.0+2"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1365,14 +1317,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "15.0.2"
|
||||
volume_controller:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: volume_controller
|
||||
sha256: "5c1a13d2ea99d2f6753e7c660d0d3fab541f36da3999cafeb17b66fe49759ad7"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.4.1"
|
||||
wakelock_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1437,14 +1381,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
youtube_explode_dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: youtube_explode_dart
|
||||
sha256: "3d731d71df9901b1915bae806781df519cff32517e36db279f844ae619669e45"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.5"
|
||||
sdks:
|
||||
dart: ">=3.10.3 <4.0.0"
|
||||
flutter: ">=3.38.4"
|
||||
@@ -41,7 +41,6 @@ dependencies:
|
||||
device_info_plus: ^11.3.0
|
||||
image_editor_plus: ^1.0.6
|
||||
path_provider: ^2.1.5
|
||||
omni_video_player: ^3.5.3
|
||||
cached_network_image: ^3.4.1
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Reference in new issue
Block a user