<table><tr><td style="">mtijink created this revision.<br />mtijink added a reviewer: KDE Connect.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9266" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Adds a notification to show and control mpris players. It shows the title, artist etc. (so depends on <a href="https://phabricator.kde.org/D9083" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">D9083</a>, but can easily be adapted to work without it, but that leads to less features).</p>
<p>The notification appears as soon as one of your connected devices plays music. If multiple devices/players are playing, it shows the information and controls for only one of these. If it stops playing, it tries to switch to another playing device/player. If those do not exist, it shows the same player, but allows starting it again.</p>
<p>Dismissing the notification is only possible if the showed player is paused (as effect, only when all players are paused). It automatically closes if the device or player disappears or disconnects and no other players are playing. I think this behaviour is intuitive, other native android music players have similar behaviour.</p>
<p>About the implementation: there are two parts to this: the notification and the media session control API. The first shows the notification and its controls. The second allows lock screen controls on older Android versions and control using e.g. headphone buttons. Since nearly all code is shared between the two parts, and the rest is mostly straightforward, I put them in the same diff.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested on Android Nougat 7.1 (shows the notification with buttons, as expected; no lock screen controls, as expected) and Android Gingerbread 2.3 (shows a notification without buttons, lock screen controls work, so as expected).</p>
<p>I am not able to test with multiple desktops, so testing that would be appreciated.</p>
<p>Disabling buttons when not available should work, but all players I tested always allowed next/previous/play/pause.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R225 KDE Connect - Android application</div></div></div><br /><div><strong>BRANCH</strong><div><div>mpris-media-notification</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9266" rel="noreferrer">https://phabricator.kde.org/D9266</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>AndroidManifest.xml<br />
res/drawable/ic_next_white.xml<br />
res/drawable/ic_pause_white.xml<br />
res/drawable/ic_play_white.xml<br />
res/drawable/ic_previous_white.xml<br />
res/values/strings.xml<br />
src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisMediaNotificationReceiver.java<br />
src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisMediaSession.java<br />
src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java</div></div></div><br /><div><strong>To: </strong>mtijink, KDE Connect<br /></div>