video_player
2.14.1, released 7 weeks ago by flutter.dev
Flutter plugin for displaying inline video on Android, iOS, macOS, and web.
Flutter FavoriteRock solid
What it does
Allows developers to embed and control video playback inside Flutter widgets across multiple platforms. It provides controllers to manage playback state, speed, positioning, and tracks.
AI-written summary of version 2.14.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to play local or network videos inline with other Flutter widgets.
- You require cross-platform video playback supporting Android, iOS, macOS, and web.
Skip it when
- You are building a complex audio/video streaming app that requires advanced background playback or comprehensive custom media controls out of the box (consider chewie or media_kit instead).
- You need to play video using `VideoPlayerController.file` on the web platform.
Strengths
- Official Flutter team package with broad platform support.
- Supports adaptive streams, audio/video track selection, and playback speed configuration.
Weaknesses
- Web platform capabilities depend heavily on individual browser implementations.
- Requires manual implementation of UI controls (play/pause, progress bars).
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Requires adding network permissions in AndroidManifest.xml and optionally configuring NSAppTransportSecurity in iOS Info.plist or network client entitlements for macOS.
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
void main() => runApp(const VideoApp());
class VideoApp extends StatefulWidget {
const VideoApp({super.key});
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.networkUrl(
Uri.parse('https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'),
)
..initialize().then((_) {
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
),
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}Alternatives
Packages that do the same job and could replace video_player.
Works with
Packages commonly used together with video_player: ones it builds on, ones built on it, and its own family.
- htmlvideo_player depends on itA Dart implementation of an HTML5 parser for strings and bytes.
- video_player_avfoundationvideo_player depends on itiOS and macOS implementation of the video_player plugin
- video_player_androidvideo_player depends on itAndroid implementation of the video_player plugin
- chewieBuilt on video_playerVideo player widget with Material/Cupertino controls
- fwfh_chewieBuilt on video_playerRender VIDEO tags using Chewie inside HtmlWidget
- stream_chat_flutterBuilt on video_playerFull-featured Flutter UI SDK for Stream Chat, providing ready‑made chat widgets and theming.
- wechat_assets_pickerBuilt on video_playerAn asset picker widget for images, videos, and audio based on WeChat's UI.
- genuiBuilt on video_playerGenerates and displays dynamic user interfaces in Flutter using AI.