VideoView path problem

All your problems with Audio, Video and Images.

VideoView path problem

Postby sheikh.aman » Tue May 04, 2010 1:26 pm

I am using a VideoView to play videos.
it works smoothly.

with only one problem. i am able to provide path of video with this way-

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Uri uri = Uri.parse("android.resource://com.abc.def/"+ R.raw.vid);
  2.  
  3. video.setVideoURI(uri);
  4.  
  5. video.start();
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


but this is not what i want.
i want it to take the path dynamically, so that i can tell it the path according to the user selection.

any suggestions??
User avatar
sheikh.aman
Developer
Developer
 
Posts: 40
Joined: Sat Mar 20, 2010 7:52 am

Top

Postby sheikh.aman » Fri May 07, 2010 7:15 am

I found the solution myself.

I just do this-

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. int resId = getResources().getIdentifier("com.abc.xyz:raw/"+videoname,null,null);
  2.  
  3.         Uri uri = Uri.parse("android.resource://com.abc.xyz/"+ resId);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


then i continue with the same thing that i was doing.
in this way i was able to resolve the video name to an id, which videoview demands.
Impossible is Nothing
User avatar
sheikh.aman
Developer
Developer
 
Posts: 40
Joined: Sat Mar 20, 2010 7:52 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 14 guests