Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Viewing a Captured Video1:13 with Ben Jakuben
Let's see how to handle the result of a recorded video, which is very similar to how we handle a photo.
Now let's handle the result of a recorded video just like we did for an image.
So let's scroll up to our result handler.
In here, we can add a new check for the video request type.
So here, after we check for REQUEST_TAKE_PHOTO,
let's add else if (requestCode == REQUEST _TAKE_VIDEO).
In here, we can create another intent.
Intent, intent equals a new Intent and we wanna pass into parameters here.
The first is (Intent.ACTION_VIEW),
and the second parameter is the URI of the video, which is in mMediaUrI.
Next we need to set the date and type for this intent.
Note that this is a little bit different for a video.
Different media types have different considerations.
So we can say intent.setDataAndType and
will pass in mMediaUri and the type is video slash,
we could put MP4 but I'm gonna video slash star.
Finally, we can start the activity with startActivity for the intent.
Unfortunately, it's really hard to play a video in an emulator.
But if you do try this on a device,
you should be able to view the video in one of your video players.
You need to sign up for Treehouse in order to download course files.Sign up