cinematic_video_player 1.0.0 copy "cinematic_video_player: ^1.0.0" to clipboard
cinematic_video_player: ^1.0.0 copied to clipboard

A modern, feature-rich Flutter video player with cinematic UI controls. Supports Android, iOS, Web, macOS, and Windows.

example/lib/main.dart

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Cinematic Video Player',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: const VideoPlayerDemoPage(),
    );
  }
}

class VideoPlayerDemoPage extends StatefulWidget {
  const VideoPlayerDemoPage({super.key});

  @override
  State<VideoPlayerDemoPage> createState() => _VideoPlayerDemoPageState();
}

class _VideoPlayerDemoPageState extends State<VideoPlayerDemoPage> {
  late CinematicVideoPlayerController _controller;

  // Sample video URL (Big Buck Bunny)
  final String videoUrl =
      'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';

  @override
  void initState() {
    super.initState();
    _controller = CinematicVideoPlayerController(
      onPlay: () => debugPrint('Video started playing'),
      onPause: () => debugPrint('Video paused'),
      onCompleted: () => debugPrint('Video playback completed'),
      onPositionChanged: (position) =>
          debugPrint('Current position: $position'),
      onError: (error) => debugPrint('Video error: $error'),
    );
  }

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey[900],
      appBar: AppBar(
        title: const Text('Cinematic Video Player Demo'),
        backgroundColor: Colors.black87,
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            // Video player
            CinematicVideoPlayer(
              source: VideoSource.network(videoUrl),
              controller: _controller,
              autoPlay: false,
              looping: false,
              showControls: true,
              allowFullscreen: true,
              allowPlaybackSpeed: true,
              allowVolume: true,
              aspectRatio: 16 / 9,
              progressIndicatorColor: Colors.red,
              backgroundColor: Colors.black,
              controlsBackgroundColor: Colors.black54,
              playPauseIconColor: Colors.white,
              playPauseIconSize: 56,
              durationTextColor: Colors.white,
              durationTextSize: 13,
              fullscreenIconColor: Colors.white,
              speedTextColor: Colors.white,
              speedTextSize: 13,
              onBackPressed: () => Navigator.pop(context),
            ),

            // Info section
            Padding(
              padding: const EdgeInsets.all(16.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  const Text(
                    'Big Buck Bunny',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 24,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  const SizedBox(height: 8),
                  const Text(
                    'A large and lovable rabbit deals with three bullying rodents.',
                    style: TextStyle(
                      color: Colors.white70,
                      fontSize: 16,
                    ),
                  ),
                  const SizedBox(height: 24),
                  // Controller demo buttons
                  const Text(
                    'External Controller Controls:',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 18,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  const SizedBox(height: 16),
                  Wrap(
                    spacing: 12,
                    runSpacing: 12,
                    children: [
                      ElevatedButton(
                        onPressed: () => _controller.togglePlayPause(),
                        child: const Text('Play/Pause'),
                      ),
                      ElevatedButton(
                        onPressed: () => _controller.rewind10Seconds(),
                        child: const Text('-10s'),
                      ),
                      ElevatedButton(
                        onPressed: () => _controller.forward10Seconds(),
                        child: const Text('+10s'),
                      ),
                      ElevatedButton(
                        onPressed: () => _controller.toggleMute(),
                        child: const Text('Toggle Mute'),
                      ),
                    ],
                  ),
                  const SizedBox(height: 24),
                  // Features list
                  const Text(
                    'Package Features:',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 18,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  const SizedBox(height: 16),
                  const _FeatureItem(
                      text: '✅ Auto-hiding controls with smooth animations'),
                  const _FeatureItem(
                      text: '✅ Fullscreen support across all platforms'),
                  const _FeatureItem(
                      text: '✅ Playback speed control (0.25x to 2.0x)'),
                  const _FeatureItem(text: '✅ Volume control and mute toggle'),
                  const _FeatureItem(text: '✅ 10-second seek forward/backward'),
                  const _FeatureItem(
                      text: '✅ Progress bar with buffering indicator'),
                  const _FeatureItem(
                      text: '✅ Keyboard shortcuts for desktop/web'),
                  const _FeatureItem(
                      text: '✅ Error handling with retry functionality'),
                  const _FeatureItem(
                      text: '✅ Loading and buffering indicators'),
                  const _FeatureItem(
                      text: '✅ Support for network, asset, and file videos'),
                  const _FeatureItem(
                      text: '✅ Supports MP4, and HLS where available'),
                  const _FeatureItem(text: '✅ Multi-quality video support'),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class _FeatureItem extends StatelessWidget {
  final String text;

  const _FeatureItem({required this.text});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 4.0),
      child: Text(
        text,
        style: const TextStyle(
          color: Colors.white70,
          fontSize: 14,
        ),
      ),
    );
  }
}
0
likes
140
points
82
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A modern, feature-rich Flutter video player with cinematic UI controls. Supports Android, iOS, Web, macOS, and Windows.

Homepage
Repository
View/report issues

License

MIT (license)

Dependencies

collection, flutter, path_provider, video_player, video_player_win

More

Packages that depend on cinematic_video_player

Packages that implement cinematic_video_player