fix:播放插件切换名字
This commit is contained in:
65
lib/utils/play_video.dart
Normal file
65
lib/utils/play_video.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:omni_video_player/omni_video_player.dart';
|
||||
|
||||
class PlayVideoPage extends StatefulWidget {
|
||||
|
||||
final String videoUrl;
|
||||
|
||||
const PlayVideoPage({super.key, required this.videoUrl});
|
||||
|
||||
@override
|
||||
State<PlayVideoPage> createState() => _PlayVideoPageState();
|
||||
}
|
||||
|
||||
class _PlayVideoPageState extends State<PlayVideoPage> {
|
||||
OmniPlaybackController? _controller;
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
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(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user