// Get your video file
File myVideo = new File(path);
// URI to your video file
Uri myVideoUri = Uri.parse(myVideo.toString());
// MediaMetadataRetriever instance
MediaMetadataRetriever mmRetriever = new MediaMetadataRetriever();
mmRetriever.setDataSource(myVideo.getAbsolutePath());
// Array list to hold your frames
ArrayList<Bitmap> frames = new ArrayList<Bitmap>();
// Some kind of iteration to retrieve the frames and add it to Array list
Log.w(TAG,"covert start 4-1");
for(int i=0;i<3;i++)
{
for(int j=0;j<30;j++)
{
frames.add(mmRetriever.getFrameAtTime(i*1000000+j*33333, MediaMetadataRetriever.OPTION_CLOSEST_SYNC));
Log.w(TAG,"covert count//" + i );
}
}
Log.w(TAG,"covert end 4-1");
/////////////////////////////////////////////////////////////////
ArrayList<Drawable> drawableanimation = new ArrayList<Drawable>();
for(int i=0;i<frames.size();i++)
{
drawableanimation.add(new BitmapDrawable(frames.get(i))); frameAnimation.addFrame(drawableanimation.get(i), 50);
}
Log.w(TAG,"declarer 4-2");
//////////////////////////////////////////////////////////////////
view = (ImageView) findViewById(R.id.imageAnimation);
Log.w(TAG,"bitmaptodrawable 4-3");
view.setBackgroundDrawable(frameAnimation);
frameAnimation = (AnimationDrawable) view.getBackground();
이렇게 짜봤는데..계속 out of memory? 계속 그렇게 뜨네요 ㅠㅠ
그래서 bitmap.recycle() 해봤는데.. 그러면 문제가 cannot draw recycled Bitmap 에러가 뜨는데...
아무튼..ㅠㅠ 살려주세요 과연 뭐가 문제인가요 ㅠㅠ 아니면
동영상을 받아서 Frame animation으로 만들 방법은 없나요??