Media Components - AppyBuilder for Android

Table of Contents

Camcorder

A component to record a video using the device's camcorder.After the video is recorded, the name of the file on the phone containing the clip is available as an argument to the AfterRecording event. The file name can be used, for example, to set the source property of a VideoPlayer component.

Properties

none

Events

AfterRecording(text clip)
Indicates that a video was recorded with the camera and provides the path to the stored picture.

Methods

RecordVideo()
Records a video, then raises the AfterRecoding event.

Camera

Use a camera component to take a picture on the phone.

Camera is a non-visible component that takes a picture using the device's camera. After the picture is taken, the path to the file on the phone containing the picture is available as an argument to the AfterPicture event. The path can be used, for example, as the Picture property of an Image component.

Properties

none

Methods

TakePicture()
Opens the phone's camera to allow a picture to be taken.

Events

AfterPicture(Text image)
Called after the picture is taken. The text argument image is the path that can be used to locate the image on the phone.

ImagePicker

Use an image picker component to choose an image from your image gallery.

An image picker is a kind of button. When the user taps an image picker, the device's image gallery appears, and the user can choose an image. After the user picks an image, the property ImagePath is set to a text string that represents that image. You can then use that result, for example, to set the image of a button.

Properties

ImagePath
The image the user chose, represented as a text string that gives the location of the images.
Enabled
If true, image picker can be used.
BackgroundColor
Color for image picker background.
Enabled
If set, user can tap image picker to cause action.
FontBold
If set, image picker button text is displayed in bold.
FontItalic
If set, image picker button text is displayed in italics.
FontSize
Point size for image picker button text.
FontTypeface
Font family for image picker button text.
Height
image picker button height (y-size).
Width
image picker button width (x-size).
Image
Image to display on image picker button.
Text
Text to display on image picker button.
TextAlignment
Left, center, or right.
TextColor
Color for image picker button text.

Events

AfterPicking()
User selected an item from the image picker.
BeforePicking()
User has tapped the image picker but hasn't yet selected an item.
GotFocus()
Image picker became the focused component.
LostFocus()
Image picker is no longer the focused component.

Player

Use a player component to play an audio or video file, or to vibrate the phone.

Player is a non-visible component that plays audio or video and controls phone vibration. The name of a media file is specified in the Source property, which can be set in the Designer or in the Blocks Editor. To use a Player for streaming, set the Source inside the Blocks Editor to a text block with the URL. The length of time for a vibration is specified in the Blocks Editor in milliseconds (thousandths of a second). The volume should be an integer between 0 and 100.

See Android Supported Media Formats for more information on which types of files you can use.

Use a player component for playing long sound files, video files, and vibrating the phone. For playing short sound files, such as sound effects, use a Sound component instead.

Properties

IsLooping
If set, the media is looping.
IsPlaying
Whether the media is playing.
Source
Audio or video file associated with this player.
Volume
A number between 0 and 100.

Methods

Pause()
Pauses playing the audio or video file.
Start()
Starts playing the audio or video file.
Stop()
Stops playing the audio or video file.
Vibrate(number milliseconds)
Activate the phone's vibration motor for the given number of milliseconds.

Events

Completed()
Media has finished playing.

Sound

Use a sound component to play an audio file, or to vibrate the phone.

Sound is a non-visible component that plays sound files and vibrates for the number of milliseconds (thousandths of a second) specified in the Blocks Editor. The name of the sound file to play can be specified either in the Designer or in the Blocks Editor.

See Android Supported Media Formats for more information on which types of files you can use.

This component is best for short sound files, such as sound effects, while the Player component is more efficient for longer sounds, such as songs.

Properties

Source
Audio file associated with this sound.
MinimumInterval
Minimum time before sound is repeated.

Methods

Pause()
Pauses playing the audio file.
Play()
Starts playing the audio file.
Resume()
Resumes playing a paused audio file.
Stop()
Stops playing the audio file.
Vibrate(number millisecs)
Activate the phone's vibration motor for the given number of milliseconds.

