src_minplayer.players.youtube.js.html in HTML5 Media 7
1 /** The minplayer namespace. */
2 var minplayer = minplayer || {};
3
4 /** All the media player implementations */
5 minplayer.players = minplayer.players || {};
6
7 /**
8 * @constructor
9 * @extends minplayer.players.base
10 * @class The YouTube media player.
11 *
12 * @param {object} context The jQuery context.
13 * @param {object} options This components options.
14 * @param {object} queue The event queue to pass events around.
15 */
16 minplayer.players.youtube = function(context, options, queue) {
17
18 /** The quality of the YouTube stream. */
19 this.quality = 'default';
20
21 // Derive from players base.
22 minplayer.players.base.call(this, context, options, queue);
23 };
24
25 /** Derive from minplayer.players.base. */
26 minplayer.players.youtube.prototype = new minplayer.players.base();
27
28 /** Reset the constructor. */
29 minplayer.players.youtube.prototype.constructor = minplayer.players.youtube;
30
31 /**
32 * @see minplayer.plugin.construct
33 * @this minplayer.players.youtube
34 */
35 minplayer.players.youtube.prototype.construct = function() {
36
37 // Call the players.flash constructor.
38 minplayer.players.base.prototype.construct.call(this);
39
40 // Set the plugin name within the options.
41 this.options.pluginName = 'youtube';
42 };
43
44 /**
45 * @see minplayer.players.base#getPriority
46 * @param {object} file A {@link minplayer.file} object.
47 * @return {number} The priority of this media player.
48 */
49 minplayer.players.youtube.getPriority = function(file) {
50 return 10;
51 };
52
53 /**
54 * @see minplayer.players.base#canPlay
55 * @return {boolean} If this player can play this media type.
56 */
57 minplayer.players.youtube.canPlay = function(file) {
58
59 // Check for the mimetype for youtube.
60 if (file.mimetype === 'video/youtube') {
61 return true;
62 }
63
64 // If the path is a YouTube path, then return true.
65 return (file.path.search(/^http(s)?\:\/\/(www\.)?youtube\.com/i) === 0);
66 };
67
68 /**
69 * Return the ID for a provided media file.
70 *
71 * @param {object} file A {@link minplayer.file} object.
72 * @return {string} The ID for the provided media.
73 */
74 minplayer.players.youtube.getMediaId = function(file) {
75 var reg = /^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_\-]+)/i;
76 if (file.path.search(reg) === 0) {
77 return file.path.match(reg)[2];
78 }
79 else {
80 return file.path;
81 }
82 };
83
84 /**
85 * Returns a preview image for this media player.
86 *
87 * @param {object} file A {@link minplayer.file} object.
88 * @param {string} type The type of image.
89 * @param {function} callback Called when the image is retrieved.
90 */
91 minplayer.players.youtube.getImage = function(file, type, callback) {
92 type = (type == 'thumbnail') ? '1' : '0';
93 callback('http://img.youtube.com/vi/' + file.id + '/' + type + '.jpg');
94 };
95
96 /**
97 * Translates the player state for the YouTube API player.
98 *
99 * @param {number} playerState The YouTube player state.
100 */
101 minplayer.players.youtube.prototype.setPlayerState = function(playerState) {
102 switch (playerState) {
103 case YT.PlayerState.CUED:
104 break;
105 case YT.PlayerState.BUFFERING:
106 this.onWaiting();
107 break;
108 case YT.PlayerState.PAUSED:
109 this.onPaused();
110 break;
111 case YT.PlayerState.PLAYING:
112 this.onPlaying();
113 break;
114 case YT.PlayerState.ENDED:
115 this.onComplete();
116 break;
117 default:
118 break;
119 }
120 };
121
122 /**
123 * Called when an error occurs.
124 *
125 * @param {string} event The onReady event that was triggered.
126 */
127 minplayer.players.youtube.prototype.onReady = function(event) {
128 minplayer.players.base.prototype.onReady.call(this);
129 if (!this.options.autoplay) {
130 this.pause();
131 }
132 this.onLoaded();
133 };
134
135 /**
136 * Checks to see if this player can be found.
137 * @return {bool} TRUE - Player is found, FALSE - otherwise.
138 */
139 minplayer.players.youtube.prototype.playerFound = function() {
140 var id = 'iframe#' + this.options.id + '-player.youtube-player';
141 var iframe = this.display.find(id);
142 return (iframe.length > 0);
143 };
144
145 /**
146 * Called when the player state changes.
147 *
148 * @param {object} event A JavaScript Event.
149 */
150 minplayer.players.youtube.prototype.onPlayerStateChange = function(event) {
151 this.setPlayerState(event.data);
152 };
153
154 /**
155 * Called when the player quality changes.
156 *
157 * @param {string} newQuality The new quality for the change.
158 */
159 minplayer.players.youtube.prototype.onQualityChange = function(newQuality) {
160 this.quality = newQuality.data;
161 };
162
163 /**
164 * Determines if the player should show the playloader.
165 *
166 * @param {string} preview The preview image.
167 * @return {bool} If this player implements its own playLoader.
168 */
169 minplayer.players.youtube.prototype.hasPlayLoader = function(preview) {
170 return minplayer.hasTouch || !preview;
171 };
172
173 /**
174 * Determines if the player should show the controller.
175 *
176 * @return {bool} If this player implements its own playLoader.
177 */
178 minplayer.players.youtube.prototype.hasController = function() {
179 return minplayer.isIDevice;
180 };
181
182 /**
183 * @see minplayer.players.base#create
184 * @return {object} The media player entity.
185 */
186 minplayer.players.youtube.prototype.create = function() {
187 minplayer.players.base.prototype.create.call(this);
188
189 // Insert the YouTube iframe API player.
190 var tag = document.createElement('script');
191 tag.src = 'https://www.youtube.com/player_api';
192 var firstScriptTag = document.getElementsByTagName('script')[0];
193 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
194
195 // Get the player ID.
196 this.playerId = this.options.id + '-player';
197
198 // Poll until the YouTube API is ready.
199 this.poll((function(player) {
200 return function() {
201 var ready = jQuery('#' + player.playerId).length > 0;
202 ready = ready && ('YT' in window);
203 ready = ready && (typeof YT.Player == 'function');
204 if (ready) {
205 // Determine the origin of this script.
206 jQuery('#' + player.playerId).addClass('youtube-player');
207 var origin = location.protocol;
208 origin += '//' + location.hostname;
209 origin += (location.port && ':' + location.port);
210
211 var playerVars = {};
212 if (minplayer.isIDevice) {
213 playerVars.origin = origin;
214 }
215 else {
216 playerVars = {
217 enablejsapi: minplayer.isIDevice ? 0 : 1,
218 origin: origin,
219 wmode: 'opaque',
220 controls: minplayer.isAndroid ? 1 : 0
221 };
222 }
223
224 // Create the player.
225 player.player = new YT.Player(player.playerId, {
226 height: '100%',
227 width: '100%',
228 frameborder: 0,
229 videoId: player.mediaFile.id,
230 playerVars: playerVars,
231 events: {
232 'onReady': function(event) {
233 player.onReady(event);
234 },
235 'onStateChange': function(event) {
236 player.onPlayerStateChange(event);
237 },
238 'onPlaybackQualityChange': function(newQuality) {
239 player.onQualityChange(newQuality);
240 },
241 'onError': function(errorCode) {
242 player.onError(errorCode);
243 }
244 }
245 });
246 }
247 return !ready;
248 };
249 })(this), 200);
250
251 // Return the player.
252 return jQuery(document.createElement('div')).attr({
253 id: this.playerId
254 });
255 };
256
257 /**
258 * @see minplayer.players.base#load
259 * @return {boolean} If this action was performed.
260 */
261 minplayer.players.youtube.prototype.load = function(file) {
262 if (minplayer.players.base.prototype.load.call(this, file)) {
263 this.player.loadVideoById(file.id, 0, this.quality);
264 return true;
265 }
266
267 return false;
268 };
269
270 /**
271 * @see minplayer.players.base#play
272 * @return {boolean} If this action was performed.
273 */
274 minplayer.players.youtube.prototype.play = function() {
275 if (minplayer.players.base.prototype.play.call(this)) {
276 this.onWaiting();
277 this.player.playVideo();
278 return true;
279 }
280
281 return false;
282 };
283
284 /**
285 * @see minplayer.players.base#pause
286 * @return {boolean} If this action was performed.
287 */
288 minplayer.players.youtube.prototype.pause = function() {
289 if (minplayer.players.base.prototype.pause.call(this)) {
290 this.player.pauseVideo();
291 return true;
292 }
293
294 return false;
295 };
296
297 /**
298 * @see minplayer.players.base#stop
299 * @return {boolean} If this action was performed.
300 */
301 minplayer.players.youtube.prototype.stop = function() {
302 if (minplayer.players.base.prototype.stop.call(this)) {
303 this.player.stopVideo();
304 return true;
305 }
306
307 return false;
308 };
309
310 /**
311 * @see minplayer.players.base#seek
312 * @return {boolean} If this action was performed.
313 */
314 minplayer.players.youtube.prototype.seek = function(pos) {
315 if (minplayer.players.base.prototype.seek.call(this, pos)) {
316 this.onWaiting();
317 this.player.seekTo(pos, true);
318 return true;
319 }
320
321 return false;
322 };
323
324 /**
325 * @see minplayer.players.base#setVolume
326 * @return {boolean} If this action was performed.
327 */
328 minplayer.players.youtube.prototype.setVolume = function(vol) {
329 if (minplayer.players.base.prototype.setVolume.call(this, vol)) {
330 this.player.setVolume(vol * 100);
331 return true;
332 }
333
334 return false;
335 };
336
337 /**
338 * @see minplayer.players.base#getVolume
339 */
340 minplayer.players.youtube.prototype.getVolume = function(callback) {
341 this.getValue('getVolume', callback);
342 };
343
344 /**
345 * @see minplayer.players.base#getDuration.
346 */
347 minplayer.players.youtube.prototype.getDuration = function(callback) {
348 this.getValue('getDuration', callback);
349 };
350
351 /**
352 * @see minplayer.players.base#getCurrentTime
353 */
354 minplayer.players.youtube.prototype.getCurrentTime = function(callback) {
355 this.getValue('getCurrentTime', callback);
356 };
357
358 /**
359 * @see minplayer.players.base#getBytesStart.
360 */
361 minplayer.players.youtube.prototype.getBytesStart = function(callback) {
362 this.getValue('getVideoStartBytes', callback);
363 };
364
365 /**
366 * @see minplayer.players.base#getBytesLoaded.
367 */
368 minplayer.players.youtube.prototype.getBytesLoaded = function(callback) {
369 this.getValue('getVideoBytesLoaded', callback);
370 };
371
372 /**
373 * @see minplayer.players.base#getBytesTotal.
374 */
375 minplayer.players.youtube.prototype.getBytesTotal = function(callback) {
376 this.getValue('getVideoBytesTotal', callback);
377 };
378
File
player/doc/symbols/src/src_minplayer.players.youtube.js.html
View source
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
.KEYW {color: #933;}
.COMM {color: #bbb; font-style: italic;}
.NUMB {color: #393;}
.STRN {color: #393;}
.REGX {color: #339;}
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/** The minplayer namespace. */</span><span class="WHIT">
<span class='line'> 2</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">minplayer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 3</span>
<span class='line'> 4</span> </span><span class="COMM">/** All the media player implementations */</span><span class="WHIT">
<span class='line'> 5</span> </span><span class="NAME">minplayer.players</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.players</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 6</span>
<span class='line'> 7</span> </span><span class="COMM">/**
<span class='line'> 8</span> * @constructor
<span class='line'> 9</span> * @extends minplayer.players.base
<span class='line'> 10</span> * @class The YouTube media player.
<span class='line'> 11</span> *
<span class='line'> 12</span> * @param {object} context The jQuery context.
<span class='line'> 13</span> * @param {object} options This components options.
<span class='line'> 14</span> * @param {object} queue The event queue to pass events around.
<span class='line'> 15</span> */</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="NAME">minplayer.players.youtube</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">context</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 17</span>
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="COMM">/** The quality of the YouTube stream. */</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">this.quality</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'default'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 20</span>
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="COMM">// Derive from players base.</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.players.base.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 24</span>
<span class='line'> 25</span> </span><span class="COMM">/** Derive from minplayer.players.base. */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="NAME">minplayer.players.youtube.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">minplayer.players.base</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span>
<span class='line'> 28</span> </span><span class="COMM">/** Reset the constructor. */</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="NAME">minplayer.players.youtube.prototype.constructor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.players.youtube</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span>
<span class='line'> 31</span> </span><span class="COMM">/**
<span class='line'> 32</span> * @see minplayer.plugin.construct
<span class='line'> 33</span> * @this minplayer.players.youtube
<span class='line'> 34</span> */</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="NAME">minplayer.players.youtube.prototype.construct</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 36</span>
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="COMM">// Call the players.flash constructor.</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.players.base.prototype.construct.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span>
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="COMM">// Set the plugin name within the options.</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">this.options.pluginName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'youtube'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span>
<span class='line'> 44</span> </span><span class="COMM">/**
<span class='line'> 45</span> * @see minplayer.players.base#getPriority
<span class='line'> 46</span> * @param {object} file A {@link minplayer.file} object.
<span class='line'> 47</span> * @return {number} The priority of this media player.
<span class='line'> 48</span> */</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="NAME">minplayer.players.youtube.getPriority</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span>
<span class='line'> 53</span> </span><span class="COMM">/**
<span class='line'> 54</span> * @see minplayer.players.base#canPlay
<span class='line'> 55</span> * @return {boolean} If this player can play this media type.
<span class='line'> 56</span> */</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="NAME">minplayer.players.youtube.canPlay</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 58</span>
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="COMM">// Check for the mimetype for youtube.</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">file.mimetype</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'video/youtube'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 63</span>
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="COMM">// If the path is a YouTube path, then return true.</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">file.path.search</span><span class="PUNC">(</span><span class="REGX">/^http(s)?\:\/\/(www\.)?youtube\.com/i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 67</span>
<span class='line'> 68</span> </span><span class="COMM">/**
<span class='line'> 69</span> * Return the ID for a provided media file.
<span class='line'> 70</span> *
<span class='line'> 71</span> * @param {object} file A {@link minplayer.file} object.
<span class='line'> 72</span> * @return {string} The ID for the provided media.
<span class='line'> 73</span> */</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="NAME">minplayer.players.youtube.getMediaId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">reg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/^http[s]?\:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_\-]+)/i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">file.path.search</span><span class="PUNC">(</span><span class="NAME">reg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">file.path.match</span><span class="PUNC">(</span><span class="NAME">reg</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">file.path</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span>
<span class='line'> 84</span> </span><span class="COMM">/**
<span class='line'> 85</span> * Returns a preview image for this media player.
<span class='line'> 86</span> *
<span class='line'> 87</span> * @param {object} file A {@link minplayer.file} object.
<span class='line'> 88</span> * @param {string} type The type of image.
<span class='line'> 89</span> * @param {function} callback Called when the image is retrieved.
<span class='line'> 90</span> */</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="NAME">minplayer.players.youtube.getImage</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'thumbnail'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'1'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="STRN">'http://img.youtube.com/vi/'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">file.id</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'/'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'.jpg'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span>
<span class='line'> 96</span> </span><span class="COMM">/**
<span class='line'> 97</span> * Translates the player state for the YouTube API player.
<span class='line'> 98</span> *
<span class='line'> 99</span> * @param {number} playerState The YouTube player state.
<span class='line'>100</span> */</span><span class="WHIT">
<span class='line'>101</span> </span><span class="NAME">minplayer.players.youtube.prototype.setPlayerState</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">playerState</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">playerState</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">YT.PlayerState.CUED</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">YT.PlayerState.BUFFERING</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="NAME">this.onWaiting</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">YT.PlayerState.PAUSED</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">this.onPaused</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">YT.PlayerState.PLAYING</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">this.onPlaying</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">YT.PlayerState.ENDED</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT"> </span><span class="NAME">this.onComplete</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="KEYW">default</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>120</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>121</span>
<span class='line'>122</span> </span><span class="COMM">/**
<span class='line'>123</span> * Called when an error occurs.
<span class='line'>124</span> *
<span class='line'>125</span> * @param {string} event The onReady event that was triggered.
<span class='line'>126</span> */</span><span class="WHIT">
<span class='line'>127</span> </span><span class="NAME">minplayer.players.youtube.prototype.onReady</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.players.base.prototype.onReady.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.options.autoplay</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="NAME">this.pause</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT"> </span><span class="NAME">this.onLoaded</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>134</span>
<span class='line'>135</span> </span><span class="COMM">/**
<span class='line'>136</span> * Checks to see if this player can be found.
<span class='line'>137</span> * @return {bool} TRUE - Player is found, FALSE - otherwise.
<span class='line'>138</span> */</span><span class="WHIT">
<span class='line'>139</span> </span><span class="NAME">minplayer.players.youtube.prototype.playerFound</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'iframe#'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.options.id</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-player.youtube-player'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">iframe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.display.find</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">iframe.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>143</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span>
<span class='line'>145</span> </span><span class="COMM">/**
<span class='line'>146</span> * Called when the player state changes.
<span class='line'>147</span> *
<span class='line'>148</span> * @param {object} event A JavaScript Event.
<span class='line'>149</span> */</span><span class="WHIT">
<span class='line'>150</span> </span><span class="NAME">minplayer.players.youtube.prototype.onPlayerStateChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="NAME">this.setPlayerState</span><span class="PUNC">(</span><span class="NAME">event.data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>153</span>
<span class='line'>154</span> </span><span class="COMM">/**
<span class='line'>155</span> * Called when the player quality changes.
<span class='line'>156</span> *
<span class='line'>157</span> * @param {string} newQuality The new quality for the change.
<span class='line'>158</span> */</span><span class="WHIT">
<span class='line'>159</span> </span><span class="NAME">minplayer.players.youtube.prototype.onQualityChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newQuality</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT"> </span><span class="NAME">this.quality</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newQuality.data</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>161</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>162</span>
<span class='line'>163</span> </span><span class="COMM">/**
<span class='line'>164</span> * Determines if the player should show the playloader.
<span class='line'>165</span> *
<span class='line'>166</span> * @param {string} preview The preview image.
<span class='line'>167</span> * @return {bool} If this player implements its own playLoader.
<span class='line'>168</span> */</span><span class="WHIT">
<span class='line'>169</span> </span><span class="NAME">minplayer.players.youtube.prototype.hasPlayLoader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">preview</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">minplayer.hasTouch</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">preview</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span>
<span class='line'>173</span> </span><span class="COMM">/**
<span class='line'>174</span> * Determines if the player should show the controller.
<span class='line'>175</span> *
<span class='line'>176</span> * @return {bool} If this player implements its own playLoader.
<span class='line'>177</span> */</span><span class="WHIT">
<span class='line'>178</span> </span><span class="NAME">minplayer.players.youtube.prototype.hasController</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">minplayer.isIDevice</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>180</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span>
<span class='line'>182</span> </span><span class="COMM">/**
<span class='line'>183</span> * @see minplayer.players.base#create
<span class='line'>184</span> * @return {object} The media player entity.
<span class='line'>185</span> */</span><span class="WHIT">
<span class='line'>186</span> </span><span class="NAME">minplayer.players.youtube.prototype.create</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.players.base.prototype.create.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>188</span>
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="COMM">// Insert the YouTube iframe API player.</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">'script'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="NAME">tag.src</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'https://www.youtube.com/player_api'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstScriptTag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">'script'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="NAME">firstScriptTag.parentNode.insertBefore</span><span class="PUNC">(</span><span class="NAME">tag</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">firstScriptTag</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>194</span>
<span class='line'>195</span> </span><span class="WHIT"> </span><span class="COMM">// Get the player ID.</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="NAME">this.playerId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options.id</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-player'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>197</span>
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="COMM">// Poll until the YouTube API is ready.</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="NAME">this.poll</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">player</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ready</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="STRN">'#'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">player.playerId</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="NAME">ready</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ready</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'YT'</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="NAME">ready</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ready</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">YT.Player</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ready</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT"> </span><span class="COMM">// Determine the origin of this script.</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="STRN">'#'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">player.playerId</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">'youtube-player'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">origin</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">location.protocol</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="NAME">origin</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'//'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">location.hostname</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="NAME">origin</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">location.port</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">location.port</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>210</span>
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">playerVars</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.isIDevice</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="NAME">playerVars.origin</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">origin</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="NAME">playerVars</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="NAME">enablejsapi</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">minplayer.isIDevice</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="NAME">origin</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">origin</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="NAME">wmode</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'opaque'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="NAME">controls</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">minplayer.isAndroid</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>223</span>
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="COMM">// Create the player.</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT"> </span><span class="NAME">player.player</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">YT.Player</span><span class="PUNC">(</span><span class="NAME">player.playerId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT"> </span><span class="NAME">height</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'100%'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT"> </span><span class="NAME">width</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'100%'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="NAME">frameborder</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="NAME">videoId</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">player.mediaFile.id</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">playerVars</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">playerVars</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="NAME">events</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="STRN">'onReady'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="NAME">player.onReady</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="STRN">'onStateChange'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="NAME">player.onPlayerStateChange</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="STRN">'onPlaybackQualityChange'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">newQuality</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="NAME">player.onQualityChange</span><span class="PUNC">(</span><span class="NAME">newQuality</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="STRN">'onError'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">errorCode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="NAME">player.onError</span><span class="PUNC">(</span><span class="NAME">errorCode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">ready</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>250</span>
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="COMM">// Return the player.</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.playerId</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>255</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>256</span>
<span class='line'>257</span> </span><span class="COMM">/**
<span class='line'>258</span> * @see minplayer.players.base#load
<span class='line'>259</span> * @return {boolean} If this action was performed.
<span class='line'>260</span> */</span><span class="WHIT">
<span class='line'>261</span> </span><span class="NAME">minplayer.players.youtube.prototype.load</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.players.base.prototype.load.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">file</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="NAME">this.player.loadVideoById</span><span class="PUNC">(</span><span class="NAME">file.id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.quality</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>266</span>
<span class='line'>267</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>268</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>269</span>
<span class='line'>270</span> </span><span class="COMM">/**
<span class='line'>271</span> * @see minplayer.players.base#play
<span class='line'>272</span> * @return {boolean} If this action was performed.
<span class='line'>273</span> */</span><span class="WHIT">
<span class='line'>274</span> </span><span class="NAME">minplayer.players.youtube.prototype.play</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.players.base.prototype.play.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>276</span> </span><span class="WHIT"> </span><span class="NAME">this.onWaiting</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="NAME">this.player.playVideo</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>278</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>279</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>280</span>
<span class='line'>281</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>282</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>283</span>
<span class='line'>284</span> </span><span class="COMM">/**
<span class='line'>285</span> * @see minplayer.players.base#pause
<span class='line'>286</span> * @return {boolean} If this action was performed.
<span class='line'>287</span> */</span><span class="WHIT">
<span class='line'>288</span> </span><span class="NAME">minplayer.players.youtube.prototype.pause</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.players.base.prototype.pause.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="NAME">this.player.pauseVideo</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>293</span>
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>296</span>
<span class='line'>297</span> </span><span class="COMM">/**
<span class='line'>298</span> * @see minplayer.players.base#stop
<span class='line'>299</span> * @return {boolean} If this action was performed.
<span class='line'>300</span> */</span><span class="WHIT">
<span class='line'>301</span> </span><span class="NAME">minplayer.players.youtube.prototype.stop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.players.base.prototype.stop.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT"> </span><span class="NAME">this.player.stopVideo</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>306</span>
<span class='line'>307</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>308</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>309</span>
<span class='line'>310</span> </span><span class="COMM">/**
<span class='line'>311</span> * @see minplayer.players.base#seek
<span class='line'>312</span> * @return {boolean} If this action was performed.
<span class='line'>313</span> */</span><span class="WHIT">
<span class='line'>314</span> </span><span class="NAME">minplayer.players.youtube.prototype.seek</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">pos</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.players.base.prototype.seek.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pos</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="NAME">this.onWaiting</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="NAME">this.player.seekTo</span><span class="PUNC">(</span><span class="NAME">pos</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>320</span>
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>322</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span>
<span class='line'>324</span> </span><span class="COMM">/**
<span class='line'>325</span> * @see minplayer.players.base#setVolume
<span class='line'>326</span> * @return {boolean} If this action was performed.
<span class='line'>327</span> */</span><span class="WHIT">
<span class='line'>328</span> </span><span class="NAME">minplayer.players.youtube.prototype.setVolume</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">vol</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">minplayer.players.base.prototype.setVolume.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">vol</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="NAME">this.player.setVolume</span><span class="PUNC">(</span><span class="NAME">vol</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>333</span>
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span>
<span class='line'>337</span> </span><span class="COMM">/**
<span class='line'>338</span> * @see minplayer.players.base#getVolume
<span class='line'>339</span> */</span><span class="WHIT">
<span class='line'>340</span> </span><span class="NAME">minplayer.players.youtube.prototype.getVolume</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT"> </span><span class="NAME">this.getValue</span><span class="PUNC">(</span><span class="STRN">'getVolume'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>343</span>
<span class='line'>344</span> </span><span class="COMM">/**
<span class='line'>345</span> * @see minplayer.players.base#getDuration.
<span class='line'>346</span> */</span><span class="WHIT">
<span class='line'>347</span> </span><span class="NAME">minplayer.players.youtube.prototype.getDuration</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="NAME">this.getValue</span><span class="PUNC">(</span><span class="STRN">'getDuration'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>349</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>350</span>
<span class='line'>351</span> </span><span class="COMM">/**
<span class='line'>352</span> * @see minplayer.players.base#getCurrentTime
<span class='line'>353</span> */</span><span class="WHIT">
<span class='line'>354</span> </span><span class="NAME">minplayer.players.youtube.prototype.getCurrentTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT"> </span><span class="NAME">this.getValue</span><span class="PUNC">(</span><span class="STRN">'getCurrentTime'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>356</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span>
<span class='line'>358</span> </span><span class="COMM">/**
<span class='line'>359</span> * @see minplayer.players.base#getBytesStart.
<span class='line'>360</span> */</span><span class="WHIT">
<span class='line'>361</span> </span><span class="NAME">minplayer.players.youtube.prototype.getBytesStart</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>362</span> </span><span class="WHIT"> </span><span class="NAME">this.getValue</span><span class="PUNC">(</span><span class="STRN">'getVideoStartBytes'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>363</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>364</span>
<span class='line'>365</span> </span><span class="COMM">/**
<span class='line'>366</span> * @see minplayer.players.base#getBytesLoaded.
<span class='line'>367</span> */</span><span class="WHIT">
<span class='line'>368</span> </span><span class="NAME">minplayer.players.youtube.prototype.getBytesLoaded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>369</span> </span><span class="WHIT"> </span><span class="NAME">this.getValue</span><span class="PUNC">(</span><span class="STRN">'getVideoBytesLoaded'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>370</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>371</span>
<span class='line'>372</span> </span><span class="COMM">/**
<span class='line'>373</span> * @see minplayer.players.base#getBytesTotal.
<span class='line'>374</span> */</span><span class="WHIT">
<span class='line'>375</span> </span><span class="NAME">minplayer.players.youtube.prototype.getBytesTotal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT"> </span><span class="NAME">this.getValue</span><span class="PUNC">(</span><span class="STRN">'getVideoBytesTotal'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>377</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>378</span> </span></pre></body></html>