all_in_one_video_player

A Flutter package providing an all-in-one video player widget that supports:

  • ▢️ YouTube (via WebView)
  • 🎞 Vimeo (via WebView)
  • πŸ“ Server-hosted videos (MP4/HLS) using video_player

All-In-One Video Player πŸš€

A high-performance, premium Flutter video player that seamlessly supports YouTube, Vimeo, and Direct Server Links (MP4, MKV, etc.) with a single unified controller.

Pub Version License: MIT


✨ Features

  • πŸ“± Multi-Source Support: Play YouTube, Vimeo, and server URLs (MP4/HLS) using the same widget.
  • 🎨 Premium UI: Modern, glassmorphism-inspired controls with smooth animations.
  • ⚑ Gestures: Double tap to seek (10s), Swipe for volume/brightness (coming soon).
  • βš™οΈ Playback Speed: Control speed from 0.5x to 2.0x.
  • πŸ”„ Looping: Easy toggle for continuous playback.
  • πŸ–ΌοΈ Thumbnail Support: Show a custom thumbnail while loading.
  • πŸ› οΈ Fully Customizable: Use PlayerTheme to match your app's branding.
  • πŸ“Ί Fullscreen: Intelligent orientation handling for an immersive experience.

πŸš€ Getting Started

Add the package to your pubspec.yaml:

dependencies:
  all_in_one_video_player: ^1.0.0

Android Setup

Ensure your minSdkVersion is 21 or higher in android/app/build.gradle.

iOS Setup

Add the following to your ios/Runner/Info.plist:

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


Here’s the updated README.md Step 3 section, with the fix added for YouTube short links:


βœ… Step 3: Use in UI

Supports YouTube short URLs like:

https://youtu.be/

Example usage:

final youtubeController = PlayerController(
  videoUrl: 'https://youtu.be/aPCl90cpdDo',
  sourceType: VideoSourceType.youtube,
);


Full UI Example with Buttons

class VideoPlayerDemoPage extends StatefulWidget {
  const VideoPlayerDemoPage({Key? key}) : super(key: key);

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

class _VideoPlayerDemoPageState extends State<VideoPlayerDemoPage> {
  final _youtube = PlayerController(
    videoUrl: 'https://youtu.be/aPCl90cpdDo?si=_xKtFJyqqgH1S9dU',
    sourceType: VideoSourceType.youtube,
  );
  final _vimeo = PlayerController(
    videoUrl: 'https://vimeo.com/264560738',
    sourceType: VideoSourceType.vimeo,
  );
  final _server = PlayerController(
    videoUrl: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
    sourceType: VideoSourceType.server,
  );

  late PlayerController _current;
  bool _isFullScreen = false;

  @override
  void initState() {
    super.initState();
    _current = _youtube;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: _isFullScreen ? null : AppBar(title: const Text('All-in-One Player')),
      body: Column(
        children: [
          AspectRatio(
            aspectRatio: 16 / 9,
            child: PlayerWidget(
              controller: _current,
              onFullScreenToggle: (value) => setState(() => _isFullScreen = value),
            ),
          ),
          if (!_isFullScreen)
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                ElevatedButton(onPressed: () => setState(() => _current = _youtube), child: const Text("YouTube")),
                ElevatedButton(onPressed: () => setState(() => _current = _vimeo), child: const Text("Vimeo")),
                ElevatedButton(onPressed: () => setState(() => _current = _server), child: const Text("Server")),
              ],
            ),
        ],
      ),
    );
  }
}

⚠️ Notes

  • πŸ“Ί Some YouTube/Vimeo videos may be blocked from embedding due to licensing or content settings.
  • 🌐 Web support is not included (this is Android/iOS only).
  • πŸ“± On Android, hybrid composition is used for WebView.

πŸ‘¨β€πŸ’» Author

Md. Rahul Reza πŸ”— rahulreza.com πŸ“¬ contact@rahulreza.com


Libraries

all_in_one_video_player
A premium Flutter video player that supports YouTube, Vimeo, and server links.