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

PlatformAndroid

A Flutter video player that supports YouTube, Vimeo, and server links with custom controls.

example/lib/main.dart

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

void main() {
  runApp(const ExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Premium Video Player',
      theme: ThemeData.dark(useMaterial3: true),
      home: const ExampleHome(),
      debugShowCheckedModeBanner: false,
    );
  }
}

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

  @override
  State<ExampleHome> createState() => _ExampleHomeState();
}

class _ExampleHomeState extends State<ExampleHome> {
  PlayerController? _controller;
  bool _loading = false;
  final _input = TextEditingController(
    text:
        'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
  );

  Future<void> _load(String url) async {
    setState(() => _loading = true);
    final c = await PlayerController.create(url);
    setState(() {
      _controller = c;
      _loading = false;
    });
  }

  @override
  void initState() {
    super.initState();
    _load(_input.text);
  }

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('All-In-One Player'),
        actions: [
          if (_controller != null)
            IconButton(
              icon: const Icon(Icons.refresh),
              onPressed: () => _load(_input.text),
            ),
        ],
      ),
      body: Column(
        children: [
          Padding(
            padding: const EdgeInsets.all(12.0),
            child: Row(
              children: [
                Expanded(
                  child: TextField(
                    controller: _input,
                    decoration: InputDecoration(
                      labelText: 'Video URL (YouTube, Vimeo, MP4)',
                      border: OutlineInputBorder(
                        borderRadius: BorderRadius.circular(12),
                      ),
                      contentPadding: const EdgeInsets.symmetric(
                        horizontal: 16,
                        vertical: 8,
                      ),
                    ),
                  ),
                ),
                const SizedBox(width: 8),
                FilledButton(
                  onPressed: () => _load(_input.text),
                  style: FilledButton.styleFrom(
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(12),
                    ),
                  ),
                  child: const Text('Load'),
                ),
              ],
            ),
          ),
          Expanded(
            child: _loading
                ? const Center(child: CircularProgressIndicator())
                : _controller == null
                ? const Center(child: Text('Enter a URL and press Load'))
                : Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(16),
                      child: PlayerWidget(
                        controller: _controller!,
                        theme: PlayerTheme.premium,
                      ),
                    ),
                  ),
          ),
          if (_controller != null)
            Padding(
              padding: const EdgeInsets.all(16.0),
              child: Card(
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        "Title: ${_controller!.title ?? 'Unknown'}",
                        style: const TextStyle(fontWeight: FontWeight.bold),
                      ),
                      const SizedBox(height: 4),
                      Text(
                        "Source: ${_controller!.sourceType.name.toUpperCase()}",
                      ),
                      const SizedBox(height: 8),
                      const Text(
                        "Features: Double-tap to seek, Playback speed, Looping, Fullscreen support.",
                      ),
                    ],
                  ),
                ),
              ),
            ),
        ],
      ),
    );
  }
}
0
likes
160
points
126
downloads

Publisher

verified publisherrahulreza.com

Weekly Downloads

A Flutter video player that supports YouTube, Vimeo, and server links with custom controls.

Homepage
Repository (GitHub)
View/report issues

Topics

#player #video #youtube #vimeo #hls

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, video_player, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on all_in_one_video_player