Class MediaServices
Provides cross-platform interface to access devices's media gallery and camera for picking images and playing videos.
Inheritance
Inherited Members
Namespace: VoxelBusters.EssentialKit
Assembly: cs.temp.dll.dll
Syntax
public static class MediaServices
Properties
UnitySettings
Declaration
public static MediaServicesUnitySettings UnitySettings { get; }
Property Value
Type | Description |
---|---|
MediaServicesUnitySettings |
Methods
CanCaptureImageFromCamera()
Returns a boolean value indicating whether the device supports capturing photo using camera.
Declaration
public static bool CanCaptureImageFromCamera()
Returns
Type | Description |
---|---|
System.Boolean |
|
CanSaveImageToGallery()
Returns a boolean value indicating whether the device supports saving image to gallery.
Declaration
public static bool CanSaveImageToGallery()
Returns
Type | Description |
---|---|
System.Boolean |
|
CanSelectImageFromGallery()
Returns a boolean value indicating whether the device supports picking media from gallery.
Declaration
public static bool CanSelectImageFromGallery()
Returns
Type | Description |
---|---|
System.Boolean |
|
CaptureImageFromCamera(Boolean, EventCallback<TextureData>)
Captures the photo from camera.
Declaration
public static void CaptureImageFromCamera(bool canEdit, EventCallback<TextureData> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canEdit | If set to |
EventCallback<TextureData> | callback | Callback method that will be invoked after operation is completed. |
CaptureImageFromCameraWithUserPermision(Boolean, EventCallback<TextureData>)
Captures the photo from camera after user grants required permissions.
Declaration
public static void CaptureImageFromCameraWithUserPermision(bool canEdit, EventCallback<TextureData> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canEdit | If set to |
EventCallback<TextureData> | callback | Callback method that will be invoked after operation is completed. |
GetCameraAccessStatus()
Returns the current authorization status provided to access the camera.
Declaration
public static CameraAccessStatus GetCameraAccessStatus()
Returns
Type | Description |
---|---|
CameraAccessStatus |
GetGalleryAccessStatus(GalleryAccessMode)
Returns the current authorization status provided to access the gallery.
Declaration
public static GalleryAccessStatus GetGalleryAccessStatus(GalleryAccessMode mode)
Parameters
Type | Name | Description |
---|---|---|
GalleryAccessMode | mode | The access mode your app is requesting. |
Returns
Type | Description |
---|---|
GalleryAccessStatus |
IsAvailable()
Declaration
public static bool IsAvailable()
Returns
Type | Description |
---|---|
System.Boolean |
RequestCameraAccess(Boolean, EventCallback<MediaServicesRequestCameraAccessResult>)
Requests for user permission to access the camera.
Declaration
public static void RequestCameraAccess(bool showPrepermissionDialog = true, EventCallback<MediaServicesRequestCameraAccessResult> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | showPrepermissionDialog | Indicates whether pre-confirmation is required, before prompting system permission dialog. |
EventCallback<MediaServicesRequestCameraAccessResult> | callback | Callback method that will be invoked after operation is completed. |
RequestGalleryAccess(GalleryAccessMode, Boolean, EventCallback<MediaServicesRequestGalleryAccessResult>)
Requests for user permission to access the gallery data.
Declaration
public static void RequestGalleryAccess(GalleryAccessMode mode, bool showPrepermissionDialog = true, EventCallback<MediaServicesRequestGalleryAccessResult> callback = null)
Parameters
Type | Name | Description |
---|---|---|
GalleryAccessMode | mode | The access mode your app is requesting. |
System.Boolean | showPrepermissionDialog | Indicates whether pre-confirmation is required, before prompting system permission dialog. |
EventCallback<MediaServicesRequestGalleryAccessResult> | callback | Callback method that will be invoked after operation is completed. |
SaveImageToGallery(String, Texture2D, EventCallback<MediaServicesSaveImageToGalleryResult>)
Saves the specified image to gallery.
Declaration
public static void SaveImageToGallery(string albumName, Texture2D image, EventCallback<MediaServicesSaveImageToGalleryResult> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | albumName | The album name to which image has to saved. |
Texture2D | image | Image to be saved. |
EventCallback<MediaServicesSaveImageToGalleryResult> | callback | Callback method that will be invoked after operation is completed. |
SaveImageToGallery(Texture2D, EventCallback<MediaServicesSaveImageToGalleryResult>)
Saves the specified image to gallery.
Declaration
public static void SaveImageToGallery(Texture2D image, EventCallback<MediaServicesSaveImageToGalleryResult> callback)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | image | Image to be saved. |
EventCallback<MediaServicesSaveImageToGalleryResult> | callback | Callback method that will be invoked after operation is completed. |
SaveImageToGalleryWithUserPermision(String, Texture2D, EventCallback<MediaServicesSaveImageToGalleryResult>)
Saves the specified image to gallery after user grants required permissions.
Declaration
public static void SaveImageToGalleryWithUserPermision(string albumName, Texture2D image, EventCallback<MediaServicesSaveImageToGalleryResult> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | albumName | The album name to which image has to saved. |
Texture2D | image | Image to be saved. |
EventCallback<MediaServicesSaveImageToGalleryResult> | callback | Callback method that will be invoked after operation is completed. |
SelectImageFromGallery(Boolean, EventCallback<TextureData>)
Opens the image picker window.
Declaration
public static void SelectImageFromGallery(bool canEdit, EventCallback<TextureData> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canEdit | If set to |
EventCallback<TextureData> | callback | Callback method that will be invoked after operation is completed. |
SelectImageFromGalleryWithUserPermision(Boolean, EventCallback<TextureData>)
Opens the image picker window after user grants required permissions.
Declaration
public static void SelectImageFromGalleryWithUserPermision(bool canEdit, EventCallback<TextureData> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canEdit | If set to |
EventCallback<TextureData> | callback | Callback method that will be invoked after operation is completed. |