mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-11 10:56:38 +00:00
Don't crash if no uri is passed in the intent
If we receive an intent with no attached data, don't throw a null pointer exception - just don't set a URI on the player.
This commit is contained in:
parent
1116ae85e2
commit
1e0b3ed778
1 changed files with 10 additions and 8 deletions
|
@ -133,15 +133,17 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC
|
|||
Intent intent = getIntent();
|
||||
android.net.Uri uri = intent.getData();
|
||||
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();
|
||||
if (uri != null) {
|
||||
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();
|
||||
}
|
||||
player.setUri(mediaUri);
|
||||
}
|
||||
player.setUri(mediaUri);
|
||||
|
||||
updateTimeWidget();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue