59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
|
|
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);
|
||
|
|
},
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|