Video player-2.2.10 - A Flutter plugin for iOS, Android and Web for playing back video on a Widget surface

Overview

Video Player plugin for Flutter

pub package

A Flutter plugin for iOS, Android and Web for playing back video on a Widget surface.

The example app running in iOS

Installation

First, add video_player as a dependency in your pubspec.yaml file.

iOS

This plugin requires iOS 9.0 or higher. Add the following entry to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

This entry allows your app to access video files by URL.

Android

Ensure the following permission is present in your Android Manifest file, located in <project root>/android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>

The Flutter project template adds it, so it may already be there.

Web

This plugin compiles for the web platform since version 0.10.5, in recent enough versions of Flutter (>=1.12.13+hotfix.4).

The Web platform does not suppport dart:io, so avoid using the VideoPlayerController.file constructor for the plugin. Using the constructor attempts to create a VideoPlayerController.file that will throw an UnimplementedError.

Different web browsers may have different video-playback capabilities (supported formats, autoplay...). Check package:video_player_web for more web-specific information.

The VideoPlayerOptions.mixWithOthers option can't be implemented in web, at least at the moment. If you use this option in web it will be silently ignored.

Supported Formats

  • On iOS, the backing player is AVPlayer. The supported formats vary depending on the version of iOS, AVURLAsset class has audiovisualTypes that you can query for supported av formats.
  • On Android, the backing player is ExoPlayer, please refer here for list of supported formats.
  • On Web, available formats depend on your users' browsers (vendor and version). Check package:video_player_web for more specific information.

Example

import 'package:video_player/video_player.dart';
import 'package:flutter/material.dart';

void main() => runApp(VideoApp());

class VideoApp extends StatefulWidget {
  @override
  _VideoAppState createState() => _VideoAppState();
}

class _VideoAppState extends State<VideoApp> {
  VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();
    _controller = VideoPlayerController.network(
        'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4')
      ..initialize().then((_) {
        // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
        setState(() {});
      });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Video Demo',
      home: Scaffold(
        body: Center(
          child: _controller.value.isInitialized
              ? AspectRatio(
                  aspectRatio: _controller.value.aspectRatio,
                  child: VideoPlayer(_controller),
                )
              : Container(),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _controller.value.isPlaying
                  ? _controller.pause()
                  : _controller.play();
            });
          },
          child: Icon(
            _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
          ),
        ),
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }
}

Usage

The following section contains usage information that goes beyond what is included in the documentation in order to give a more elaborate overview of the API.

This is not complete as of now. You can contribute to this section by opening a pull request.

Playback speed

You can set the playback speed on your _controller (instance of VideoPlayerController) by calling _controller.setPlaybackSpeed. setPlaybackSpeed takes a double speed value indicating the rate of playback for your video.
For example, when given a value of 2.0, your video will play at 2x the regular playback speed and so on.

To learn about playback speed limitations, see the setPlaybackSpeed method documentation.

Furthermore, see the example app for an example playback speed implementation.

You might also like...

Flutter Web application having splash screen and providing Web view Using web view packege.

Flutter Web application having splash screen and providing Web view Using web view packege.

Webview with Splash Screen in Flutter Flutter Web View With Splash Screen. Subscribe Our YouTube Channel. Visit Website Demo OutPut 🔗 Links Getting S

Dec 7, 2021

Android app to show movie ratings when browsing Netflix, Amazon Prime Video and other supported video streaming apps on the phone

Android app to show movie ratings when browsing Netflix, Amazon Prime Video and other supported video streaming apps on the phone

Flutter - Movie Ratings You can get the latest Playstore version here on Playstore - or download directly - 0.4.5 Screenshots of master Search Page Fa

Nov 23, 2022

Blog App Development Front-End and Back-End using Flutter, ExpressJs, NodeJS, and MongoDB

Blog App Development Front-End and Back-End using Flutter, ExpressJs, NodeJS, and MongoDB

Blog App Development Front-End and Back-End using Flutter, ExpressJs, NodeJS, and MongoDB

Dec 14, 2022

Better video player for Flutter, with multiple configuration options. Solving typical use cases!

