File: youtubeplayer.js

package info (click to toggle)
closure-compiler 20130227%2Bdfsg1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,776 kB
  • ctags: 45,946
  • sloc: java: 175,338; xml: 371; makefile: 19; sh: 6
file content (373 lines) | stat: -rw-r--r-- 11,110 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
/*
 * Copyright 2012 YouTube LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Public API calls.
 * @link http://code.google.com/apis/youtube/js_api_reference.html
 * @externs
 */


/**
 * @constructor
 * @extends {HTMLObjectElement}
 */

function YouTubePlayer() {}


/**
 * Plays the currently cued/loaded video.
 *
 */
YouTubePlayer.prototype.playVideo = function() {};


/**
 * Pauses the currently playing video.
 */
YouTubePlayer.prototype.pauseVideo = function() {};


/**
 * Stops the current video. This function also closes the NetStream object and cancels the loading of the video.
 */
YouTubePlayer.prototype.stopVideo = function() {};


/**
 * Clears the video display. This function is useful if you want to clear the video remnant after calling stopVideo().
 */
YouTubePlayer.prototype.clearVideo = function() {};


/**
 * @return {number}  The number of bytes loaded for the current video.
 */
YouTubePlayer.prototype.getVideoBytesLoaded = function() {};


/**
 * @return {number} The size in bytes of the currently loaded/playing video.
 */
YouTubePlayer.prototype.getVideoBytesTotal = function() {};


/**
 * @return {number}  The number of bytes the video file started loading from.
 */
YouTubePlayer.prototype.getVideoStartBytes = function() {};


/**
 * @return {Array}  The current playlist as an array of video IDs.
 */
YouTubePlayer.prototype.getPlaylist = function() {};


/**
 * @return {number}  The current index in the playlist or -1 when the player has
 *                   no playlist.
 */
YouTubePlayer.prototype.getPlaylistIndex = function() {};


/**
 * Calls an option method on the module
 * @param {string} moduleId The module descriptor id.
 * @param {string} option The option to call on the module.
 * @param {*} object Arbitrary data to be sent to the module.
 * @return {Object} Returns null if module or option doesn't exist.
 */
YouTubePlayer.prototype.setOption = function(moduleId, option, object) {};


/**
 * Calls an option method on the module
 * @param {string} moduleId The module descriptor id.
 * @param {string} option The option to call on the module.
 * @param {*} object Arbitrary data to be sent to the module.
 * @return {Object} Returns null if module or option doesn't exist.
 */
YouTubePlayer.prototype.getOption = function(moduleId, option, object) {};


/**
 * @return {?string} The current playlist's list id if there is a playlist and
 * that playlist was loaded from a list id, otherwise returns null.
 */
YouTubePlayer.prototype.getPlaylistId = function() {};


/**
 * Mutes the player.
 */
YouTubePlayer.prototype.mute = function() {};


/**
 * Unmutes the player.
 */
YouTubePlayer.prototype.unMute = function() {};


/**
 * @return {boolean} true if the player is muted, false if not.
 */
YouTubePlayer.prototype.isMuted = function() {};


/**
 * @param {number} volume The volume, an integer between 0 and 100.
 */
YouTubePlayer.prototype.setVolume = function(volume) {};


/**
 * @return {number} The player's current volume, an integer between 0 and 100.
 */
YouTubePlayer.prototype.getVolume = function() {};


/**
 * Seeks to the specified time of the video in seconds.
 * @param {number} seconds The offset to seek to.
 * @param {boolean=} opt_allowSeekAhead If true the player will make a new
 *     server request if seconds is beyond the currently loaded video data.
 */
YouTubePlayer.prototype.seekTo = function(seconds, opt_allowSeekAhead) {};


/**
 * @return {number} The state of the player. Possible values are unstarted
 *     (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
 */
YouTubePlayer.prototype.getPlayerState = function() {};


/**
 * Returns the current playback rate setting of the player.
 * @return {number} The current playback rate setting of the player.
 */
YouTubePlayer.prototype.getPlaybackRate = function() {};


/**
 * Sets the playback rate for the player based on the rate suggested by the
 * user. The actually applied rate is the closest supported rate that lies
 * between 1.0 and the suggested rate (inclusive). 1.0 will always be one
 * of the supported playback rates.
 * @param {number} suggestedRate The playback rate suggested by the user.
 */
YouTubePlayer.prototype.setPlaybackRate = function(suggestedRate) {};


/**
 * Gets an array of playback rates supported by the video player, sorted in
 * ascending order. This array is guaranteed to have the entry 1.0.
 * @return {Array.<number>} Playback rates supported by the player.
 */
YouTubePlayer.prototype.getAvailablePlaybackRates = function() {};


/**
 * @return {string} The current quality the player has loaded or is playing.
 */
YouTubePlayer.prototype.getPlaybackQuality = function() {};


/**
 * Sets the playback quality in the video player. If the quality is not the
 * current playing quality, the player will load the new quality.
 * @param {string} quality The video quality the player should load and play.
 */
YouTubePlayer.prototype.setPlaybackQuality = function(quality) {};


/**
 * @return {Array} Array of available quality levels in order of decreasing quality.
 */
YouTubePlayer.prototype.getAvailableQualityLevels = function() {};


/**
 * @return {number}  The elapsed time in seconds since the video started playing.
 */
