Skip to content

System Media Control package is a Flutter package that allows you to control the media on the system (currently available for Android only).

License

Notifications You must be signed in to change notification settings

YugalAnvation/system_media_controller

 
 

Repository files navigation

System Media Controller plugin

pub package

System Media Control package is a Flutter package that allows you to control the media on the system.

currently available for Android only

Usage

To use this plugin, add system_media_controller as a dependency in your pubspec.yaml file.

Examples:

you can control current system media.

final _systemMediaController = SystemMediaController();

_systemMediaController.play();
_systemMediaController.pause();
_systemMediaController.skipNext();
_systemMediaController.skipPrevious();
_systemMediaController.fastForward();
_systemMediaController.rewind();

With FCM

If you use FCM(silent notification) with another Platforms(like Flutter Web), you can control the media being played on mobile from the another platforms.

// example fcm 
Map silentNotification = {
    'message': {
        'data': {
            'action': 'play'
        }
    }
}

FirebaseMessaging.onBackgroundMessage((message){
    /// ...another code
    final String? action = message.data['action'];
    if(action == 'play'){
        _systemMediaController.play();
    }
});

About

System Media Control package is a Flutter package that allows you to control the media on the system (currently available for Android only).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 74.0%
  • Kotlin 26.0%