Search packages, repositories and app categories

video_box cover
Package detailsv0.17.0

video_box

A control that plays video in flutter, I make the control as flexible as possible, can play a single video, video list on the page.

30-day downloads
356
Likes
23
Pub points
55

Install package

flutter pub add video_box

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

VideoBox is a flexible Flutter widget designed to play videos, supporting both single video playback and video lists within a page. Built with simplicity and adaptability in mind, it offers seamless integration for developers looking to embed video content in their apps. The control handles various video sources and provides a clean, customizable interface. It's ideal for media-rich applications requiring dynamic video display. The package is open-source and maintained by janauw.lol.

Use cases

  • Playing individual videos in a UI
  • Displaying video lists on a single screen
  • Integrating video content into media apps
  • Creating video galleries
  • Embedding videos in educational apps

Key features

  • Supports single video playback
  • Handles video lists efficiently
  • Highly customizable UI
  • Open-source and actively maintained
  • Simple integration via pub add

Suitable for

  • Developers building media applications
  • Apps requiring video playback features
  • Educational or entertainment platforms
  • Flutter projects with video content
  • Teams wanting lightweight video solutions

Considerations

  • No platform-specific details provided
  • Limited documentation mentioned
  • Requires manual handling of video source formats
  • Not optimized for very large video libraries
  • No built-in video controls beyond basic functionality

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

video_box

Play video in Flutter

note:

  • Only tested on android

android: <project root>/android/app/src/main/AndroidManifest.xml:

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

ios: <project root>/ios/Runner/Info.plist:

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

Usage

import 'package:flutter/material.dart';
import 'package:video_box/video.controller.dart';
import 'package:video_box/video_box.dart';
import 'package:video_player/video_player.dart';

class ListVideo extends StatefulWidget {
  @override
  _ListVideoState createState() => _ListVideoState();
}

class _ListVideoState extends State<ListVideo> {
  List<VideoController> vcs = [];

  @override
  void initState() {
    super.initState();
    for (var i = 0; i < 4; i++) {
      vcs.add(VideoController(source: VideoPlayerController.network(src1))
        ..initialize());
    }
  }

  @override
  void dispose() {
    for (var vc in vcs) {
      vc.dispose();
    }
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('list video'),
      ),
      body: ListView(
        children: <Widget>[
          for (var vc in vcs)
            Padding(
              padding: const EdgeInsets.only(top: 12.0),
              child: AspectRatio(
                aspectRatio: 16 / 9,
                child: VideoBox(controller: vc),
              ),
            ),
        ],
      ),
    );
  }
}

Catch the error during initialize

  vc = VideoController(
    source: VideoPlayerController.network('https://examole.com/a.mp4'),
  )
    ..addInitializeErrorListenner((e) {
      print('[video box init] error: ' + e.message);
    })
    ..initialize().then((e) {
      if (e != null) {
        print('[video box init] error: ' + e.message);
      } else {
        print('[video box init] success');
      }
    });

For details, see /example or source code.

show:

Categories

Dependencies

Dependency list 6 items

Source repository

Projects using this package

No data available yet.