i'm making and android application that stream a video from external source and display it in a videoview in my activity. The stream working fine, but i'm unable to save a frame on my sd card. this is my code where vv is videoview:
int currentPosition = vv.getCurrentPosition(); //in millisecond
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(viewSource);
Bitmap bmFrame = mediaMetadataRetriever.getFrameAtTime(currentPosition * 1000); //unit in microsecond
if(bmFrame == null){
Toast.makeText(MainActivity.this,
"bmFrame == null!",
Toast.LENGTH_LONG).show();
}else{
AlertDialog.Builder myCaptureDialog =
new AlertDialog.Builder(MainActivity.this);
ImageView capturedImageView = new ImageView(MainActivity.this);
capturedImageView.setImageBitmap(bmFrame);
LayoutParams capturedImageViewLayoutParams =
new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
capturedImageView.setLayoutParams(capturedImageViewLayoutParams);
myCaptureDialog.setView(capturedImageView);
myCaptureDialog.show();
this is my video test url:
public String viewSource = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
i try to set viewSourc for 'setdatasource' of the mediametadataretriver like the url to my video, but it return always null bitmap...
where is the problem?
Thankyou