Skip to content

Commit f46331e

Browse files
committed
Add function to launch vlc from Python
1 parent 0e5ee9e commit f46331e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/src/org/renpy/android/PythonService.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
import android.app.PendingIntent;
1111
import android.os.Process;
1212

13+
import android.content.Intent;
14+
import android.content.ComponentName;
15+
import android.net.Uri;
16+
1317
public class PythonService extends Service implements Runnable {
1418

1519
// Thread for Python code
@@ -24,6 +28,8 @@ public class PythonService extends Service implements Runnable {
2428
private String pythonServiceArgument;
2529
public static Service mService = null;
2630

31+
private static Context thisContext;
32+
2733
@Override
2834
public IBinder onBind(Intent arg0) {
2935
return null;
@@ -32,6 +38,8 @@ public IBinder onBind(Intent arg0) {
3238
@Override
3339
public void onCreate() {
3440
super.onCreate();
41+
42+
PythonService.thisContext = this.getApplicationContext();
3543
}
3644

3745
@Override
@@ -108,6 +116,17 @@ public void run(){
108116
pythonServiceArgument);
109117
}
110118

119+
public static void launchVLC(String URL)
120+
{
121+
//Intent i = new Intent(Intent.ACTION_MAIN);
122+
Intent i = new Intent(Intent.ACTION_VIEW);
123+
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
124+
//i.setComponent(new ComponentName("com.vlcdirect.vlcdirect", "com.vlcdirect.vlcdirect.URLStreamerActivity"));
125+
//i.putExtra("url", URL);
126+
i.setData(Uri.parse(URL));
127+
PythonService.thisContext.startActivity(i);
128+
}
129+
111130
// Native part
112131
public static native void nativeStart(String androidPrivate, String androidArgument,
113132
String pythonHome, String pythonPath,

0 commit comments

Comments
 (0)