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
noneEvents
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
noneMethods
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
A special-purpose button. When the user taps an image picker, the device's image gallery appears, and the user can choose an image. After an image is picked, it is saved, and the
Selected
property will be the name of the file where the image is stored. In order to not fill up storage, a maximum of 10 images will be stored. Picking more images will delete previous images, in order from oldest to newest.Properties
BackgroundColor
- Returns the button's background color
Enabled
FontBold
(designer only)FontItalic
(designer only)FontSize
(designer only)FontTypeface
(designer only)Height
Image
- Specifies the path of the button's image. If there is both an Image and a BackgroundColor, only the Image will be visible.
Selection
- Path to the file containing the image that was selected.
Shape
(designer only)- Specifies the button's shape (default, rounded, rectangular, oval). The shape will not be visible if an Image is being displayed.
ShowFeedback
- Specifies if a visual feedback should be shown for a button that as an image as background.
Text
TextAlignment
(designer only)TextColor
Visible
- Specifies whether the component should be visible on the screen. Value is true if the component is showing and false if hidden.
Width
Events
AfterPicking()
- Simple event to be raised after the picker activity returns its result and the properties have been filled in.
BeforePicking()
- Simple event to raise when the component is clicked but before the picker activity is started.
GotFocus()
- Indicates the cursor moved over the button so it is now possible to click it.
LostFocus()
- Indicates the cursor moved away from the button so it is now no longer possible to click it.
Methods
Open()
- Opens the picker, as though the user clicked on it.
Player
Multimedia component that plays audio and controls phone vibration. The name of a multimedia field is specified in the
Source
property, which can be set in the Designer or in the Blocks Editor. The length of time for a vibration is specified in the Blocks Editor in milliseconds (thousandths of a second).
For supported audio formats, see Android Supported Media Formats.
This component is best for long sound files, such as songs, while the
Sound
component is more efficient for short files, such as sound effects.Properties
IsPlaying
- Reports whether the media is playing
Loop
- If true, the player will loop when it plays. Setting Loop while the player is playing will affect the current playing.
PlayOnlyInForeground
- If true, the player will pause playing when leaving the current screen; if false (default option), the player continues playing whenever the current screen is displaying or not.
Source
Volume
- Sets the volume to a number between 0 and 100
Events
Completed()
- Indicates that the media has reached the end
OtherPlayerStarted()
- This event is signaled when another player has started (and the current player is playing or paused, but not stopped).
Methods
Pause()
- Suspends playing the media if it is playing.
Start()
- Plays the media. If it was previously paused, the playing is resumed. If it was previously stopped, it starts from the beginning.
Stop()
- Stops playing the media and seeks to the beginning of the song.
Vibrate(number milliseconds)
- Vibrates for specified number of milliseconds.
Sound
A multimedia component that plays sound files and optionally 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.
For supported sound file formats, see Android Supported Media Formats.
This
Sound
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
MinimumInterval
- The minimum interval, in milliseconds, between sounds. If you play a sound, all further Play() calls will be ignored until the interval has elapsed.
Source
- The name of the sound file. Only certain formats are supported. See http://developer.android.com/guide/appendix/media-formats.html.
Events
noneMethods
Pause()
- Pauses playing the sound if it is being played.
Play()
- Plays the sound.
Resume()
- Resumes playing the sound after a pause.
Stop()
- Stops playing the sound if it is being played.
Vibrate(number millisecs)
- Vibrates for the specified number of milliseconds.
SoundRecorder
Multimedia component that records audio.
Properties
SavedRecording
- Specifies the path to the file where the recording should be stored. If this proprety is the empty string, then starting a recording will create a file in an appropriate location. If the property is not the empty string, it should specify a complete path to a file in an existing directory, including a file name with the extension .3gp.
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
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
The TestToSpeech component speaks a given text aloud. You can set the pitch and the rate of speech.
You can also set a language by supplying a language code. This changes the pronounciation of words, not the actual language spoken. For example, setting the language to French and speaking English text will sound like someone speaking English (en) with a French accent.
You can also specify a country by supplying a country code. This can affect the pronounciation. For example, British English (GBR) will sound different from US English (USA). Not every country code will affect every language.
The languages and countries available depend on the particular device, and can be listed with the AvailableLanguages and AvailableCountries properties.
Properties
AvailableCountries
- List of the country codes available on this device for use with TextToSpeech. Check the Android developer documentation under supported languages to find the meanings of these abbreviations.
AvailableLanguages
- List of the languages available on this device for use with TextToSpeech. Check the Android developer documentation under supported languages to find the meanings of these abbreviations.
Country
- Country code to use for speech generation. This can affect the pronounciation. For example, British English (GBR) will sound different from US English (USA). Not every country code will affect every language.
Language
- Sets the language for TextToSpeech. This changes the way that words are pronounced, not the actual language that is spoken. For example setting the language to French and speaking English text will sound like someone speaking English with a French accent.
Pitch
- Sets the Pitch for TextToSpeech. The values should be between 0 and 2 where lower values lower the tone of synthesized voice and greater values raise it.
Result
SpeechRate
- Sets the SpeechRate for TextToSpeech. The values should be between 0 and 2 where lower values slow down the pitch and greater values accelerate it.
Events
AfterSpeaking(boolean result)
- Event to raise after the message is spoken.
BeforeSpeaking()
- Event to raise when Speak is invoked, before the message is spoken.
Methods
Speak(text message)
- Speaks the given message.
VideoPlayer
A multimedia component capable of playing videos. When the application is run, the VideoPlayer will be displayed as a rectangle on-screen. If the user touches the rectangle, controls will appear to play/pause, skip ahead, and skip backward within the video. The application can also control behavior by calling the
Start
,Pause
, and SeekTo
methods.
Video files should be in 3GPP (.3gp) or MPEG-4 (.mp4) formats. For more details about legal formats, see Android Supported Media Formats.
App Inventor for Android only permits video files under 1 MB and limits the total size of an application to 5 MB, not all of which is available for media (video, audio, and sound) files. If your media files are too large, you may get errors when packaging or installing your application, in which case you should reduce the number of media files or their sizes. Most video editing software, such as Windows Movie Maker and Apple iMovie, can help you decrease the size of videos by shortening them or re-encoding the video into a more compact format.
You can also set the media source to a URL that points to a streaming video, but the URL must point to the video file itself, not to a program that plays the video.
Properties
FullScreen
Height
Source
- The "path" to the video. Usually, this will be the name of the video file, which should be added in the Designer.
Visible
- Specifies whether the component should be visible on the screen. Value is true if the component is showing and false if hidden.
Volume
- Sets the volume to a number between 0 and 100. Values less than 0 will be treated as 0, and values greater than 100 will be treated as 100.
Width
Events
Completed()
- Indicates that the video has reached the end
Methods
number GetDuration()
- Returns duration of the video in milliseconds.
Pause()
- Pauses playback of the video. Playback can be resumed at the same location by calling the
Start
method. SeekTo(number ms)
- Seeks to the requested time (specified in milliseconds) in the video. If the video is paused, the frame shown will not be updated by the seek. The player can jump only to key frames in the video, so seeking to times that differ by short intervals may not actually move to different frames.
Start()
- Starts playback of the video.
YandexTranslate
Use this component to translate words and sentences between different languages. This component needs Internet access, as it will request translations to the Yandex.Translate service. Specify the source and target language in the form source-target using two letter language codes. So"en-es" will translate from English to Spanish while "es-ru" will translate from Spanish to Russian. If you leave out the source language, the service will attempt to detect the source language. So providing just "es" will attempt to detect the source language and translate it to Spanish.
This component is powered by the Yandex translation service. See http://api.yandex.com/translate/ for more information, including the list of available languages and the meanings of the language codes and status codes.
Note: Translation happens asynchronously in the background. When the translation is complete, the "GotTranslation" event is triggered.
Properties
noneEvents
GotTranslation(text responseCode, text translation)
- Event triggered when the Yandex.Translate service returns the translated text. This event also provides a response code for error handling. If the responseCode is not 200, then something went wrong with the call, and the translation will not be available.
Methods
RequestTranslation(text languageToTranslateTo, text textToTranslate)
- By providing a target language to translate to (for instance, 'es' for Spanish, 'en' for English, or 'ru' for Russian), and a word or sentence to translate, this method will request a translation to the Yandex.Translate service. Once the text is translated by the external service, the event GotTranslation will be executed. Note: Yandex.Translate will attempt to detect the source language. You can also specify prepending it to the language translation. I.e., es-ru will specify Spanish to Russian translation.
Không có nhận xét nào:
Đăng nhận xét