Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDigma Jain
1,602 PointsCrashed Video
When I take a Video it is Captured, But when I try to play it the Video Crashes..:(
3 Answers
Digma Jain
1,602 PointsHi justin, This My code:
case 1:
Intent videoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
mMediaUri = getOutputMediaFileUri(MEDIA_VIDEO);
if(mMediaUri == null)
{//Display Error
Toast.makeText
(MainActivity.this, "There was A Problem Accessing Your external storage device", Toast.LENGTH_LONG).show();
}
else
{
videoIntent.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
startActivityForResult(videoIntent,TAKE_VIDEO_REQUEST );
}
This is my code to take Video. And when I try to watch the Video After Capturing the Video Is Crashed..
Saleban Olow
Courses Plus Student 141 PointsThis is how I did and it works fine,
case 1: // take video Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); mMediaUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); if(mMediaUri == null){ // display an error
Toast.makeText(MainActivity.this, R.string.error_external_storage,
Toast.LENGTH_LONG).show();
}
else{
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
takeVideoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
takeVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
startActivityForResult(takeVideoIntent, TAKE_VIDEO_REQUEST);
}
break;
instead using "videoIntent" change to takeVideoIntent...
rtrind
6,358 PointsIn my case I was using Genymotion and it sometimes stops generating dummy images for camera. I restarted the emulator and it didn't crash anymore.
Justin Horner
Treehouse Guest TeacherJustin Horner
Treehouse Guest TeacherHello Digma,
If you would, please post your code and provide the error message(s) so it will be easier for us to help you :)