Я не мог найти способ показать элементы управления video_player по умолчанию, но вместо этого использовал этот пакет, и он отлично работает для Flutter-web: https://pub.dev/packages/chewie
I Я уверен, что вам также нужен стандартный пакет video_player ...
Вот пример:
import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
class ChewieVideo extends StatefulWidget {
// This will contain the URL/asset path which we want to play
final VideoPlayerController videoPlayerController;
final bool looping;
ChewieVideo({
@required this.videoPlayerController,
this.looping,
Key key,
}) : super(key: key);
@override
_ChewieVideoState createState() => _ChewieVideoState();
}
class _ChewieVideoState extends State<ChewieVideo> {
ChewieController _chewieController;
@override
void initState() {
super.initState();
// Wrapper on top of the videoPlayerController
_chewieController = ChewieController(
videoPlayerController: widget.videoPlayerController,
// Prepare the video to be played and display the first frame
autoInitialize: true,
allowFullScreen: false,
aspectRatio: 16 / 9,
looping: widget.looping,
autoPlay: false,
showControlsOnInitialize: false,
// Errors can occur for example when trying to play a video
// from a non-existent URL
errorBuilder: (context, errorMessage) {
return Center(
child: Text(
errorMessage,
style: TextStyle(color: Colors.white),
),
);
},
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Chewie(
controller: _chewieController,
),
);
}
@override
void dispose() {
widget.videoPlayerController.dispose();
_chewieController.dispose();
super.dispose();
}
}