I'm using the following snippet within a class's onCreate that extends ImageView

MediaMetadataRetriever retrieve = new MediaMetadataRetriever();
            retrieve.setDataSource(name);
long Duration = Long.parseLong(retrieve.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));

            for (int frame = 0; frame < Duration; frame += 300)  {
                parent.removeAllViews();
                Bitmap  pict = retrieve.getFrameAtTime(frame);
Log.e("Media" , "Video Loading    " + frame);
                Matrix matrix = new Matrix();
                float scale = 680.0f / pict.getHeight();
                matrix.postScale(scale, scale);
Bitmap image = Bitmap.createBitmap(pict, 0, 0, pict.getWidth(), pict.getHeight(), matrix, true); layers[1] = new BitmapDrawable(mBitmap); layers[1].setAlpha(255); layers[0] = new BitmapDrawable(image); layers[0].setAlpha(255);
                LayerDrawable layerDraw = new LayerDrawable(layers);
                super.setImageDrawable(layerDraw);

                parent.setBackgroundColor(Color.BLACK);
parent.addView(this , new LayoutParams(LayoutParams.FILL_PARENT , LayoutParams.FILL_PARENT));
            }
Log.e("Media" , "Video LoadED    ");

What I can't understand is that is runs through the loop fine, but it only shows the first frame ?

parent is the FrameLayout within which the  ImageView is to be shown .

Can anyone shed light on this

Thanks in advance ?


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