SoundRecorder

Picture of Sound Recorder component

Multimedia component that records audio.

Properties

none

Events

AfterSoundRecorded(text sound)
Provides the location of the newly created sound.
StartedRecording()
Indicates that the recorder has started, and can be stopped.
StoppedRecording()
Indicates that the recorder has stopped, and can be started again.

Methods

Start ()
Starts recording.
Stop ()
Stops recording.

SpeechRecognizer

Picture of Speech Recognizer component

Use a speech recognizer component to listen to the user speaking and convert the spoken sound into text using Android's speech recognition feature.

Properties

Result
The last text produced by the recognizer.

Methods

GetText()
Asks the user to speak, and converts the speech to text. Signals the AfterGettingText event when the result is available.

Events

AfterGetting(Text result)
Signaled after the recognizer has produced text. The argument is the text result that was produced.
BeforeGettingText()
Signaled just before the recognizer is called.

TextToSpeech

Picture of Text to Speech component

Use a text-to-speech component to have the device speak text audibly.

In order for this component to work, the device must have the TTS Extended Service app by Eyes-Free Project installed. You can download this from http://code.google.com/p/eyes-free/downloads/list

The text-to-speech component has properties you can set to guide the pronunciation of the text to be spoken. These properties use three-letter codes to specify the language and the country in which the language is spoken. For example, you can specify British English or US English. For British English, the language code is eng and the country code is GBR , while for US English, the language code is eng and the country code is USA . The complete list is below.

Properties

Country
The country code for speech production.
Language
The language code for speech production.
Result
Details to come.

Methods

Speak(Text message)
Speaks the given text.

Events

AfterSpeaking(Text result)
Signaled after the text is spoken. The argument is the text result that was produced.
BeforeSpeaking()
Signaled just before the text is spoken.

Here are the language and country codes you can use. The codes are organized first by language; then, in each language section are a list of possible country codes:

  • ces (Czech)
    • CZE

  • spa (Spanish)
    • ESP
    • USA

  • deu (German)
    • AUT
    • BEL
    • CHE
    • DEU
    • LIE
    • LUX

  • fra (French)
    • BEL
    • CAN
    • CHE
    • FRA
    • LUX

  • nld (Dutch)
    • BEL
    • NLD

  • ita (Italian)
    • CHE
    • ITA

  • pol (Polish)
    • POL

  • eng (English)
    • AUS
    • BEL
    • BWA
    • BLZ
    • CAN
    • GBR
    • HKG
    • IRL
    • IND
    • JAM
    • MHL
    • MLT
    • NAM
    • NZL
    • PHL
    • PAK
    • SGP
    • TTO
    • USA
    • VIR
    • ZAF
    • ZWE

VideoPlayer

Use a VideoPlayer component to play a video file.

Video player is a media component that plays videos. A video player appears in your app as a rectangle. If the user taps the rectangle, media controls appear: play/pause, skip ahead, and skip backward. Your app can control playback behavior by calling the Start , Pause , and SeekTo methods.

Video files should be in Windows Media Video (.wmv), 3GPP (.3gp), or MPEG-4 (.mp4) format. For more details about formats, see Android Supported Media Formats .

AppyBuilder accepts video files up to 1 MB in size and limits the total size of an app to 5 MB, not all of which is available for media files. If your media files are too large, you might get errors when packaging or installing your app, in which case you should reduce the number of media files or their sizes. Video editing software, such as Windows Movie Maker or Apple iMovie, can help you decrease the size of videos by shortening them or re-encoding them into more compact formats.

Properties

Source
Video file associated with this player.
Visible
If set, VideoPlayer is visible.

Methods

Pause()
Pauses playing the video file.
Start()
Starts playing the video file.
SeekTo(number millisecs)
Seeks to the requested time (specified in milliseconds) in the video.
GetDuration()
Returns the duration of the video in milliseconds.