[Android] AudioService: add playIndex()
Edward Wang
git at videolan.org
Thu Aug 29 18:26:36 CEST 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Aug 29 16:19:59 2013 +0200| [460b528e3feec079212ba8039eb10c86e484cb63] | committer: Edward Wang
AudioService: add playIndex()
Documentation is in the comments
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=460b528e3feec079212ba8039eb10c86e484cb63
---
vlc-android/src/org/videolan/vlc/AudioService.java | 30 ++++++++++++++++++++
.../org/videolan/vlc/AudioServiceController.java | 7 +++++
.../org/videolan/vlc/interfaces/IAudioService.aidl | 1 +
3 files changed, 38 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 13d370c..ff52270 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -935,6 +935,36 @@ public class AudioService extends Service {
AudioService.this.saveCurrentMedia();
}
+ /**
+ * Use this function to play a media inside whatever MediaList LibVLC is following.
+ *
+ * Unlike load(), it does not import anything into the primary list.
+ */
+ @Override
+ public void playIndex(int index) {
+ if (index < mLibVLC.getMediaList().size()) {
+ mCurrentIndex = index;
+ } else {
+ Log.w(TAG, "Warning: index " + index + " out of bounds");
+ mCurrentIndex = 0;
+ }
+ reloadMetadataCache();
+
+ mEventHandler.addHandler(mVlcEventHandler);
+ mLibVLC.playIndex(mCurrentIndex);
+ mLibVLC.applyEqualizer();
+ setUpRemoteControlClient();
+ showNotification();
+ updateWidget(AudioService.this);
+ updateRemoteControlClientMetadata();
+ }
+
+ /**
+ * Use this function to show an URI in the audio interface WITHOUT
+ * interrupting the stream.
+ *
+ * Mainly used by VideoPlayerActivity in response to loss of video track.
+ */
@Override
public void showWithoutParse(int index) throws RemoteException {
String URI = mLibVLC.getMediaList().getMRL(index);
diff --git a/vlc-android/src/org/videolan/vlc/AudioServiceController.java b/vlc-android/src/org/videolan/vlc/AudioServiceController.java
index f70b25a..f221e5c 100644
--- a/vlc-android/src/org/videolan/vlc/AudioServiceController.java
+++ b/vlc-android/src/org/videolan/vlc/AudioServiceController.java
@@ -258,6 +258,13 @@ public class AudioServiceController implements IAudioPlayerControl {
updateAudioPlayer();
}
+ public void playIndex(int i) {
+ remoteProcedureCall(mAudioServiceBinder, Void.class, (Void)null, "playIndex",
+ new Class<?>[] { int.class },
+ new Object[] { i } );
+ updateAudioPlayer();
+ }
+
@Override
public String getAlbum() {
return remoteProcedureCall(mAudioServiceBinder, String.class, (String)null, "getAlbum", null, null);
diff --git a/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl b/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
index 6c3ea30..695c510 100644
--- a/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
+++ b/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
@@ -51,5 +51,6 @@ interface IAudioService {
void removeAudioCallback(IAudioServiceCallback cb);
void detectHeadset(boolean enable);
void showWithoutParse(int index);
+ void playIndex(int index);
float getRate();
}
More information about the Android
mailing list