1FlowPlayer API supports a subset of the JavaScript API 2available in mplayer browser plug-in (http://mplayerplug-in.sourceforge.net/). 3Additionally it defines some methods that are not available in mplayer 4plug-in. mplayer plug-in's API is documented in javascript.txt that can be found 5in the plugin's source distribution package. 6 7FlowPlayer supports the following methods. These are available to JavaScript and 8to other Flash movies via Flash's LocalConnection. 9 10NOTE! 11 12It takes some time before the Flash plugin and the player has been initialized 13and the functions in this API are ready to be used. You should wait until you 14receive the onFlowPlayerReady() callback from the player. After the player has 15called this function the API is guaranteed to be ready for use. 16 17methods (same as in mplayer plug-in): 18 19 DoPlay():Void; 20 21 Plays the current clip. 22 23 DoStop():Void; 24 25 Stops playback and returns to the first clip in the playlist. 26 27 Reset():Void; 28 29 Resets the player to the initial state. 30 31 Pause():Void; 32 33 Pauses playback. 34 35 Seek(seconds:Number):Void; 36 37 Seeks to the specified time during the clip's timeline. 38 39 getTime():Void; 40 41 Get's the current time (seconds advanced). 42 43 getDuration():Void; 44 45 Get's the clip's duration. 46 47FlowPlayer specific, not in mplayer plug-in API: 48 49 setConfig(flowPlayerConfig:Object):Void; 50 51 Configure the player using a FlowPlayer configuration object. 52 This is a JavaScript object that is documented in flowPlayer.js 53 (http://flowplayer.sourceforge.net/flowPlayer.js). 54 55 NOTE: The visible playList will not behave currently if you replace 56 an existing playlist by calling this method with an object that 57 has a different playList! 58 59 StartBuffering()Void; 60 61 Starts loading the clip into the buffer memory. Does not start 62 playback. 63 64 ToggleLoop()Void; 65 66 Toggless looping on/off. 67 68 getPercentLoaded():Number; 69 70 Gets the percentage of buffer memory currently filled with data. 71 72 getIsPlaying():Boolean; 73 74 Is the player currently playing? 75 76 getIsPaused():Boolean; 77 78 Is the player currently paused? 79 80 getIsLooping():Boolean; 81 82 Is the player looping? 83 84 addCuePoint(timeSeconds, name, parameters):Void; 85 86 Adds a new programmatic cue point. When the cue point's time is reached 87 the onCuePoint callback is called. The onCuePoint callback receives the name and 88 parameters values. You can pass a JSON style object in the 'parameters' 89 parameter. 90 91 addCuePoints(Array):Void; 92 93 Adds a several cue points. Syntax: 94 addCuePoints([ { name: 'cue1', time: 5, parameters: { foo: 1, bar: 'x' } }, 95 { name: 'cue2', time: 45, parameters: { foo: 2, bar: 'xy' } } ]) 96 97 98PlayList control (FlowPlayer specific, not in mplayer plug-in API): 99 100 hasNext():Boolean; 101 102 Does the playlist have more clips after the current clipP? 103 104 NextClip():Void; 105 106 Moves to next clip. 107 108 PrevClip():Void; 109 110 Moves to previous clip. 111 112 getPlayListSize():Number; 113 114 Gets the number of clips in the playlist. 115 116 getCurrentClip():Number; 117 118 Gets the index of the current clip. First clip is at index zero. 119 120 ToClip(index:Number):Void; 121 122 Moves to clip at the specified index. 123 124 playClip(clipObj):Void; 125 126 Plays the specified clip. Existing playList is discarded 127 and replaced with a a playList containing the specified clip. 128 The clip should be a valid flowplayer clip object that are 129 also used in playLists. 130 131 setClipURL(clipObj):Void; 132 133 Creates a new playList that has the specified clip. 134 Existing playList is discarded. 135 The clip should be a valid flowplayer clip object that are 136 also used in playLists. 137 138Callbacks from the player (FlowPlayer specific, not in mplayer plug-in API): 139 140 141 onFlowPlayerReady():Void 142 143 Called when the player has been initialized and the JavaScript API is ready to be used. 144 145 function onClipDone(clip); 146 147 Called when a clip has been played to the end. The clip parameter object 148 has following properties: name, baseUrl, fileName, start (start time in seconds), 149 end (end time in seconds), protected (is hotlink protection applied for this clip?), 150 linkUrl, linkWindow, controlEnabled (enable playback control buttons?) 151 152 function onClipChanged(clip); 153 154 Called when the user manually changes to another clip in the playlist or 155 when the playback moves from one clip to the next. 156 157 function onLoadBegin(clip); 158 159 Called when the loading of a clip begins. 160 161 function onStreamNotFound(clip); 162 163 Called when a clip is not found using it's URL. 164 165 function onPlay(clip); 166 167 Called when playback starts for a playlist. 168 169 function onStop(clip); 170 171 Called when playback of the playlist stops. 172 173 function onPause(clip); 174 175 Called when the player is paused. 176 177 function onResume(clip); 178 179 Called when the player is resumed. 180 181 function onCuePoint(cuePoint); 182 183 Called when a cue point is reached. 184 185 function onStartBuffering(clip); 186 187 Called when a clip starts buffering. 188 189 function onBufferFull(clip); 190 191 Called when the buffer is full and the playback for the specified clip can start. 192 193 function onBufferFlush(clip); 194 195 Called when the buffer is flushed for a clip. 196 197 function onMetaData(metadataObj); 198 199 Called when metadata for the currently playing clip has been received. 200 The metadata object contains following properties: duration (seconds), 201 videodatarate (kbit/s), audiodatarate (kbit/s) and creationdate. 202 203 function onPlaybackTime(time); 204 205 Called every time the playhead moves in the media's timeline. The value 206 of time tells the current time. 207