PageRenderTime 26ms CodeModel.GetById 18ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/lib/titanium/mobile/media/AudioPlayer.hx

http://github.com/visup/haxe-titanium-api
Haxe | 143 lines | 43 code | 8 blank | 92 comment | 0 complexity | b3cec278139b5ff671a6d92868790192 MD5 | raw file
  1package titanium.mobile.media;
  2import titanium.mobile.core.Dispatcher;
  3
  4/**
  5AudioPlayer class
  6
  7Documentation available at:
  8http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Media.AudioPlayer-object.html
  9
 10- namespace
 11
 12Titanium.Media.AudioPlayer
 13
 14- type
 15
 16object
 17
 18- subtype
 19
 20proxy
 21
 22- description
 23
 24The AudioPlayer object is returned by [[Titanium.Media.createAudioPlayer]] and is used for streaming audio to the device and low-level control of the audio playback.
 25
 26- since
 27
 280.9
 29
 30- platforms
 31
 32android, iphone, ipad
 33
 34- properties
 35
 36waiting[boolean]: returns boolean indicating if the playback is waiting for audio data from the network
 37idle[boolean]: returns boolean indicating if the playback is idle
 38playing[boolean]: returns boolean indicating if the playback is streaming audio
 39paused[boolean]: returns boolean indicating if the playback is paused
 40bitRate[double]: bit rate of the current playback stream
 41progress[double]: returns the current playback progress. Will return zero if sampleRate has not yet been detected
 42state[int]: returns int for the current state of playback
 43url[string]: returns the url for the current playback
 44allowBackground[boolean]: boolean to indicate if audio should continue playing even if Activity is paused (Android only as of 1.3.0)
 45
 46STATE_INITIALIZED[int]: current playback is in the initialization state
 47STATE_STARTING[int]: current playback is in the starting playback state
 48STATE_WAITING_FOR_DATA[int]: current playback is in the waiting for audio data from the network state
 49STATE_WAITING_FOR_QUEUE[int]: current playback is in the waiting for audio data to fill the queue state
 50STATE_PLAYING[int]: current playback is in the playing state
 51STATE_BUFFERING[int]: current playback is in the buffering from the network state
 52STATE_STOPPING[int]: current playback is in the stopping state
 53STATE_STOPPED[int]: current playback is in the stopped state
 54STATE_PAUSED[int]: current playback is in the paused state
 55
 56- methods 
 57
 58setPaused: control the playback of the audio
 59setUrl: change the url of the audio playback
 60start: start playback
 61stop: stop playback
 62pause: pause playback
 63stateDescription: convert a state into a textual description suitable for display
 64
 65- method : stateDescription, string
 66
 67- method : setPaused
 68
 69paused[boolean]: pass true to pause the current playback temporarily, false to unpause it
 70
 71- method : setUrl
 72
 73url[string]: the new url
 74
 75- events
 76
 77change: fired when the state of the playback changes
 78progress: fired once per second with the current progress during playback
 79
 80- event : change
 81
 82state: current state of playback
 83description: textual description of the state of playback
 84
 85
 86- event : progress
 87
 88progress: current progress value
 89
 90**/
 91
 92typedef AudioPlayerChangeEvent = 
 93{ > Event,
 94	description:String,
 95	state:Int
 96}
 97
 98typedef AudioPlayerProgressEvent = 
 99{ > Event,
100	progress:Float
101}
102
103@:native("Titanium.Media.AudioPlayer")
104extern class AudioPlayer extends Dispatcher
105{
106	// static constructor
107	public inline static function create(?params:Dynamic):AudioPlayer
108		return titanium.mobile.Media.createAudioPlayer(params)
109		
110	// events
111	public static inline var CHANGE_EVENT = "change";
112	public static inline var PROGRESS_EVENT = "progress";
113	
114	// constants
115	public static var STATE_BUFFERING:Int;
116	public static var STATE_INITIALIZED:Int;
117	public static var STATE_PAUSED:Int;
118	public static var STATE_PLAYING:Int;
119	public static var STATE_STARTING:Int;
120	public static var STATE_STOPPED:Int;
121	public static var STATE_STOPPING:Int;
122	public static var STATE_WAITING_FOR_DATA:Int;
123	public static var STATE_WAITING_FOR_QUEUE:Int;
124	
125	// properties
126	public var allowBackground:Bool;
127	public var bitRate:Float;
128	public var idle:Bool;
129	public var paused:Bool;
130	public var playing:Bool;
131	public var progress:Float;
132	public var state:Int;
133	public var url:String;
134	public var waiting:Bool;
135	
136	// methods
137	public function pause():Void;
138	public function setPaused(paused:Bool):Void;
139	public function setUrl(url:String):Void;
140	public function start():Void;
141	public function stateDescription():String;
142	public function stop():Void;
143}