public class VideoIntent extends ContentIntent<VideoIntent>
ContentIntent implementation providing API for building and starting of intents to obtain
or preview a video content.ContentIntent.ContentHandler| Modifier and Type | Field and Description |
|---|---|
static int |
REQUEST_CODE_CAMERA
Flag to identify request code used to obtain video using camera.
|
static int |
REQUEST_CODE_GALLERY
Flag to identify request code used to obtain video from gallery.
|
static String |
VIDEO_FILE_NAME_FORMAT
Default format for video file name.
|
CONTENT_FILE_TIME_STAMP_FORMAT| Constructor and Description |
|---|
VideoIntent() |
| Modifier and Type | Method and Description |
|---|---|
static Intent |
createCameraIntent()
Same as
createCameraIntent(File) with null for outputFile
parameter. |
static Intent |
createCameraIntent(File outputFile)
Same as
createCameraIntent(Uri) with outputUri created from the given
outputFile if not null. |
static Intent |
createCameraIntent(Uri outputUri)
Creates a new instance of Intent with
MediaStore.ACTION_VIDEO_CAPTURE that can be used
to launch a camera app to capture a single video. |
static Intent |
createGalleryIntent()
Creates a new instance of Intent with
Intent.ACTION_GET_CONTENT and MimeType.VIDEO
MIME type that can be used to launch a gallery app (depends on user's choice) to pick one of
available videos. |
static File |
createVideoFile()
Same as
createVideoFile(String) with fileName in VIDEO_FILE_NAME_FORMAT
format with the current time stamp provided by ContentIntent.createContentFileTimeStamp(). |
static File |
createVideoFile(String fileName)
Same as
ContentIntent.createContentFile(String, String) with .mp4 suffix for the specified
fileName (if it does not contain any) and Environment.DIRECTORY_MOVIES as
externalDirectoryType. |
VideoIntent |
input(Uri uri)
If the passed uri is not
null, the current data (MIME) type will be by
default set to MimeType.VIDEO. |
protected ContentIntent.ContentHandler |
onCreateCameraHandler(Resources resources)
Invoked from
withDefaultHandlers(Context) to create camera intent handler. |
protected ContentIntent.ContentHandler |
onCreateGalleryHandler(Resources resources)
Invoked from
withDefaultHandlers(Context) to create gallery intent handler. |
VideoIntent |
output(Uri uri)
Sets an output uri for a video to be captured by the camera.
|
VideoIntent |
withDefaultHandlers(Context context)
Adds two default
ContentHandlers. |
build, createContentFile, createContentFile, createContentFileTimeStamp, dataType, dataType, ensureCanBuildOrThrow, handlers, input, onBuild, onShowChooserDialog, onStartWith, output, startWith, uri, withHandler, withHandlers, withHandlersactivityNotFoundMessage, activityNotFoundMessage, cannotBuildIntentException, dialogTitle, dialogTitle, enterTransition, enterTransition, exitTransition, exitTransition, isActivityForIntentAvailable, notifyActivityNotFound, transitionspublic static final int REQUEST_CODE_GALLERY
public static final int REQUEST_CODE_CAMERA
public static final String VIDEO_FILE_NAME_FORMAT
Constant value: VIDEO_%s
@NonNull public static Intent createGalleryIntent()
Intent.ACTION_GET_CONTENT and MimeType.VIDEO
MIME type that can be used to launch a gallery app (depends on user's choice) to pick one of
available videos.@NonNull public static Intent createCameraIntent()
createCameraIntent(File) with null for outputFile
parameter.@NonNull public static Intent createCameraIntent(@Nullable File outputFile)
createCameraIntent(Uri) with outputUri created from the given
outputFile if not null.outputFile - The desired file used to crate the output Uri.createCameraIntent()@NonNull public static Intent createCameraIntent(@Nullable Uri outputUri)
MediaStore.ACTION_VIDEO_CAPTURE that can be used
to launch a camera app to capture a single video.outputUri - If not null, it will be attached to intent as MediaStore.EXTRA_OUTPUT,
so when the result is received in for example Activity.onActivityResult(int, int, Intent),
the outputUri will address to a file which contains the currently
captured video.createCameraIntent(File)@Nullable public static File createVideoFile()
createVideoFile(String) with fileName in VIDEO_FILE_NAME_FORMAT
format with the current time stamp provided by ContentIntent.createContentFileTimeStamp().@Nullable public static File createVideoFile(@NonNull String fileName)
ContentIntent.createContentFile(String, String) with .mp4 suffix for the specified
fileName (if it does not contain any) and Environment.DIRECTORY_MOVIES as
externalDirectoryType.fileName - The desired name for the video file.createVideoFile()public VideoIntent withDefaultHandlers(@NonNull Context context)
ContentHandlers. One for REQUEST_CODE_GALLERY and second one
for REQUEST_CODE_CAMERA.withDefaultHandlers in class ContentIntent<VideoIntent>@NonNull protected ContentIntent.ContentHandler onCreateGalleryHandler(@NonNull Resources resources)
withDefaultHandlers(Context) to create gallery intent handler.
This method may be override to create a handler with a localized name.
resources - Application resources.onCreateCameraHandler(Resources)@NonNull protected ContentIntent.ContentHandler onCreateCameraHandler(@NonNull Resources resources)
withDefaultHandlers(Context) to create camera intent handler.
This method may be override to create a handler with a localized name.
resources - Application resources.onCreateGalleryHandler(Resources)public VideoIntent input(@Nullable Uri uri)
null, the current data (MIME) type will be by
default set to MimeType.VIDEO.input in class ContentIntent<VideoIntent>uri - The desired uri, which should be delivered to the handling activity. May be
null to clear the current one.ContentIntent.uri()public VideoIntent output(@Nullable Uri uri)
output in class ContentIntent<VideoIntent>uri - If not null, it will be attached to ContentHandler holding intent
with the REQUEST_CODE_CAMERA request code, so when the camera handler's
item will be selected within a chooser dialog and user confirms his captured
video, result for this action will be received in for example Activity.onActivityResult(int, int, Intent).
The passed uri will then address to a file which contains the currently
captured video.ContentIntent.uri()