videoview에서 동영상을 플레이할때 캡쳐해서 jpg로 저장하려고 합니다.
뷰에서 캡쳐해서 저장하는것처럼 해봤는데 videoview에서는 블랙화면으로 저장이됩니다.
다른 방법이 있는건지 아니면 접근자체가 잘못되었는지....
고수님들의 조언 부탁드립니다.^^
//
videoView.setDrawingCacheEnabled(true);
Bitmap bm = videoView.getDrawingCache();
FileOutputStream out = new FileOutputStream(path);
bm.compress(Bitmap.CompressFormat.JPEG, 100, out);
많은 시간이 지났지만 혹시나 해서요..ㅎ
private void moveScreenshot(VideoView view) {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource("/mnt/sdcard/동영상");
int currentPosition = view.getCurrentPosition(); // in
// millisecond
Toast.makeText(this,"Current Position: " + currentPosition + " (ms)",Toast.LENGTH_LONG).show();
Bitmap bmFrame = mediaMetadataRetriever.getFrameAtTime(currentPosition * 1000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC ); // unit in
// microsecond
if (bmFrame == null) {
Toast.makeText(this, "bmFrame == null!",Toast.LENGTH_LONG).show();
} else {
AlertDialog.Builder myCaptureDialog = new AlertDialog.Builder(this);
ImageView capturedImageView = new ImageView(this);
capturedImageView.setImageBitmap(bmFrame);
LayoutParams capturedImageViewLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
capturedImageView.setLayoutParams(capturedImageViewLayoutParams);
myCaptureDialog.setView(capturedImageView);
myCaptureDialog.show();
}
}




정식 sdk로는 불가능합니다.