There still is no official way of doing this as far as I can tell. It
can however be done I've discovered!

The only thing you need is the java file for MediaMetadataRetriever
from the cupcake source:
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=media/java/android/media/MediaMetadataRetriever.java;hb=HEAD

Save that file as MediaMetadataRetriever.java under <project name>/src/
android/media/ and update your eclipse project so it shows up in the
package explorer. Then just use it like any other class:

import android.media.MediaMetadataRetriever;
....
        private Bitmap getVideoFrame(String uri) {
            MediaMetadataRetriever retriever = new
MediaMetadataRetriever();
            try {
                retriever.setMode
(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY);
                retriever.setDataSource(uri);
                return retriever.captureFrame();
            } catch(IllegalArgumentException ex) {
                ex.printStackTrace();
            } catch (RuntimeException ex) {
                ex.printStackTrace();
            } finally {
                try {
                    retriever.release();
                } catch (RuntimeException ex) { }
            }
            return null;
        }

Note that this is an unofficial way of doing it and it will only work
in cupcake (and maybe later version). The Android team does not
guarantee that libmedia_jni.so, which the java file uses, will be
included or have the same interface in future versions.

-Anders Haglund

On Jun 13, 9:52 pm, Ty <ty.mcdowell...@gmail.com> wrote:
> If anyone has a clue let us know!
>
> Thanks much!
>
> On May 5, 9:34 pm, Ty <ty.mcdowell...@gmail.com> wrote:
>
> > Apparently this was added with Cupcake.  I cannot find it.  Anyone
> > know how to create a video thumbnail?
>
> > Ty
>
> > On Apr 5, 8:54 pm, Wei <twc0...@gmail.com> wrote:
>
> > > Hi Dave,
>
> > > Are you meaning I can not use this class in my own application?
> > > But in MediaPlayerPerformance.java(framework folder), it can import
> > > MediaMetadataRetriever.
> > > Is any lib I need to load or ....?
> > > Please give me some hint
>
> > > - wei
>
>

--~--~---------~--~----~------------~-------~--~----~
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