mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 19:31:12 +00:00
Register tutorial 5 as a media player, so other applications (including browsers) can pass URIs to us. Unfortunately, the complete list of supported protocols and file extensions has to be provided, as Android does not seem to infer MIME types from file names.
This commit is contained in:
parent
fe3c684e90
commit
73ca70339c
2 changed files with 50 additions and 1 deletions
|
@ -19,11 +19,47 @@
|
|||
<activity
|
||||
android:name=".Tutorial5"
|
||||
android:label="@string/app_name" >
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Local files whose type is known to Android -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:mimeType="audio/*" />
|
||||
<data android:mimeType="video/*" />
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Links from the browser. The list of extensions and supported
|
||||
protocols can certainly be extended. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:pathPattern=".*\\.avi" />
|
||||
<data android:pathPattern=".*\\.AVI" />
|
||||
<data android:pathPattern=".*\\.mkv" />
|
||||
<data android:pathPattern=".*\\.MKV" />
|
||||
<data android:pathPattern=".*\\.webm" />
|
||||
<data android:pathPattern=".*\\.WEBM" />
|
||||
<data android:pathPattern=".*\\.ogv" />
|
||||
<data android:pathPattern=".*\\.OGV" />
|
||||
<data android:pathPattern=".*\\.mp4" />
|
||||
<data android:pathPattern=".*\\.MP4" />
|
||||
<data android:pathPattern=".*\\.qt" />
|
||||
<data android:pathPattern=".*\\.QT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.lamerman.FileDialog"
|
||||
|
|
|
@ -118,7 +118,20 @@ public class Tutorial5 extends Activity implements SurfaceHolder.Callback, OnSee
|
|||
} else {
|
||||
is_playing_desired = false;
|
||||
position = duration = 0;
|
||||
mediaUri = defaultMediaUri;
|
||||
Intent intent = getIntent();
|
||||
android.net.Uri uri = intent.getData();
|
||||
if (uri == null)
|
||||
mediaUri = defaultMediaUri;
|
||||
else {
|
||||
Log.i ("GStreamer", "Received URI: " + uri);
|
||||
if (uri.getScheme().equals("content")) {
|
||||
android.database.Cursor cursor = getContentResolver().query(uri, null, null, null, null);
|
||||
cursor.moveToFirst();
|
||||
mediaUri = "file://" + cursor.getString(cursor.getColumnIndex(android.provider.MediaStore.Video.Media.DATA));
|
||||
cursor.close();
|
||||
} else
|
||||
mediaUri = uri.toString();
|
||||
}
|
||||
Log.i ("GStreamer", "Activity created with no saved state:");
|
||||
}
|
||||
is_local_media = false;
|
||||
|
|
Loading…
Reference in a new issue