On Wed, May 27, 2009 at 11:02 AM, Hamy <hamilt...@gmail.com> wrote:

>
>
>
> On May 27, 12:39 pm, Marco Nelissen <marc...@android.com> wrote:
> > On Wed, May 27, 2009 at 10:23 AM, Hamy <hamilt...@gmail.com> wrote:
> >
> > > Marco,
> >
> > > Thank you so much! I just spent a day and a half trying every example
> > > I could get my hands on, and about 2 minutes before you replied I
> > > found a hint that video could not be a raw resource. I had just been
> > > adapting every example to include that, and it never occurred to me
> > > that might be the problem!
> >
> > > The dev guide I reference is here
> > >http://developer.android.com/guide/topics/media/index.html
> > > It is very lacking on video info in general, but in particular it
> > > never mentions that video cannot be a raw resource, and I never found
> >
> > That is not entirely true. You can't play video from a resource using any
> of
> > the MediaPlayer.create() convenience functions, however you can create a
> new
> > MediaPlayer with 'new' and then use setDataSource(int resourceid) to make
> it
> > play from a resource, including video.
> >
> Hm, I don't see that overload in
> http://developer.android.com/reference/android/media/MediaPlayer.html
> . All I see are:
> setDataSource(FileDescriptor), setDataSource(String), setDataSource
> (Context, Uri), setDataSource(FileDescriptor, long, long)
>
> I guess there is some way to get a FileDescriptor from the resourceID
> - I think there is, but I cannot remember it.


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.

--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to