deezer_playback 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 55

Deezer Playback #

Deezer Playback Plugin.

No iOS Implementation yet, WIP..

Features #

  • Connect / Authorize
  • Play (track)
  • Resume / pause
  • Queue
  • Playback position
  • Seek
  • Seek to relative position
  • Play Next
  • Play Previous
  • Repeat
  • Search For Tracks
  • Get Track

Installation #

IMPORTANT: Make sure you have the Deezer app installed and that you are logged in or your test device!

First, add deezer_playback as a dependency in your pubspec.yaml file.

Afterwards, download the Deezer Android SDK here and move the deezer-sdk--x.x.x.aar file to android/app/libs/ in your project.

IMPORTANT: Make sure you add permissions bellow to your Android Manifest located in /android/app/src/main/AndroidManifest.xml !

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-library android:name="org.apache.http.legacy" android:required="false" />

Then initialize the deezer playback sdk like this

@override
  void initState() {
    super.initState();
    initConnector();
    connect();
  }

  /// Initialize the Deezer playback sdk, by calling iniatilizeDeezer
  Future<void> initConnector() async {
    try {
      await DeezerPlayBack.iniatilizeDeezer(appId: "").then(
          (connected) {
        if (!mounted) return;
        // If the method call is successful, update the state to reflect this change
        setState(() {
          _connectedToDeezer = connected;
        });
      }, onError: (error) {
        // If the method call trows an error, print the error to see what went wrong
        print(error);
      });
    } on PlatformException {
      print('Failed to connect.');
    }
  }
  /// Initialize the Deezer playback sdk, by calling DeezerConnect
  Future<void> connect() async {
    try {
      await DeezerPlayback.connectToDeezer().then((authorised) {
        if (!mounted) return;
        // If the method call is successful, update the state to reflect this change
        setState(() {
          _connectedToDeezer = authorised;
        });
        print("we authorized deezer"+_connectedToDeezer.toString());
      }, onError: (error) {
        // If the method call trows an error, print the error to see what went wrong
        print(error);
      });
    } on PlatformException {
      print('Failed to connect.');
    }
  }

After this you can use all the available methods

Available methods #

Methoddescriptionparametersnotes
iniatilizeDeezerInitilizes the deezer playback sdkappId,
connectToDeezerConnect to deezer account
playPlay's a deezer track, album or playlisttrack Id
pausePause's the currently playing track
resumeResumes the currently paused track
skipNextPlay's the next track
skipPreviousPlay's the previous track
seekToSeeks to the passed timetime(mS)
seekToRelativePositionSeeks to relative position+-time(mS)
toggleRepeatToggle Repeat options
getPlaybackPositionGet's the current tracks playback position
searchTracksGet tracks by searchingany keyword
getTrackGet track by IDid(string)

Changelog #

See CHANGELOG.md.

Contributing #

Feel free to contribute by opening issues and/or pull requests. Your feedback is very welcome!

License #

MIT License

Copyright (c) [2019] [NARU ENTREPRISE]

[0.0.2] - 2019-11-10

  • Fixing Bugs

[0.0.1] - 2019-10-20

  • Deezer Remote Playback for Android
  • Deezer Web API
  • Fixing Minor Bugs

example/README.md

deezer_playback_example #

Demonstrates how to use the deezer_playback plugin.

Getting Started #

IMPORTANT: Make sure you have the Deezer app installed and that you are logged in or your test device!

First, add deezer_playback as a dependency in your pubspec.yaml file.

Afterwards, download the Deezer Android SDK here and move the deezer-sdk--x.x.x.aar file to android/app/libs/ in your project.

IMPORTANT: Make sure you add permissions bellow to your Android Manifest located in /android/app/src/main/AndroidManifest.xml !

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-library android:name="org.apache.http.legacy" android:required="false" />

Then initialize the deezer playback sdk like this

@override
  void initState() {
    super.initState();
    initConnector();
    connect();
  }

  /// Initialize the Deezer playback sdk, by calling iniatilizeDeezer
  Future<void> initConnector() async {
    try {
      await DeezerPlayBack.iniatilizeDeezer(appId: "").then(
          (connected) {
        if (!mounted) return;
        // If the method call is successful, update the state to reflect this change
        setState(() {
          _connectedToDeezer = connected;
        });
      }, onError: (error) {
        // If the method call trows an error, print the error to see what went wrong
        print(error);
      });
    } on PlatformException {
      print('Failed to connect.');
    }
  }
  /// Initialize the Deezer playback sdk, by calling DeezerConnect
  Future<void> connect() async {
    try {
      await DeezerPlayback.connectToDeezer().then((authorised) {
        if (!mounted) return;
        // If the method call is successful, update the state to reflect this change
        setState(() {
          _connectedToDeezer = authorised;
        });
        print("we authorized deezer"+_connectedToDeezer.toString());
      }, onError: (error) {
        // If the method call trows an error, print the error to see what went wrong
        print(error);
      });
    } on PlatformException {
      print('Failed to connect.');
    }
  }

After this you can use all the available methods

Available methods #

Methoddescriptionparametersnotes
iniatilizeDeezerInitilizes the deezer playback sdkappId,
connectToDeezerConnect to deezer account
playPlay's a deezer track, album or playlisttrack Id
pausePause's the currently playing track
resumeResumes the currently paused track
skipNextPlay's the next track
skipPreviousPlay's the previous track
seekToSeeks to the passed timetime(mS)
seekToRelativePositionSeeks to relative position+-time(mS)
toggleRepeatToggle Repeat options
getPlaybackPositionGet's the current tracks playback position
searchTracksGet tracks by searchingany keyword
getTrackGet track by IDid(string)

Use this package as a library

1. Depend on it

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


dependencies:
  deezer_playback: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:deezer_playback/deezer_playback.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
26
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Dec 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/deezer_playback.dart.

Run flutter format to format lib/deezer_playback.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (dio).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^2.1.16 2.2.2 3.0.7
flutter 0.0.0
json_annotation ^3.0.0 3.0.0
Transitive dependencies
collection 1.14.11 1.14.12
cookie_jar 1.0.1
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test