> My bad, that method does not exist. You'll need to get an
> AssetFileDescriptor for your resource, and then use
> setDataSource(FileDescriptor, long, long) with the FileDescriptor, offset
> and length from that AssetFileDescriptor.
>
> I was wondering. I had never heard that before, and I did read that
>
> > state description.
> > If I missed it I figure others might be making the same mistake.
>
> Yes, this exact issue has come up in the past on this list.- Hide quoted text 
> -
>

You said I needed AssetFileDescriptor and setDataSource to run video
from the raw folder.  I believe I figured
those out but only the sound plays.  Here is the code.  How do I set
up the display
for the MediaPlayer?

       AssetFileDescriptor afd = getResources().openRawResourceFd
(R.raw.myvideofile);

       MediaPlayer mp = new MediaPlayer();
       try {
                       mp.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());
                       mp.prepare();
               } catch (IllegalArgumentException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               } catch (IllegalStateException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               } catch (IOException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }
       mp.start();

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

Reply via email to