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