now_playing_view 0.0.1 copy "now_playing_view: ^0.0.1" to clipboard
now_playing_view: ^0.0.1 copied to clipboard

A Flutter plugin for iOS that provides easy integration with Now Playing controls and information display, allowing developers to update media playback information and handle remote control events.

NowPlaying #

NowPlaying is a Flutter plugin that provides easy integration with iOS Now Playing controls and information display. This package allows you to update the Now Playing information and handle remote control events for media playback.

Features #

  • Update Now Playing information (title, artist, duration, current time, playback rate, and image URL)
  • Handle remote control events (play, pause, next track, previous track, and seek)
  • Easy initialization and setup

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  now_playing: ^0.0.1

Then run:

flutter pub get

OR

flutter pub add now_playing

Usage #

Initialization #

Before using the NowPlaying functionality, you need to initialize it with the necessary event handlers:

NowPlaying.instance.initialize(
  onPlay: () {
    // Handle play event
  },
  onPause: () {
    // Handle pause event
  },
  onNextTrack: () {
    // Handle next track event
  },
  onPreviousTrack: () {
    // Handle previous track event
  },
  onSeek: (time) {
    // Handle seek event
  },
);

Updating Now Playing Information #

You can update the Now Playing information at any time using the updateNowPlayingInfo method:

await NowPlaying.instance.updateNowPlayingInfo(
  title: 'Song Title',
  artist: 'Artist Name',
  duration: 180.0, // Total duration in seconds
  currentTime: 45.0, // Current playback position in seconds
  playbackRate: 1.0, // Playback rate (1.0 for normal speed)
  imageUrl: 'https://example.com/album_cover.jpg',
);

Notes #

  • This plugin currently supports iOS only. Android support may be added in future versions.
  • Make sure to call initialize() before using any other methods of the NowPlaying instance.
  • The imageUrl parameter in updateNowPlayingInfo should be a valid URL to an image file.

License #

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

Issues and Feedback #

Please file specific issues, bugs, or feature requests in our issue tracker.

Author #

Deepidoo ([email protected])

1
likes
0
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for iOS that provides easy integration with Now Playing controls and information display, allowing developers to update media playback information and handle remote control events.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on now_playing_view

Packages that implement now_playing_view