D12559: [WIP] Add MprisReceiverPlugin (Android)

Matthijs Tijink noreply at phabricator.kde.org
Mon Apr 30 19:07:42 UTC 2018


mtijink requested changes to this revision.
mtijink added a comment.
This revision now requires changes to proceed.


  Sorry, thought of a couple of new things.
  
  I tested it, and there's still an issue: updates (e.g. after next/previous) aren't displayed in KCApp. I don't know on which side the issue is.
  Also, it is cool that I can control my pc's music via my phone's KDE Connect, but I think we should blacklist that.

INLINE COMMENTS

> MprisReceiverPlayer.java:43
> +
> +        if (controller.getPlaybackState() != null) {
> +            isPlaying = controller.getPlaybackState().getState() == PlaybackState.STATE_PLAYING;

What happens otherwise? It defaults to `false`?

> MprisReceiverPlayer.java:77
> +    String getAlbum() {
> +        String album = controller.getMetadata().getString(MediaMetadata.METADATA_KEY_ALBUM);
> +        return album != null ? album : "";

I think we need to check `controller.getMetadata()`, it can be `null`. See https://developer.android.com/reference/android/media/session/MediaController#getMetadata()

Also applies elsewhere.

> MprisReceiverPlayer.java:100
> +    int getVolume() {
> +        return 100 * controller.getPlaybackInfo().getCurrentVolume() / controller.getPlaybackInfo().getMaxVolume();
> +    }

Can also be `null`.

> nicolasfella wrote in MprisReceiverPlugin.java:187
> Did not find it yet

It looks as if the id is a package name, so we can look up the app name in most cases: https://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationInfo(java.lang.String,%20int) and https://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationLabel(android.content.pm.ApplicationInfo)

REPOSITORY
  R225 KDE Connect - Android application

REVISION DETAIL
  https://phabricator.kde.org/D12559

To: nicolasfella, #kde_connect, mtijink
Cc: mtijink, #kde_connect, yannux, Danial0_0, johnq, Pitel, adeen-s, SemperPeritus, ahmedbesbes, ndavis, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, menasshock, ach, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20180430/0952e748/attachment-0001.html>


More information about the KDEConnect mailing list