system_media_controller 0.0.2 system_media_controller: ^0.0.2 copied to clipboard
System Media Control package is a Flutter package that allows you to control the media on the system.(only android)
System Media Controller plugin #
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();
}
});