YouTubePlayer.prototype.getCurrentTime = function() {};


/**
 * @return {number}  The duration in seconds of the currently playing video.
 */
YouTubePlayer.prototype.getDuration = function() {};


/**
 * @param {string} event The event to listen for.
 * @param {string|EventListener|Function} listener The function to call
 *     when the event occurs.
 */
YouTubePlayer.prototype.addEventListener = function(event, listener) {};


/**
 * @return {string} The YouTube.com URL for the currently loaded/playing video.
 */
YouTubePlayer.prototype.getVideoUrl = function() {};


/**
 * @return {string} The embed code for the currently loaded/playing video.
 */
YouTubePlayer.prototype.getVideoEmbedCode = function() {};


/**
 * Loads the specified video's thumbnail and prepares the player to play the
 *     video.
 * @param {Object|string} videoIdOrObject YouTube Video ID or object.
 * @param {number} opt_startSeconds The video will start from the keyframe
 *     nearest this time.
 */
YouTubePlayer.prototype.cueVideoById =
    function(videoIdOrObject, opt_startSeconds) {};


/**
 * Loads and plays the specified video.
 * @param {Object|string} videoIdOrObject YouTube Video ID or object.
 * @param {number} opt_startSeconds The video will start from the keyframe
 *     nearest this time.
 */
YouTubePlayer.prototype.loadVideoById =
    function(videoIdOrObject, opt_startSeconds) {};


/**
 * Loads the specified video's thumbnail and prepares the player to play the video.
 * @param {string} mediaContentUrl YouTube player URL in the format
 *     http://www.youtube.com/v/VIDEO_ID.
 * @param {number} opt_startSeconds The video will start from the keyframe nearest this time.
 */
YouTubePlayer.prototype.cueVideoByUrl = function(mediaContentUrl, opt_startSeconds) {};


/**
 * Loads and plays the specified video.
 * @param {string} mediaContentUrl YouTube player URL in the format
 *     http://www.youtube.com/v/VIDEO_ID.
 * @param {number} opt_startSeconds The video will start from the keyframe nearest this time.
 */
YouTubePlayer.prototype.loadVideoByUrl = function(mediaContentUrl, opt_startSeconds) {};


/**
 * Loads and plays a specified video in a playlist.
 * @param {string|Array|Object} playlistOrObject An object containing all of the
 *     parameters. Otherwise, a string that is a playlist id (without
 *     the PL list prefix) or an array of video ids.
 * @param {number=} opt_index The index to begin playback at.
 * @param {number=} opt_startSeconds Float/integer that specifies the time
 *     from which the video should start playing.
 * @param {string=} opt_suggestedQuality The suggested playback quality for
 *     the video.
 */
YouTubePlayer.prototype.cuePlaylist =  function(playlistOrObject,
    opt_index, opt_startSeconds, opt_suggestedQuality) {};


/**
 * Loads and cues a specified video in a playlist.
 * @param {string|Array|Object} playlistOrObject An object containing all of the
 *     parameters. Otherwise, a string that is a playlist id (without
 *     the PL list prefix) or an array of video ids.
 * @param {number=} opt_index The index to begin playback at.
 * @param {number=} opt_startSeconds Float/integer that specifies the time
 *     from which the video should start playing.
 * @param {string=} opt_suggestedQuality The suggested playback quality for
 *     the video.
 */
YouTubePlayer.prototype.loadPlaylist =  function(playlistOrObject,
    opt_index, opt_startSeconds, opt_suggestedQuality) {};


/**
 * Plays the next video in the playlist. At the end of the playlist, this will
 * go to the first video when loop is enabled, otherwise it will be a noop.
 */
YouTubePlayer.prototype.nextVideo = function() {};


/**
 * Plays the previous video in the playlist. At the front of the playlist, this
 * will go to the last video when loop is enabled, otherwise it will be a noop.
 */
YouTubePlayer.prototype.previousVideo = function() {};


/**
 * Plays a specific video in the playlist. If the provided index is not in the
 * playlist, this will be a noop.
 * @param {number} index The index of the video in the playlist to play.
 */
YouTubePlayer.prototype.playVideoAt = function(index) {};


/**
 * Shuffle the playlist when setting shuffle to true, or return the playlist to
 * the original order when setting to false.
 * @param {boolean} shuffle If the playlist should shuffle.
 */
YouTubePlayer.prototype.setShuffle = function(shuffle) {};


/**
 * @param {boolean} loop If the playlist should loop.
 */
YouTubePlayer.prototype.setLoop = function(loop) {};


/**
 * Sets the size in pixels of the player. You should not have to use this
 * method in JavaScript as the player will automatically resize when the
 * containing elements in the embed code have their height and width
 * properties modified.
 * @param {number} width Player width.
 * @param {number} height Player height.
 */
YouTubePlayer.prototype.setSize = function(width, height) {};


/**
 * Destroys the player reference.
 */
YouTubePlayer.prototype.destroy = function() {};


/**
 * On player ready callback.
 *
 * @param {string} playerapiid String identifier for a player.
 */
function onYouTubePlayerReady(playerapiid) {}


/**
 * On player ready callback.
 *
 * @param {string} playerapiid String identifier for a player.
 */
Window.prototype.onYouTubePlayerReady = function(playerapiid) {};