Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
01439c1c
Commit
01439c1c
authored
8 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Add MediaUtils.getContentMediaUri util method
parent
3954f3d6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/src/org/videolan/vlc/StartActivity.java
+1
-16
1 addition, 16 deletions
vlc-android/src/org/videolan/vlc/StartActivity.java
vlc-android/src/org/videolan/vlc/media/MediaUtils.java
+22
-0
22 additions, 0 deletions
vlc-android/src/org/videolan/vlc/media/MediaUtils.java
with
23 additions
and
16 deletions
vlc-android/src/org/videolan/vlc/StartActivity.java
+
1
−
16
View file @
01439c1c
...
...
@@ -108,22 +108,7 @@ public class StartActivity extends Activity {
}
// Media or MMS URI
else
if
(
TextUtils
.
equals
(
data
.
getAuthority
(),
"media"
)){
try
{
Cursor
cursor
=
getContentResolver
().
query
(
data
,
new
String
[]{
MediaStore
.
Video
.
Media
.
DATA
},
null
,
null
,
null
);
if
(
cursor
!=
null
)
{
int
column_index
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Video
.
Media
.
DATA
);
if
(
cursor
.
moveToFirst
())
mUri
=
AndroidUtil
.
PathToUri
(
cursor
.
getString
(
column_index
));
cursor
.
close
();
}
else
// other content-based URI (probably file pickers)
mUri
=
data
;
}
catch
(
Exception
e
)
{
mUri
=
data
;
if
(
mUri
.
getScheme
()
==
null
)
mUri
=
AndroidUtil
.
PathToUri
(
mUri
.
getPath
());
Log
.
e
(
TAG
,
"Couldn't read the file from media or MMS"
);
}
mUri
=
MediaUtils
.
getContentMediaUri
(
data
);
}
else
{
ParcelFileDescriptor
inputPFD
;
try
{
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/media/MediaUtils.java
+
22
−
0
View file @
01439c1c
...
...
@@ -4,9 +4,12 @@ import android.app.ProgressDialog;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.provider.MediaStore
;
import
android.support.v4.content.LocalBroadcastManager
;
import
org.videolan.libvlc.util.AndroidUtil
;
import
org.videolan.vlc.PlaybackService
;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.VLCApplication
;
...
...
@@ -144,6 +147,25 @@ public class MediaUtils {
return
title
;
}
public
static
Uri
getContentMediaUri
(
Uri
data
)
{
Uri
uri
=
null
;
try
{
Cursor
cursor
=
VLCApplication
.
getAppContext
().
getContentResolver
().
query
(
data
,
new
String
[]{
MediaStore
.
Video
.
Media
.
DATA
},
null
,
null
,
null
);
if
(
cursor
!=
null
)
{
int
column_index
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Video
.
Media
.
DATA
);
if
(
cursor
.
moveToFirst
())
uri
=
AndroidUtil
.
PathToUri
(
cursor
.
getString
(
column_index
));
cursor
.
close
();
}
else
// other content-based URI (probably file pickers)
uri
=
data
;
}
catch
(
Exception
e
)
{
uri
=
data
;
if
(
uri
.
getScheme
()
==
null
)
uri
=
AndroidUtil
.
PathToUri
(
uri
.
getPath
());
}
return
uri
!=
null
?
uri
:
data
;
}
private
static
String
getMediaString
(
Context
ctx
,
int
id
)
{
if
(
ctx
!=
null
)
return
ctx
.
getResources
().
getString
(
id
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment