Android Programming Press on the image to return to the main documentation page.

iMedia

List of types:

AudioRecorder
Camera
LLCamera
VideoView

AudioRecorder

AudioRecorder allows you to record audio from the device microphone (or connected headset).
The audio is saved to a file.

Events:

None

Members:


  Initialize (Dir As String, FileName As String, SampleRate As Int, Mono As Boolean, Encoding As Int, MPEG4 As Boolean)

  Initialize2 (Dir As String, FileName As String, Settings As Map)

  IsInitialized As Boolean

  Record

  Stop

  Tag As Object

Members description:

Initialize (Dir As String, FileName As String, SampleRate As Int, Mono As Boolean, Encoding As Int, MPEG4 As Boolean)
Initializes the recorder and sets the file that will hold the record data.
Dir / FileName - The audio will be written to this file. Existing file will be deleted.
SampleRate - Sample rate in Hz. Common values: 44100, 22050 and 11025.
Mono - True for one channel false for two channels.
Encoding - 8 bit or 16 bit encoding.
MPEG4 - Whether to use MPEG4 encoding or linear PCM.
Initialize2 (Dir As String, FileName As String, Settings As Map)
Similar to Initialize. Allows you to set the recorder settings. See Apple documentation for more information about the possible settings.
IsInitialized As Boolean
Tests whether this object was initialized.
Record
Starts recording.
Stop
Stops recording.
Tag As Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.

Camera

Lets the user choose a photo from the stored photos or take a photo with the camera.
Note that only portrait orientation is supported.

Events:

Complete (Success As Boolean, Image As Bitmap, VideoPath As String)

Members:


  FrontCamera As Boolean

  Initialize (EventName As String, Page As Page)

  IsSupported As Boolean [read only]

  IsVideoSupported As Boolean [read only]

  SelectFromPhotoLibrary (FromView As Object, MediaType As Int)

  SelectFromSavedPhotos (FromView As Object, MediaType As Int)

  TakePicture

  TakeVideo

  TYPE_ALL As Int [read only]

  TYPE_IMAGE As Int [read only]

  TYPE_MOVIE As Int [read only]

Members description:

FrontCamera As Boolean
Gets or sets whether the front camera will be used by default.
Initialize (EventName As String, Page As Page)
Initializes the object and sets the image picker parent.
IsSupported As Boolean [read only]
Checks whether camera is supported.
IsVideoSupported As Boolean [read only]
Checks whether video camera is supported.
SelectFromPhotoLibrary (FromView As Object, MediaType As Int)
Shows the photo library dialog. This dialog allows the user to select an image or movie from the device photo library.
The Complete event will be raised.
FromView - Relevant for iPad only. The dialog arrow will point to this view or BarButton.
MediaType - One of the TYPE constants.
SelectFromSavedPhotos (FromView As Object, MediaType As Int)
Shows the saved photos dialog. This dialog allows the user to select an image or movie from the device camera roll album.
The Complete event will be raised.
FromView - Relevant for iPad only. The dialog arrow will point to this view or BarButton.
MediaType - One of the TYPE constants.
TakePicture
Shows the camera dialog. The camera will be set in image mode.
Make sure to handle the Complete event
TakeVideo
Shows the camera dialog. The camera will be set in video mode.
Make sure to handle the Complete event
TYPE_ALL As Int [read only]
TYPE_IMAGE As Int [read only]
TYPE_MOVIE As Int [read only]

LLCamera

Provides low level access to the camera.
This object allows you to embed the camera features inside your layout and provides more control over the camera settings.
You can also work with the preview frames directly.

Events:

PictureTaken (Data() As Byte)
Preview (Image As Bitmap)

