2025-10-24 14:45:18 -04:00
2022-10-01 19:13:43 +02:00
2023-06-05 10:44:56 +02:00
2022-05-05 15:35:06 +02:00
2025-09-24 00:44:40 +00:00
2022-05-05 15:35:06 +02:00
2023-09-30 21:05:03 +02:00
2022-05-06 10:46:44 +02:00
2023-06-05 10:52:51 +02:00
2022-05-05 15:35:06 +02:00
2023-10-19 13:54:04 +02:00
2022-05-05 15:35:06 +02:00
2023-10-19 13:54:04 +02:00
2022-10-03 14:36:25 +02:00
2026-03-11 17:43:03 +00:00

native_video_player

Pub

A Flutter widget to play videos on iOS and Android using a native implementation.

Android iOS
Support 16+ 9.0+

Implementation

Usage

Loading a video

@override
Widget build(BuildContext context) {
  return NativeVideoPlayerView(
    onViewReady: (controller) async {
      final videoSource = await VideoSource.init(
        path: 'path/to/file',
        type: VideoSourceType,
      );
      await controller.loadVideoSource(videoSource);
    },
  );
}

Listen to events

controller.onPlaybackReady.addListener(() {
  // Emitted when the video loaded successfully and it's ready to play.
  // At this point, videoInfo is available.
  final videoInfo = controller.videoInfo;
  final videoWidth = videoInfo.width;
  final videoHeight = videoInfo.height;
  final videoDuration = videoInfo.duration;
});
controller.onPlaybackStatusChanged.addListener(() {
  final playbackStatus = controller.playbackInfo.status;
  // playbackStatus can be playing, paused, or stopped. 
});
controller.onPlaybackPositionChanged.addListener(() {
  final playbackPosition = controller.playbackInfo.position;
});
controller.onPlaybackEnded.addListener(() {
  // Emitted when the video has finished playing.
});

Autoplay

controller.onPlaybackReady.addListener(() {
  controller.play();
});

Playback loop

controller.onPlaybackEnded.addListener(() {
  controller.play();
});

Advanced usage

See the example app for a complete usage example.

Support this project

Buy Me A Coffee

Other projects

🧰 exabox — Essential tools for developers: All the tools you need in one single app.

😃 Ejimo — Emoji and symbol picker

🗺️ WMap — Create beautiful, minimal, custom map wallpapers and backgrounds for your phone or tablet.

🎨 iro‿iro — Rearrange the colors to form beautiful patterns in this relaxing color puzzle game.

Credits

Created by @albemala (Twitter)

S
Description
A Flutter widget to play videos on iOS and Android using a native implementation.
Readme MIT
27 MiB
Languages
Dart 44.8%
Swift 33.3%
Kotlin 17.2%
Ruby 3.3%
Objective-C 1%
Other 0.4%