available_video_players 3.0.0 copy "available_video_players: ^3.0.0" to clipboard
available_video_players: ^3.0.0 copied to clipboard

PlatformAndroid

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 #

  1. Import the Plugin
    In your Dart code, import the available_video_players package:

    import 'package:available_video_players/available_video_players.dart';
    import 'dart:convert';
    import 'dart:typed_data';
    
  2. Get Installed Video Players
    Use the getInstalledVideoPlayers method 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}');
    });
    
  3. Display App Icons
    The app icons are provided as Base64-encoded strings. You can decode and display them using Flutter's Image.memory widget:

    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.

2
likes
160
points
96
downloads

Publisher

verified publisherappquirk.com

Weekly Downloads

A Flutter plugin for Android to retrieve a list of installed video player applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on available_video_players

Packages that implement available_video_players