nq_media_player 1.0.1 copy "nq_media_player: ^1.0.1" to clipboard
nq_media_player: ^1.0.1 copied to clipboard

A flutter plugin that uses key commands to play and pause the music player of the mobile phone system and switch between the top and bottom songs.

nq_media_player #

A flutter plugin that uses key commands to play and pause the music player of the mobile phone system and switch between the top and bottom songs.

Static Badge Static BadgeStatic Badge Flutter.io

Features #

#

You can use this plug-in to switch the top and bottom of the mobile phone system player, play and pause, and monitor the playback status.

Getting started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Usage #

  • Get plugin instance
  final NqMediaPlayer _player = NqMediaPlayer();
  • Check initial music state
  Future<void> _checkInitialMusicState() async {
    try {
      final bool isPlaying = await _player.isMusicOn();
      if (mounted) {
        setState(() => _isPlaying = isPlaying);
      }
    } catch (e) {
      debugPrint('Error checking initial music state: $e');
    }
  }
  • Setup music listene
  void _setupMusicListener() {
    _player.musicStateStream.listen(
      (bool isPlaying) {
        if (mounted) {
          setState(() => _isPlaying = isPlaying);
        }
      },
      onError: (error) {
        debugPrint('Error in music state stream: $error');
      },
    );
  }
  • Switch the home page up and down
_player.lastMusic();
_player.nextMusic();

Additional information #

More information about this package

0
likes
150
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plugin that uses key commands to play and pause the music player of the mobile phone system and switch between the top and bottom songs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on nq_media_player

Packages that implement nq_media_player