available_video_players 3.0.0
available_video_players: ^3.0.0 copied to clipboard
A Flutter plugin for Android to retrieve a list of installed video player applications.
available_video_players #
A Flutter plugin to retrieve all installed video player apps on Android, designed for seamless integration in Flutter applications. This plugin currently supports retrieving installed video players on Android only.
Features #
- Retrieve a list of installed video player apps on Android
- Get app names and package names of installed video players
- Get app icons as Base64-encoded strings
- Simple API to access installed video player data
Installation #
Add available_video_players as a dependency in your pubspec.yaml file:
dependencies:
available_video_players: <latest version>
If you are working on the plugin directly or planning to install it from GitHub before publishing to pub.dev, you can add it like this:
dependencies:
available_video_players:
git:
url: https://github.com/yourusername/available_video_players.git
Then, run:
flutter pub get
Usage #
-
Import the Plugin
In your Dart code, import theavailable_video_playerspackage:import 'package:available_video_players/available_video_players.dart'; import 'dart:convert'; import 'dart:typed_data'; -
Get Installed Video Players
Use thegetInstalledVideoPlayersmethod to get a list of installed video player apps on the device.List<VideoPlayerApp> videoPlayers = await AvailableVideoPlayers.getInstalledVideoPlayers(); videoPlayers.forEach((app) { print('App Name: ${app.appName}'); print('Package Name: ${app.packageName}'); print('Has Icon: ${app.icon != null}'); }); -
Display App Icons
The app icons are provided as Base64-encoded strings. You can decode and display them using Flutter'sImage.memorywidget:Widget buildVideoPlayerList() { return FutureBuilder<List<VideoPlayerApp>>( future: AvailableVideoPlayers.getInstalledVideoPlayers(), builder: (context, snapshot) { if (snapshot.hasData) { return ListView.builder( itemCount: snapshot.data!.length, itemBuilder: (context, index) { final app = snapshot.data![index]; return ListTile( leading: app.icon != null ? Image.memory( base64Decode(app.icon!), width: 40, height: 40, ) : Icon(Icons.video_library), title: Text(app.appName), subtitle: Text(app.packageName), ); }, ); } return CircularProgressIndicator(); }, ); }
Notes #
- This plugin works on Android only.
- The list of installed video players is retrieved based on the apps' package names.
- App icons are provided as Base64-encoded PNG images.
License #
MIT License. See LICENSE file for details.