Better video player for Flutter, with multiple configuration options. Solving typical use cases!

Better Player Advanced video player based on video_player and Chewie. It's solves many typical use cases and it's easy to run. Introduction This plugi

Jan 3, 2023

Windows95 UI components for Flutter apps. Bring back the nostalgic look and feel of old operating systems with this set of UI components ready to use.

Windows95 UI components for Flutter apps. Bring back the nostalgic look and feel of old operating systems with this set of UI components ready to use.

Flutter95 Windows95 UI components for Flutter apps. UNDER CONSTRUCTION Screenshots Components Scaffold95 Scaffold as a Windows95 styled window. Provid

Jan 2, 2023

This is a simple news app. It created using flutter as front-end and firebase as back end.

This is a simple news app. It created using flutter as front-end and firebase as back end. Only one person (Admin)can upload news. There is SignUp feature. Only one preDefined Admin who can login to account and upload news. It also uses Shared Preference for saving Admin's login inform.

Aug 5, 2022

A M.U.D (multi user dungeon) with a back end API built with nestjs and a front end UI built with Flutter.

Nest M.U.D - Getting Started Getting Started How to Play API Design A M.U.D (multi user dungeon) with a back end API built with nestjs and a front end

Aug 3, 2022

An app to remind you of all that you have borrowed and are afraid to forget when to pay it back.

An app to remind you of all that you have borrowed and are afraid to forget when to pay it back.

fech_mousel A new Flutter project. Click to any image to see it in full screen ! Register page : Login page : Home page(empty) : Add note(empty) : Add

Oct 10, 2021

Caffodils - Download everything | Flutter app for Android and IOS. Download Video, Reels, Shorts, Music, Images, Files from Instagram, Facebook and Youtube

caffodils Caffodils - Download everything Flutter app for Android and IOS. Download Video, Reels, Shorts, Music, Images, Files from Instagram, Faceboo

Oct 24, 2022
Owner
null
YoYo Video Player is a HLS(.m3u8) video player for flutter.

YoYo Video Player YoYo Video Player is a HLS(.m3u8) video player for flutter. The video_player is a video player that allows you to select HLS video s

Ko Htut 89 Dec 23, 2022
Munem Sarker 1 Jan 25, 2022
A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

cross_connectivity A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Androi

MarchDev Toolkit 29 Nov 15, 2022
Generate a new file by compressed video, and provide metadata. Get video thumbnail from a video path, supports JPEG/GIF. To reduce app size not using FFmpeg in IOS.

flutter_video_compress Generate a new path by compressed video, Choose to keep the source video or delete it by a parameter. Get video thumbnail from

天海るり 179 Dec 8, 2022
Flutter Music Player - First Open Source Flutter based material design music player with audio plugin to play local music files.

Flutter Music Player First Open Source Flutter based Beautiful Material Design Music Player(Online Radio will be added soon.) Demo App Play Store BETA

Pawan Kumar 1.5k Jan 8, 2023
A simple app to keep track the time you Learn, Playing, Reading, ... in every week. This is also my attempt to teach myself Flutter & Dart

Progressor 0.0.1 Sometime you want to set a target for you weekly, for example: "Reading Book for 8 hours every week". This app helps you to do that.

Son Nguyen Hoang 4 Oct 12, 2022
Amazing Flutter package for playing audio with a lot of features to offer.

Flutter_exoplayer A Flutter plugin that let's you play multiple audio files simultaneously with an option to choose if to play in background or as a f

Daniel 48 Aug 7, 2022
Flutter video player widget based on video_player

Neeko Simple video player widget based on video_player. Neek supports more actions such as timeline control, toggle fullscreen and so on. Note: This p

OpenFlutter 70 Oct 20, 2022
Just another tape player has been written in Flutter for iOS and Android

Just another tape player has been written in Flutter for iOS and Android. The application is able to find tapes and theirs images using https://zxInfo.dk public API and upload them to ZX-Spectrum compatible computers by the audio output of the smartphone. Now it supports TAP and TZX tape images only.

Andriy S'omak 28 Dec 28, 2022
null 357 Dec 27, 2022