Wednesday, June 16, 2010

[android-developers] Re: parse local media file to get Mime type

If you know the path, you can access all the details through the
MediaStore content provider.

Cursor cursor = managedQuery(Uri.parse(data.getDataString()), null,
null, null, null);
cursor.moveToNext();

// Retrieve the path and the mime type
String path = cursor.getString(cursor
.getColumnIndex(MediaStore.MediaColumns.DATA));
String mimeType = cursor.getString(cursor
.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE));

For this, you need to know the ContentURI of the image/video.

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 15, 4:30 pm, chetan achar <chetan...@gmail.com> wrote:
> There is a file called Mediafile.java and MediaScanner.java in
> frameworks base. Just go through it.
>
>
>
> On Tue, Jun 15, 2010 at 4:46 PM, allstars <allstars....@gmail.com> wrote:
> > hi
> > i would like to get the mime type of my local media file (3gpp ,
> > mp4, ...etc)
>
> > if it is of video
> > then i want to allocate a SurfaceView for it additionally
> > otherwise i just use MediaPlayer to play it
>
> > i have found opencore has provided some interface for that
> > and used by mediascanner.cpp
>
> > but it seems in android media framework it isnt
>
> > so can i achieve this by using android media framework?
>
> > thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> With Regards,
> Chetz

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment