The top level Media module.
The Media module is used accessing the device's media related functionality such as playing audio or recording video.
Audio file format Audio Interchange File Format (AIFF).
Audio file format Audio Interchange File Format (AIFF).
Audio file format Adaptive Multi-Rate (AMR).
Audio file format Adaptive Multi-Rate (AMR).
Audio file format Apple Compressed Audio Format (CAF).
Audio file format Apple Compressed Audio Format (CAF).
Audio format MPEG4 AAC encoding.
Audio format MPEG4 AAC encoding.
Audio format 8-bit aLaw encoding.
Audio format 8-bit aLaw encoding.
Audio format Apple lossless encoding.
Audio format Apple lossless encoding.
Audio format Apple IMA4 encoding.
Audio format Apple IMA4 encoding.
Audio format 16-bit, linear PCM encoding.
Audio format 16-bit, linear PCM encoding.
Audio format 8-bit muLaw encoding.
Audio format 8-bit muLaw encoding.
Line-type constant for headphones.
Line-type constant for headphones.
Line-type constant for headphones and microphone.
Line-type constant for headphones and microphone.
Line-type constant for headset in/out.
Line-type constant for headset in/out.
Line-type constant for line-out.
Line-type constant for line-out.
Line-type constant for microphone.
Line-type constant for microphone.
Line-type constant indicated mute switch is on.
Line-type constant indicated mute switch is on.
Line-type constant indicating receiver and microphone.
Line-type constant indicating receiver and microphone.
For long-duration sounds such as rain, car engine noise, and so on.
For long-duration sounds such as rain, car engine noise, and so on.
Also used for for 'play along' style applications, such a virtual piano that a user plays over iPod audio.
See also: AUDIO_SESSION_MODE_SOLO_AMBIENT.
Session mode for playing recorded music or other sounds that are central to the successful use of your application.
Session mode for playing recorded music or other sounds that are central to the successful use of your application.
When using this mode, your application audio continues with the Ring/Silent switch set to silent or when the screen locks. This property normally disallows mixing iPod audio with application audio.
Session mode for recording (input) and playback (output) of audio, such as for a VOIP (voice over IP) application.
Session mode for recording (input) and playback (output) of audio, such as for a VOIP (voice over IP) application.
This category is appropriate for simultaneous recording and playback, and also for applications that record and play back but not simultaneously. If you want to ensure that sounds such as Messages alerts do not play while your application is recording, use AUDIO_SESSION_MODE_RECORD instead. This category normally disallows mixing iPod audio with application audio.
Session mode for recording audio; it silences playback audio.
Session mode for recording audio; it silences playback audio.
Session mode for long-duration sounds such as rain, car engine noise, and so on.
Session mode for long-duration sounds such as rain, car engine noise, and so on.
When you use this category, audio from built-in applications, such as the iPod,
is silenced. Your audio is silenced when the Ring/Silent switch is set to silent
or when the screen locks.
To use long-duration sounds without silencing built-in applications, see AUDIO_SESSION_MODE_AMBIENT.
Line-type constant for speaker output.
Line-type constant for speaker output.
Line-type constant indicating that audio is unavailable.
Line-type constant indicating that audio is unavailable.
Line-type constant indicating that line-type is unknown or not determined.
Line-type constant indicating that line-type is unknown or not determined.
Constant for media device busy error.
Constant for media device busy error.
Media type constant for photo media.
Media type constant for photo media.
Media type constant for video media.
Media type constant for video media.
Constant for grouping query results by album.
Constant for grouping query results by album.
Constant for grouping query results by album and artist.
Constant for grouping query results by album and artist.
Constant for grouping query results by artist.
Constant for grouping query results by artist.
Constant for grouping query results by composer.
Constant for grouping query results by composer.
Constant for grouping query results by genre.
Constant for grouping query results by genre.
Constant for grouping query results by playlist.
Constant for grouping query results by playlist.
Constant for grouping query results by podcast title.
Constant for grouping query results by podcast title.
Constant for grouping query results by title.
Constant for grouping query results by title.
Music library media containing any type of content.
Music library media containing any type of content.
Music library media containing any type of audio content.
Music library media containing any type of audio content.
Music library media containing audiobook content.
Music library media containing audiobook content.
Music library media containing music content.
Music library media containing music content.
Music library media containing podcast content.
Music library media containing podcast content.
Constant for "Repeat All" setting.
Constant for "Repeat All" setting.
Constant for user's default repeat setting.
Constant for user's default repeat setting.
Constant for "No Repeat" setting.
Constant for "No Repeat" setting.
Constant for "Repeat one item" setting.
Constant for "Repeat one item" setting.
Constant for shuffling complete albums setting.
Constant for shuffling complete albums setting.
Constant for user's default shuffle setting.
Constant for user's default shuffle setting.
Constant for "no shuffle" setting.
Constant for "no shuffle" setting.
Constant for shuffling songs setting.
Constant for shuffling songs setting.
Constant for interrupted state.
Constant for interrupted state.
Constant for paused state.
Constant for paused state.
Constant for playing state.
Constant for playing state.
Constant for backward seek state.
Constant for backward seek state.
Constant for forward seek state.
Constant for forward seek state.
Constant for stopped state.
Constant for stopped state.
Media type constant for high-quality video recording.
Media type constant for high-quality video recording.
Recorded files are suitable for on-device playback and for wired transfer to the Desktop using Image Capture; they are likely to be too large for transfer using Wi-Fi.
Media type constant for low-quality video recording.
Media type constant for low-quality video recording.
Recorded files can usually be transferred over the cellular network.
Media type constant for medium-quality video recording.
Media type constant for medium-quality video recording.
Recorded files can usually be transferred using Wi-Fi. This is the default video quality setting.
Constant for default video controls.
Constant for default video controls.
Constant for video controls for an embedded view.
Constant for video controls for an embedded view.
Used in conjunction with the movieControlStyle property of Titanium.Media.VideoPlayer in iPhone 3.2+.
Constant for fullscreen video controls.
Constant for fullscreen video controls.
Used in conjunction with the movieControlStyle property of Titanium.Media.VideoPlayer
in iPhone 3.2+.
Constant for video controls hidden.
Constant for video controls hidden.
Constant for no video controls.
Constant for no video controls.
Used in conjunction with the movieControlStyle property of
Titanium.Media.VideoPlayer in iPhone 3.2+.
Constant for video controls volume only.
deprecated since 1.8.0
Video playback ended normally.
Video playback ended normally.
Video playback ended abnormally.
Video playback ended abnormally.
Video playback ended by user action (such as clicking the Done button).
Video playback ended by user action (such as clicking the Done button).
Current media is playable.
Current media is playable.
Playback will be automatically started in this state when autoplay is true.
Playback will be automatically started in this state when autoplay is true.
Playback will be automatically paused in this state, if started.
Playback will be automatically paused in this state, if started.
Current load state is not known.
Current load state is not known.
A audio type of media in the movie returned by Titanium.Media.VideoPlayer mediaTypes property.
A audio type of media in the movie returned by Titanium.Media.VideoPlayer mediaTypes property.
An unknown type of media in the movie returned by Titanium.Media.VideoPlayer mediaTypes property.
An unknown type of media in the movie returned by Titanium.Media.VideoPlayer mediaTypes property.
A video type of media in the movie returned by Titanium.Media.VideoPlayer mediaTypes property.
A video type of media in the movie returned by Titanium.Media.VideoPlayer mediaTypes property.
Video playback has been interrupted.
Video playback has been interrupted.
Video playback is paused.
Video playback is paused.
Video is being played.
Video is being played.
Video playback is rewinding.
Video playback is rewinding.
Video playback is seeking forward.
Video playback is seeking forward.
Video playback is stopped.
Video playback is stopped.
Constant for disabling repeat on video playback.
Constant for disabling repeat on video playback.
Constant for repeating one video (i.e., the one video will repeat constantly) during playback.
Constant for repeating one video (i.e., the one video will repeat constantly) during playback.
Scale video to fill the screen, clipping edges if necessary.
Scale video to fill the screen, clipping edges if necessary.
Video is scaled until the video fills the entire screen. Content at the edges of the larger of the two dimensions is clipped so that the other dimension fits the screen exactly. The aspect ratio of the movie is preserved.
Scale video to fit the screen, letterboxing if necessary.
Scale video to fit the screen, letterboxing if necessary.
Video is scaled until the larger dimension fits on the screen exactly. In the other dimension, the region between the edge of the movie and the edge of the screen is filled with a black bar. The aspect ratio of the movie is preserved.
Video is scaled until both dimensions fit the screen exactly, stretching if necessary.
Video is scaled until both dimensions fit the screen exactly, stretching if necessary.
The aspect ratio of the video is not preserved.
Video source type is a file.
Video source type is a file.
Related to the sourceType property of Titanium.Media.VideoPlayer.
Video source type is a remote stream.
Video source type is a remote stream.
Related to the sourceType property of Titanium.Media.VideoPlayer
Video source type is unknown.
Video source type is unknown.
Related to the sourceType property of Titanium.Media.VideoPlayer
Use the closest keyframe in the time.
Use the closest keyframe in the time.
An instance of Titanium.Media.MusicPlayer representing the app-specific music player.
An instance of Titanium.Media.MusicPlayer representing the app-specific music player.
Returns the line type constant for the current line type.
Returns the line type constant for the current line type.
Returns true if the device is playing audio.
Returns true if the device is playing audio.
A constant for the audio session mode to be used.
A constant for the audio session mode to be used.
Set to one of the AUDIO_SESSION constants defined in Titanium.Media.
Must be set while the audio session is inactive (no sounds are playing, no listeners for audio properties on the Media module, but the iPod may be active).
Array of media type constants supported for the camera.
Array of media type constants supported for the camera.
Array of media type constants supported for saving to the device's camera roll or saved images album.
Array of media type constants supported for saving to the device's camera roll or saved images album.
Array of media type constants supported for the photo library.
Array of media type constants supported for the photo library.
Current average microphone level in dB or -1 if microphone monitoring is disabled.
Current average microphone level in dB or -1 if microphone monitoring is disabled.
See startMicrophoneMonitor, stopMicrophoneMonitor.
true if the device has a recording input device available.
true if the device has a recording input device available.
true if the device has camera support.
true if the device has camera support.
Current microphone level peak power in dB or -1 if microphone monitoring is disabled.
Current microphone level peak power in dB or -1 if microphone monitoring is disabled.
See startMicrophoneMonitor, stopMicrophoneMonitor.
An instance of Titanium.Media.MusicPlayer representing the system-wide music player.
An instance of Titanium.Media.MusicPlayer representing the system-wide music player.
Current volume of the playback device.
Current volume of the playback device.
Adds the specified callback as an event listener for the named event.
Name of the event.
Callback function to invoke when the event is fired.
Creates and returns an instance of Titanium.Media.AudioPlayer.
Properties to set on a new object, including any defined by Titanium.Media.AudioPlayer except those marked not-creation or read-only.
Creates and returns an instance of Titanium.Media.AudioRecorder.
Properties to set on a new object, including any defined by Titanium.Media.AudioRecorder except those marked not-creation or read-only.
Creates and returns an instance of Titanium.Media.Item.
Properties to set on a new object, including any defined by Titanium.Media.Item except those marked not-creation or read-only.
Creates and returns an instance of Titanium.Media.MusicPlayer.
Properties to set on a new object, including any defined by Titanium.Media.MusicPlayer except those marked not-creation or read-only.
Creates and returns an instance of Titanium.Media.Sound.
Properties to set on a new object, including any defined by Titanium.Media.Sound except those marked not-creation or read-only.
Creates and returns an instance of Titanium.Media.VideoPlayer.
Properties to set on a new object, including any defined by Titanium.Media.VideoPlayer except those marked not-creation or read-only.
Fires a synthesized event to any registered listeners.
Name of the event.
A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.
Hides the device camera UI.
Must be called after calling showCamera and only when autohide is set to false.
This method causes the media capture UI to be hidden.
Hides the music library.
Must be called after calling openMusicLibrary
and only when autohide is set to false.
Returns true if the source supports the specified media type.
You can query whether a given media type is supported by the device's
camera (source == 'camera') or photo library (source == 'photo').
An additional value, photogallery can be used to query the media
supported by the device's camera roll or saved image album, which is a
subset of the iOS photo library. However, when calling
openPhotoGallery on iOS, the entire
library is displayed, and there is currently no way to restrict the
gallery to show only the camera roll/saved images album.
Media source specified as a string: camera for Camera or photo for Photo Library.
Media type to check, either MEDIA_TYPE_PHOTO or MEDIA_TYPE_VIDEO.
Shows the music library and allows the user to select one or more tracks.
If autohide is set to false, you must hide the library explicitly using
hideMusicLibrary.
A dictionary of options as described in MusicLibraryOptionsType.
Opens the photo gallery image picker.
Photo gallery options as described in PhotoGalleryOptionsType.
Displays the given image.
Dictionary containing the image and callback functions.
Searches the music library for items matching the specified search predicates.
The query object to extract information from.
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Name of the event.
Callback function to remove. Must be the same function passed to addEventListener.
Saves media to the device's photo gallery / camera roll.
This operation is asynchronous. The caller can supply callbacks to be triggered when the save operation completes.
Media can be passed as either a Blob object or a File object. If the media argument
is not one of these types, an error is generated.
Note that when passing a file (or a blob created from a file), the file name must
have the appropriate extension for the data--for example, image.jpg or video1.mov work,
but video1.tmp does not. Currently, the .mp4 extension is not supported, but MP4
files may be imported by saving them with the .mov extension.
Media to save to the camera roll or media gallery.
Pass a dictionary with the following supported keys: success a function that
will be called when the save succeeds, and error a function that will be
called upon receiving an error.
Sets the value of the audioSessionMode property.
New value for the property.
Sets the value of the availableCameraMediaTypes property.
New value for the property.
Sets the value of the availablePhotoGalleryMediaTypes property.
New value for the property.
Sets the value of the availablePhotoMediaTypes property.
New value for the property.
Sets the value of the averageMicrophonePower property.
New value for the property.
Shows the camera.
By default, the native camera controls are displayed. To add your own camera controls,
you can add an overlay view by setting the overlay property on the options argument.
To suppress the default controls, set showControls and autohide to false.
If the showControls option is false, you must control the camera explicitly, using
the takePicture and hideCamera
methods.
A dictionary of camera options as described in CameraOptionsType.
Starts monitoring the microphone sound level.
Stops monitoring the microphone sound level.
Uses the device camera to capture a photo.
Must be called after calling showCamera and only when autohide is set to false.
This method causes the media capture device to capture a photo and call the
success callback.
Takes a screen shot of the visible UI on the device.
This method is asynchronous. The screenshot is returned in the callback argument.
The callback argument's media property contains the screenshot image as a
Blob object.
Function to call upon capture.
Makes the device vibrate.
On Android and Mobile Web, a pattern argument can be provided to specify a
vibration pattern.
The pattern is an array of Number values. Each number in the array is
interpreted as a duration in milliseconds. The first number is the delay
before the pattern starts, and the remaining numbers are interpreted as
alternating periods of on and off times. For example, the following pattern:
[ 0, 500, 100, 500, 100, 500 ]
Would cause the vibration to start immediately (delay = 0), and perform three long vibrations (500 ms) separated by short pauses (100ms).
On Mobile Web, calling vibrate without a pattern will stop the vibration.
Array of values identifying a vibrate pattern (only used on Android).
Fired when an audio line type change is detected.
Source object that fired the event.
Name of the event fired.
Fired when the availablity of recording input changes.
Indicates whether the recording device is available.
Source object that fired the event.
Name of the event fired.