[Android] src: Allow opening network streams
Edward Wang
git at videolan.org
Wed Jun 20 05:51:21 CEST 2012
android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Jun 19 23:50:26 2012 -0400| [b544c6386a736d0b6bf41575001ae626caf91997] | committer: Edward Wang
src: Allow opening network streams
Close #6964
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=b544c6386a736d0b6bf41575001ae626caf91997
---
.../src/org/videolan/vlc/gui/MainActivity.java | 21 ++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 7f7c791..d5588c0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -24,12 +24,15 @@ import java.util.ArrayList;
import org.videolan.vlc.AudioServiceController;
import org.videolan.vlc.LibVLC;
+import org.videolan.vlc.LibVlcException;
+import org.videolan.vlc.Media;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.audio.AudioActivityGroup;
import org.videolan.vlc.gui.audio.AudioPlayerActivity;
import org.videolan.vlc.gui.video.VideoActivityGroup;
import org.videolan.vlc.gui.video.VideoListAdapter;
+import org.videolan.vlc.gui.video.VideoPlayerActivity;
import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.widget.AudioMiniPlayer;
@@ -245,10 +248,20 @@ public class MainActivity extends TabActivity {
b.setView(input);
b.setPositiveButton("Open", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int button) {
- AudioServiceController c = AudioServiceController.getInstance();
- ArrayList<String> media = new ArrayList<String>();
- media.add(input.getText().toString());
- c.append(media);
+ AudioServiceController c = AudioServiceController.getInstance();
+ String s = input.getText().toString();
+
+ if(!LibVLC.getExistingInstance().hasVideoTrack(s)) {
+ Log.d(TAG, "Auto-detected audio for " + s);
+ ArrayList<String> media = new ArrayList<String>();
+ media.add(input.getText().toString());
+ c.append(media);
+ } else {
+ Log.d(TAG, "Auto-detected Video for " + s);
+ Intent intent = new Intent(getApplicationContext(), VideoPlayerActivity.class);
+ intent.putExtra("itemLocation", s);
+ startActivity(intent);
+ }
}
}
);
More information about the Android
mailing list