Shakeeb Ayaz
Shakeeb Ayaz

Reputation: 6096

How to differentiate between audio 3gp file and video 3gp file

I have some audio 3gp file and video 3gp file .I need only video 3gp file but my query returning me both audio and video file.My Api level is8

Here is my query

 String[] data = { MediaStore.Video.Media.DATA };
 Cursor vid_cursor=this.managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,data, null, null, null);

I can filter it by checking the height, only video will return height as it is shown here but I don't want to calculate height everytime.

Upvotes: 1

Views: 765

Answers (1)

Biraj Zalavadia
Biraj Zalavadia

Reputation: 28484

Try this may helps you

String[] data = { MediaStore.Video.Media.DATA };
         Cursor vid_cursor=this.managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,data, MediaStore.Video.Media.HEIGHT+">0", null, null);

This will work with API level 16 and onward.

Update :for lower version (We need to check content type like this)

ursor vid_cursor=this.managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,data, MediaStore.Video.Media.CONTENT_TYPE +" like %video%", null, null);

Upvotes: 1

Related Questions