<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div> </div>
<div>Hi,<br></div>
<div> </div>
<div>On Wed, Apr 8, 2015, at 22:19, Guillaume wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><div><span style="font-size:16.5px" class="size">Forgot to attach the actual patch:</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size">---</span><br></div>
<div><span style="font-size:16.5px" class="size"> .../src/org/videolan/vlc/audio/AudioService.java | 27 ++++++++++++++++++++++</span><br></div>
<div><span style="font-size:16.5px" class="size"> 1 file changed, 27 insertions(+)</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size">diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java</span><br></div>
<div><span style="font-size:16.5px" class="size">index 090ef6f..f99334d 100644</span><br></div>
<div><span style="font-size:16.5px" class="size">--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java</span><br></div>
<div><span style="font-size:16.5px" class="size">+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java</span><br></div>
<div><span style="font-size:16.5px" class="size">@@ -819,6 +819,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> mHandler.removeMessages(SHOW_PROGRESS);</span><br></div>
<div><span style="font-size:16.5px" class="size"> // hideNotification(); <-- see event handler</span><br></div>
<div><span style="font-size:16.5px" class="size"> mLibVLC.pause();</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> }</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size"> private void play() {</span><br></div>
<div><span style="font-size:16.5px" class="size">@@ -828,6 +829,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> mHandler.sendEmptyMessage(SHOW_PROGRESS);</span><br></div>
<div><span style="font-size:16.5px" class="size"> showNotification();</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateWidget(this);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> }</span><br></div>
<div><span style="font-size:16.5px" class="size"> }</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size">@@ -840,6 +842,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> mPrevious.clear();</span><br></div>
<div><span style="font-size:16.5px" class="size"> mHandler.removeMessages(SHOW_PROGRESS);</span><br></div>
<div><span style="font-size:16.5px" class="size"> hideNotification();</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> executeUpdate();</span><br></div>
<div><span style="font-size:16.5px" class="size"> executeUpdateProgress();</span><br></div>
<div><span style="font-size:16.5px" class="size"> changeAudioFocus(false);</span><br></div>
<div><span style="font-size:16.5px" class="size">@@ -928,6 +931,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> setUpRemoteControlClient();</span><br></div>
<div><span style="font-size:16.5px" class="size"> showNotification();</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateWidget(this);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateRemoteControlClientMetadata();</span><br></div>
<div><span style="font-size:16.5px" class="size"> saveCurrentMedia();</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size">@@ -991,6 +995,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> setUpRemoteControlClient();</span><br></div>
<div><span style="font-size:16.5px" class="size"> showNotification();</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateWidget(this);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateRemoteControlClientMetadata();</span><br></div>
<div><span style="font-size:16.5px" class="size"> saveCurrentMedia();</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size">@@ -1227,6 +1232,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> setUpRemoteControlClient();</span><br></div>
<div><span style="font-size:16.5px" class="size"> showNotification();</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateWidget(AudioService.this);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(AudioService.this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateRemoteControlClientMetadata();</span><br></div>
<div><span style="font-size:16.5px" class="size"> AudioService.this.saveMediaList();</span><br></div>
<div><span style="font-size:16.5px" class="size"> AudioService.this.saveCurrentMedia();</span><br></div>
<div><span style="font-size:16.5px" class="size">@@ -1258,6 +1264,7 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> setUpRemoteControlClient();</span><br></div>
<div><span style="font-size:16.5px" class="size"> showNotification();</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateWidget(AudioService.this);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcastMetadata(AudioService.this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> updateRemoteControlClientMetadata();</span><br></div>
<div><span style="font-size:16.5px" class="size"> determinePrevAndNextIndices();</span><br></div>
<div><span style="font-size:16.5px" class="size"> }</span><br></div>
<div><span style="font-size:16.5px" class="size">@@ -1478,6 +1485,26 @@ public class AudioService extends Service {</span><br></div>
<div><span style="font-size:16.5px" class="size"> sendBroadcast(i);</span><br></div>
<div><span style="font-size:16.5px" class="size"> }</span><br></div>
<div> </div>
<div><span style="font-size:16.5px" class="size">+ private void broadcastMetadata(Context context) {</span><br></div>
<div><span style="font-size:16.5px" class="size">+ MediaWrapper media = getCurrentMedia();</span><br></div>
<div><span style="font-size:16.5px" class="size">+ if (media == null)</span><br></div>
<div><span style="font-size:16.5px" class="size">+ return;</span><br></div>
<div><span style="font-size:16.5px" class="size">+ String track = media.getTitle();</span><br></div>
<div><span style="font-size:16.5px" class="size">+ String artist = Util.getMediaArtist(this, media);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ String album = Util.getMediaAlbum(this, media);</span><br></div>
</div>
</blockquote><div> </div>
<div>You should use media.getArtist() and media.getAlbum() instead of the Util functions. Indeed the Util functions return the translation of "Unknown Artist/Album" if the artist/album are NULL and we don't want that. Maybe if artist or album are null you can abort and don't send the broadcast too.<br></div>
<div> </div>
<blockquote type="cite"><div dir="ltr"><div><span style="font-size:16.5px" class="size">+ long duration = media.getLength();</span><br></div>
<div><span style="font-size:16.5px" class="size">+ boolean playing = mLibVLC.isPlaying();</span><br></div>
<div><span style="font-size:16.5px" class="size">+</span><br></div>
<div><span style="font-size:16.5px" class="size">+ Intent broadcast = new Intent("com.android.music.metachanged");</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcast.putExtra("track", track);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcast.putExtra("artist", artist);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcast.putExtra("album", album);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcast.putExtra("duration", duration);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ broadcast.putExtra("playing", playing);</span><br></div>
<div><span style="font-size:16.5px" class="size">+</span><br></div>
<div><span style="font-size:16.5px" class="size">+ context.sendBroadcast(broadcast);</span><br></div>
<div><span style="font-size:16.5px" class="size">+ }</span><br></div>
<div><span style="font-size:16.5px" class="size">+</span><br></div>
<div><span style="font-size:16.5px" class="size"> private synchronized void loadLastPlaylist() {</span><br></div>
<div><span style="font-size:16.5px" class="size"> SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);</span><br></div>
<div><span style="font-size:16.5px" class="size"> String currentMedia = prefs.getString("current_media", "");</span><br></div>
</div>
</blockquote><div> </div>
<div>Otherwise, fine with me, thanks for you contribution.<br></div>
<div> </div>
<blockquote type="cite"><div dir="ltr"><div><span style="font-size:16.5px" class="size">-- </span><br></div>
<div><span style="font-size:16.5px" class="size">2.3.5</span><br></div>
<div style="font-size:16.5px;line-height:24.75px"> </div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>vlc-devel mailing list<br></div>
<div>To unsubscribe or modify your subscription options:<br></div>
<div><a defang_rel="noreferrer" href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div>
</blockquote><div> </div>
</body>
</html>