Members:


  AuthorizationDenied As Boolean [read only]

  BeginConfiguration

  CommitConfiguration

  FLASH_AUTO As Int [read only]

  FLASH_OFF As Int [read only]

  FLASH_ON As Int [read only]

  FlashMode As Int

  Initialize (Panel As PanelWrapper, EventName As String, FrontCamera As Boolean)

  IsInitialized As Boolean

  PreserveRatio As Boolean

  Preset As String

  PRESET_1280x720 As String [read only]

  PRESET_1920x1080 As String [read only]

  PRESET_352x288 As String [read only]

  PRESET_640x480 As String [read only]

  PRESET_HIGH As String [read only]

  PRESET_LOW As String [read only]

  PRESET_MEDIUM As String [read only]

  PRESET_PHOTO As String [read only]

  ReleaseFrame (bmp As Bitmap)

  Resize

  StartPreview

  StopPreview

  TakePicture

  TORCH_AUTO As Int [read only]

  TORCH_OFF As Int [read only]

  TORCH_ON As Int [read only]

  TorchMode As Int

  Zoom As Float

  ZOOM_MAX As Float [read only]

Members description:

AuthorizationDenied As Boolean [read only]
Returns true if the user has denied the app from using the camera.
BeginConfiguration
Starts a configuration block. Call CommitConfiguration to commit the changes.
CommitConfiguration
Commits the changes and ends the configuration block.
FLASH_AUTO As Int [read only]
FLASH_OFF As Int [read only]
FLASH_ON As Int [read only]
FlashMode As Int
Gets or sets the flash mode. The value should be one of the FLASH constants.
You can only set this property inside a configuration block.
Initialize (Panel As PanelWrapper, EventName As String, FrontCamera As Boolean)
Initializes the camera.
Panel - The preview panel.
EventName - Sets the subs that will handle the events.
FrontCamera - If true then the front camera will be used (if a front camera is available).
IsInitialized As Boolean
PreserveRatio As Boolean
Gets or sets whether the preview image fills the panel (false) or the picture ratio is preserved.
Preset As String
Gets or sets the preset mode. The value should be one of the PRESET constants.
PRESET_1280x720 As String [read only]
PRESET_1920x1080 As String [read only]
PRESET_352x288 As String [read only]
PRESET_640x480 As String [read only]
PRESET_HIGH As String [read only]
PRESET_LOW As String [read only]
PRESET_MEDIUM As String [read only]
PRESET_PHOTO As String [read only]
ReleaseFrame (bmp As Bitmap)
This method should be called at the end of the Preview event with the bitmap passed as a parameter (only required if you are handling this event).
Resize
This method should be called whenever the preview panel is resized or the orientation changes.
StartPreview
Starts the data flow from the camera.
StopPreview
Stops the data flow.
TakePicture
Takes a picture. The PictureTaken event will be raised. Note that this method does not stop the data flow (like in B4A).
TORCH_AUTO As Int [read only]
TORCH_OFF As Int [read only]
TORCH_ON As Int [read only]
TorchMode As Int
Gets or sets the torch mode. The value should be one of the TORCH constants.
You can only set this property inside a configuration block.
Zoom As Float
Gets or sets the zoom factor. The value should be between 1 to ZOOM_MAX.
You can only set this property inside a configuration block.
ZOOM_MAX As Float [read only]
Gets the maximum zoom factor.

VideoView


Events:

Complete
Ready

Members:


  Duration As Int [read only]

  Initialize (EventName As String)

  LoadVideo (Dir As String, FileName As String)

  LoadVideoUrl (Url As String)

  Pause

  Play

  Position As Int

  ShowControls As Boolean

  Stop

  View As ViewWrapper [read only]

Members description:

Duration As Int [read only]
Returns the video duration in milliseconds. Returns 0 if the duration is not yet known.
Initialize (EventName As String)
Initializes the object.
LoadVideo (Dir As String, FileName As String)
Loads the video from the given path.
LoadVideoUrl (Url As String)
Streams the video from the given Url. The Ready event will fire when the buffer is ready.
Pause
Pauses the playback.
Play
Starts or resumes playback.
Position As Int
Gets or sets the current position, measured in milliseconds.
ShowControls As Boolean
Set to true to show the video control panel. The default value is true.
Stop
Stops playback and sets the position to 0.
View As ViewWrapper [read only]
Returns the view itself. You should use this property to add the view.
Top