src_minplayer.players.vimeo.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 vimeo 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.vimeo = function(context, options, queue) {
17
18 // Derive from players base.
19 minplayer.players.base.call(this, context, options, queue);
20 };
21
22 /** Derive from minplayer.players.base. */
23 minplayer.players.vimeo.prototype = new minplayer.players.base();
24
25 /** Reset the constructor. */
26 minplayer.players.vimeo.prototype.constructor = minplayer.players.vimeo;
27
28 /**
29 * @see minplayer.plugin.construct
30 * @this minplayer.players.vimeo
31 */
32 minplayer.players.vimeo.prototype.construct = function() {
33
34 // Call the players.flash constructor.
35 minplayer.players.base.prototype.construct.call(this);
36
37 // Set the plugin name within the options.
38 this.options.pluginName = 'vimeo';
39 };
40
41 /**
42 * @see minplayer.players.base#getPriority
43 * @param {object} file A {@link minplayer.file} object.
44 * @return {number} The priority of this media player.
45 */
46 minplayer.players.vimeo.getPriority = function(file) {
47 return 10;
48 };
49
50 /**
51 * @see minplayer.players.base#canPlay
52 * @return {boolean} If this player can play this media type.
53 */
54 minplayer.players.vimeo.canPlay = function(file) {
55
56 // Check for the mimetype for vimeo.
57 if (file.mimetype === 'video/vimeo') {
58 return true;
59 }
60
61 // If the path is a vimeo path, then return true.
62 return (file.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0);
63 };
64
65 /**
66 * Determines if the player should show the playloader.
67 *
68 * @param {string} preview The preview image.
69 * @return {bool} If this player implements its own playLoader.
70 */
71 minplayer.players.vimeo.prototype.hasPlayLoader = function(preview) {
72 return minplayer.hasTouch || !preview;
73 };
74
75 /**
76 * Determines if the player should show the playloader.
77 *
78 * @return {bool} If this player implements its own playLoader.
79 */
80 minplayer.players.vimeo.prototype.hasController = function() {
81 return minplayer.hasTouch;
82 };
83
84 /**
85 * Return the ID for a provided media file.
86 *
87 * @param {object} file A {@link minplayer.file} object.
88 * @return {string} The ID for the provided media.
89 */
90 minplayer.players.vimeo.getMediaId = function(file) {
91 var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;
92 if (file.path.search(regex) === 0) {
93 return file.path.match(regex)[3];
94 }
95 else {
96 return file.path;
97 }
98 };
99
100 /**
101 * Returns a preview image for this media player.
102 *
103 * @param {object} file A {@link minplayer.file} object.
104 * @param {string} type The type of image.
105 * @param {function} callback Called when the image is retrieved.
106 */
107 minplayer.players.vimeo.getImage = function(file, type, callback) {
108 jQuery.ajax({
109 url: 'http://vimeo.com/api/v2/video/' + file.id + '.json',
110 dataType: 'jsonp',
111 success: function(data) {
112 callback(data[0].thumbnail_large);
113 }
114 });
115 };
116
117 /**
118 * @see minplayer.players.base#reset
119 */
120 minplayer.players.vimeo.prototype.reset = function() {
121
122 // Reset the flash variables..
123 minplayer.players.base.prototype.reset.call(this);
124 };
125
126 /**
127 * @see minplayer.players.base#create
128 * @return {object} The media player entity.
129 */
130 minplayer.players.vimeo.prototype.create = function() {
131 minplayer.players.base.prototype.create.call(this);
132
133 // Insert the Vimeo Froogaloop player.
134 var tag = document.createElement('script');
135 tag.src = 'http://a.vimeocdn.com/js/froogaloop2.min.js';
136 var firstScriptTag = document.getElementsByTagName('script')[0];
137 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
138
139 // Create the iframe for this player.
140 var iframe = document.createElement('iframe');
141 iframe.setAttribute('id', this.options.id + '-player');
142 iframe.setAttribute('type', 'text/html');
143 iframe.setAttribute('width', '100%');
144 iframe.setAttribute('height', '100%');
145 iframe.setAttribute('frameborder', '0');
146 jQuery(iframe).addClass('vimeo-player');
147
148 // Get the source.
149 var src = 'http://player.vimeo.com/video/';
150 src += this.mediaFile.id + '?';
151
152 // Add the parameters to the src.
153 src += jQuery.param({
154 'wmode': 'opaque',
155 'api': 1,
156 'player_id': this.options.id + '-player',
157 'title': 0,
158 'byline': 0,
159 'portrait': 0,
160 'autoplay': this.options.autoplay,
161 'loop': this.options.loop
162 });
163
164 // Set the source of the iframe.
165 iframe.setAttribute('src', src);
166
167 // Now register this player when the froogaloop code is loaded.
168 this.poll((function(player) {
169 return function() {
170 if (window.Froogaloop) {
171 player.player = window.Froogaloop(iframe);
172 var playerTimeout = 0;
173 player.player.addEvent('ready', function() {
174 clearTimeout(playerTimeout);
175 player.onReady();
176 player.onError('');
177 });
178 playerTimeout = setTimeout(function() {
179 player.onReady();
180 player.onError('Unable to play video.');
181 }, 2000);
182 }
183 return !window.Froogaloop;
184 };
185 })(this), 200);
186
187 // Trigger that the load has started.
188 this.trigger('loadstart');
189
190 // Return the player.
191 return iframe;
192 };
193
194 /**
195 * @see minplayer.players.base#onReady
196 */
197 minplayer.players.vimeo.prototype.onReady = function(player_id) {
198
199 // Add the other listeners.
200 this.player.addEvent('loadProgress', (function(player) {
201 return function(progress) {
202 player.duration.set(parseFloat(progress.duration));
203 player.bytesLoaded.set(progress.bytesLoaded);
204 player.bytesTotal.set(progress.bytesTotal);
205 };
206 })(this));
207
208 this.player.addEvent('playProgress', (function(player) {
209 return function(progress) {
210 player.duration.set(parseFloat(progress.duration));
211 player.currentTime.set(parseFloat(progress.seconds));
212 };
213 })(this));
214
215 this.player.addEvent('play', (function(player) {
216 return function() {
217 player.onPlaying();
218 };
219 })(this));
220
221 this.player.addEvent('pause', (function(player) {
222 return function() {
223 player.onPaused();
224 };
225 })(this));
226
227 this.player.addEvent('finish', (function(player) {
228 return function() {
229 player.onComplete();
230 };
231 })(this));
232
233 minplayer.players.base.prototype.onReady.call(this);
234 this.onLoaded();
235 };
236
237 /**
238 * Clears the media player.
239 */
240 minplayer.players.vimeo.prototype.clear = function() {
241 if (this.player) {
242 this.player.api('unload');
243 }
244 minplayer.players.base.prototype.clear.call(this);
245 };
246
247 /**
248 * @see minplayer.players.base#load
249 * @return {boolean} If this action was performed.
250 */
251 minplayer.players.vimeo.prototype.load = function(file) {
252 if (minplayer.players.base.prototype.load.call(this, file)) {
253 this.construct();
254 return true;
255 }
256 return false;
257 };
258
259 /**
260 * @see minplayer.players.base#play
261 * @return {boolean} If this action was performed.
262 */
263 minplayer.players.vimeo.prototype.play = function() {
264 if (minplayer.players.base.prototype.play.call(this)) {
265 this.player.api('play');
266 return true;
267 }
268
269 return false;
270 };
271
272 /**
273 * @see minplayer.players.base#pause
274 * @return {boolean} If this action was performed.
275 */
276 minplayer.players.vimeo.prototype.pause = function() {
277 if (minplayer.players.base.prototype.pause.call(this)) {
278 this.player.api('pause');
279 return true;
280 }
281
282 return false;
283 };
284
285 /**
286 * @see minplayer.players.base#stop
287 * @return {boolean} If this action was performed.
288 */
289 minplayer.players.vimeo.prototype.stop = function() {
290 if (minplayer.players.base.prototype.stop.call(this)) {
291 this.player.api('unload');
292 return true;
293 }
294
295 return false;
296 };
297
298 /**
299 * @see minplayer.players.base#seek
300 * @return {boolean} If this action was performed.
301 */
302 minplayer.players.vimeo.prototype.seek = function(pos) {
303 if (minplayer.players.base.prototype.seek.call(this, pos)) {
304 this.player.api('seekTo', pos);
305 return true;
306 }
307
308 return false;
309 };
310
311 /**
312 * @see minplayer.players.base#setVolume
313 * @return {boolean} If this action was performed.
314 */
315 minplayer.players.vimeo.prototype.setVolume = function(vol) {
316 if (minplayer.players.base.prototype.setVolume.call(this, vol)) {
317 this.volume.set(vol);
318 this.player.api('setVolume', vol);
319 return true;
320 }
321
322 return false;
323 };
324
325 /**
326 * @see minplayer.players.base#getVolume
327 */
328 minplayer.players.vimeo.prototype.getVolume = function(callback) {
329 this.player.api('getVolume', function(vol) {
330 callback(vol);
331 });
332 };
333
334 /**
335 * @see minplayer.players.base#getDuration.
336 */
337 minplayer.players.vimeo.prototype.getDuration = function(callback) {
338 if (this.isReady()) {
339 if (this.duration.value) {
340 callback(this.duration.value);
341 }
342 else {
343 this.player.api('getDuration', function(duration) {
344 callback(duration);
345 });
346 }
347 }
348 };
349
File
player/doc/symbols/src/src_minplayer.players.vimeo.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 vimeo 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.vimeo</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">// Derive from players base.</span><span class="WHIT">
<span class='line'> 19</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'> 20</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 21</span>
<span class='line'> 22</span> </span><span class="COMM">/** Derive from minplayer.players.base. */</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="NAME">minplayer.players.vimeo.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'> 24</span>
<span class='line'> 25</span> </span><span class="COMM">/** Reset the constructor. */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="NAME">minplayer.players.vimeo.prototype.constructor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.players.vimeo</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span>
<span class='line'> 28</span> </span><span class="COMM">/**
<span class='line'> 29</span> * @see minplayer.plugin.construct
<span class='line'> 30</span> * @this minplayer.players.vimeo
<span class='line'> 31</span> */</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="NAME">minplayer.players.vimeo.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'> 33</span>
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="COMM">// Call the players.flash constructor.</span><span class="WHIT">
<span class='line'> 35</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'> 36</span>
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="COMM">// Set the plugin name within the options.</span><span class="WHIT">
<span class='line'> 38</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">'vimeo'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 40</span>
<span class='line'> 41</span> </span><span class="COMM">/**
<span class='line'> 42</span> * @see minplayer.players.base#getPriority
<span class='line'> 43</span> * @param {object} file A {@link minplayer.file} object.
<span class='line'> 44</span> * @return {number} The priority of this media player.
<span class='line'> 45</span> */</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="NAME">minplayer.players.vimeo.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'> 47</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'> 48</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 49</span>
<span class='line'> 50</span> </span><span class="COMM">/**
<span class='line'> 51</span> * @see minplayer.players.base#canPlay
<span class='line'> 52</span> * @return {boolean} If this player can play this media type.
<span class='line'> 53</span> */</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="NAME">minplayer.players.vimeo.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'> 55</span>
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="COMM">// Check for the mimetype for vimeo.</span><span class="WHIT">
<span class='line'> 57</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/vimeo'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 58</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'> 59</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 60</span>
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="COMM">// If the path is a vimeo path, then return true.</span><span class="WHIT">
<span class='line'> 62</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\.)?vimeo\.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'> 63</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span>
<span class='line'> 65</span> </span><span class="COMM">/**
<span class='line'> 66</span> * Determines if the player should show the playloader.
<span class='line'> 67</span> *
<span class='line'> 68</span> * @param {string} preview The preview image.
<span class='line'> 69</span> * @return {bool} If this player implements its own playLoader.
<span class='line'> 70</span> */</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="NAME">minplayer.players.vimeo.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'> 72</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'> 73</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 74</span>
<span class='line'> 75</span> </span><span class="COMM">/**
<span class='line'> 76</span> * Determines if the player should show the playloader.
<span class='line'> 77</span> *
<span class='line'> 78</span> * @return {bool} If this player implements its own playLoader.
<span class='line'> 79</span> */</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="NAME">minplayer.players.vimeo.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'> 81</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">minplayer.hasTouch</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> * Return the ID for a provided media file.
<span class='line'> 86</span> *
<span class='line'> 87</span> * @param {object} file A {@link minplayer.file} object.
<span class='line'> 88</span> * @return {string} The ID for the provided media.
<span class='line'> 89</span> */</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="NAME">minplayer.players.vimeo.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'> 91</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">regex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</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">regex</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'> 93</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">regex</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">3</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 95</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'> 96</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'> 97</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 99</span>
<span class='line'>100</span> </span><span class="COMM">/**
<span class='line'>101</span> * Returns a preview image for this media player.
<span class='line'>102</span> *
<span class='line'>103</span> * @param {object} file A {@link minplayer.file} object.
<span class='line'>104</span> * @param {string} type The type of image.
<span class='line'>105</span> * @param {function} callback Called when the image is retrieved.
<span class='line'>106</span> */</span><span class="WHIT">
<span class='line'>107</span> </span><span class="NAME">minplayer.players.vimeo.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'>108</span> </span><span class="WHIT"> </span><span class="NAME">jQuery.ajax</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'http://vimeo.com/api/v2/video/'</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">'.json'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="NAME">dataType</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'jsonp'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="NAME">success</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">thumbnail_large</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span>
<span class='line'>117</span> </span><span class="COMM">/**
<span class='line'>118</span> * @see minplayer.players.base#reset
<span class='line'>119</span> */</span><span class="WHIT">
<span class='line'>120</span> </span><span class="NAME">minplayer.players.vimeo.prototype.reset</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'>121</span>
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="COMM">// Reset the flash variables..</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.players.base.prototype.reset.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'>124</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>125</span>
<span class='line'>126</span> </span><span class="COMM">/**
<span class='line'>127</span> * @see minplayer.players.base#create
<span class='line'>128</span> * @return {object} The media player entity.
<span class='line'>129</span> */</span><span class="WHIT">
<span class='line'>130</span> </span><span class="NAME">minplayer.players.vimeo.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'>131</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'>132</span>
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="COMM">// Insert the Vimeo Froogaloop player.</span><span class="WHIT">
<span class='line'>134</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'>135</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">'http://a.vimeocdn.com/js/froogaloop2.min.js'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>136</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'>137</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'>138</span>
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="COMM">// Create the iframe for this player.</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">iframe</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">'iframe'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">iframe.setAttribute</span><span class="PUNC">(</span><span class="STRN">'id'</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="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="NAME">iframe.setAttribute</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'text/html'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="NAME">iframe.setAttribute</span><span class="PUNC">(</span><span class="STRN">'width'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'100%'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="NAME">iframe.setAttribute</span><span class="PUNC">(</span><span class="STRN">'height'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'100%'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="NAME">iframe.setAttribute</span><span class="PUNC">(</span><span class="STRN">'frameborder'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'0'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="NAME">iframe</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">'vimeo-player'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>147</span>
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="COMM">// Get the source.</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">src</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'http://player.vimeo.com/video/'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="NAME">src</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.mediaFile.id</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'?'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>151</span>
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="COMM">// Add the parameters to the src.</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="NAME">src</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jQuery.param</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="STRN">'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'>155</span> </span><span class="WHIT"> </span><span class="STRN">'api'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="STRN">'player_id'</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'>157</span> </span><span class="WHIT"> </span><span class="STRN">'title'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT"> </span><span class="STRN">'byline'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT"> </span><span class="STRN">'portrait'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT"> </span><span class="STRN">'autoplay'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.options.autoplay</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT"> </span><span class="STRN">'loop'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.options.loop</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span>
<span class='line'>164</span> </span><span class="WHIT"> </span><span class="COMM">// Set the source of the iframe.</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT"> </span><span class="NAME">iframe.setAttribute</span><span class="PUNC">(</span><span class="STRN">'src'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">src</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>166</span>
<span class='line'>167</span> </span><span class="WHIT"> </span><span class="COMM">// Now register this player when the froogaloop code is loaded.</span><span class="WHIT">
<span class='line'>168</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'>169</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'>170</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">window.Froogaloop</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>171</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="NAME">window.Froogaloop</span><span class="PUNC">(</span><span class="NAME">iframe</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">playerTimeout</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'>173</span> </span><span class="WHIT"> </span><span class="NAME">player.player.addEvent</span><span class="PUNC">(</span><span class="STRN">'ready'</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'>174</span> </span><span class="WHIT"> </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">playerTimeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="NAME">player.onReady</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT"> </span><span class="NAME">player.onError</span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">playerTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</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="NAME">player.onReady</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">player.onError</span><span class="PUNC">(</span><span class="STRN">'Unable to play video.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">2000</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">window.Froogaloop</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>185</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'>186</span>
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="COMM">// Trigger that the load has started.</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="NAME">this.trigger</span><span class="PUNC">(</span><span class="STRN">'loadstart'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span>
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="COMM">// Return the player.</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">iframe</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>192</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span>
<span class='line'>194</span> </span><span class="COMM">/**
<span class='line'>195</span> * @see minplayer.players.base#onReady
<span class='line'>196</span> */</span><span class="WHIT">
<span class='line'>197</span> </span><span class="NAME">minplayer.players.vimeo.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">player_id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span>
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="COMM">// Add the other listeners.</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="NAME">this.player.addEvent</span><span class="PUNC">(</span><span class="STRN">'loadProgress'</span><span class="PUNC">,</span><span class="WHIT"> </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'>201</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="NAME">progress</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="NAME">player.duration.set</span><span class="PUNC">(</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">progress.duration</span><span class="PUNC">)</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">player.bytesLoaded.set</span><span class="PUNC">(</span><span class="NAME">progress.bytesLoaded</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="NAME">player.bytesTotal.set</span><span class="PUNC">(</span><span class="NAME">progress.bytesTotal</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>206</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="PUNC">;</span><span class="WHIT">
<span class='line'>207</span>
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="NAME">this.player.addEvent</span><span class="PUNC">(</span><span class="STRN">'playProgress'</span><span class="PUNC">,</span><span class="WHIT"> </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'>209</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="NAME">progress</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="NAME">player.duration.set</span><span class="PUNC">(</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">progress.duration</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="NAME">player.currentTime.set</span><span class="PUNC">(</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">progress.seconds</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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>213</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="PUNC">;</span><span class="WHIT">
<span class='line'>214</span>
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="NAME">this.player.addEvent</span><span class="PUNC">(</span><span class="STRN">'play'</span><span class="PUNC">,</span><span class="WHIT"> </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'>216</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'>217</span> </span><span class="WHIT"> </span><span class="NAME">player.onPlaying</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>219</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="PUNC">;</span><span class="WHIT">
<span class='line'>220</span>
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="NAME">this.player.addEvent</span><span class="PUNC">(</span><span class="STRN">'pause'</span><span class="PUNC">,</span><span class="WHIT"> </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'>222</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'>223</span> </span><span class="WHIT"> </span><span class="NAME">player.onPaused</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>225</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="PUNC">;</span><span class="WHIT">
<span class='line'>226</span>
<span class='line'>227</span> </span><span class="WHIT"> </span><span class="NAME">this.player.addEvent</span><span class="PUNC">(</span><span class="STRN">'finish'</span><span class="PUNC">,</span><span class="WHIT"> </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'>228</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'>229</span> </span><span class="WHIT"> </span><span class="NAME">player.onComplete</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>231</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="PUNC">;</span><span class="WHIT">
<span class='line'>232</span>
<span class='line'>233</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'>234</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'>235</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>236</span>
<span class='line'>237</span> </span><span class="COMM">/**
<span class='line'>238</span> * Clears the media player.
<span class='line'>239</span> */</span><span class="WHIT">
<span class='line'>240</span> </span><span class="NAME">minplayer.players.vimeo.prototype.clear</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'>241</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.player</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">this.player.api</span><span class="PUNC">(</span><span class="STRN">'unload'</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="NAME">minplayer.players.base.prototype.clear.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'>245</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span>
<span class='line'>247</span> </span><span class="COMM">/**
<span class='line'>248</span> * @see minplayer.players.base#load
<span class='line'>249</span> * @return {boolean} If this action was performed.
<span class='line'>250</span> */</span><span class="WHIT">
<span class='line'>251</span> </span><span class="NAME">minplayer.players.vimeo.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'>252</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'>253</span> </span><span class="WHIT"> </span><span class="NAME">this.construct</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>254</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'>255</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>256</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'>257</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>258</span>
<span class='line'>259</span> </span><span class="COMM">/**
<span class='line'>260</span> * @see minplayer.players.base#play
<span class='line'>261</span> * @return {boolean} If this action was performed.
<span class='line'>262</span> */</span><span class="WHIT">
<span class='line'>263</span> </span><span class="NAME">minplayer.players.vimeo.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'>264</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'>265</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'play'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>266</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'>267</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>268</span>
<span class='line'>269</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'>270</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>271</span>
<span class='line'>272</span> </span><span class="COMM">/**
<span class='line'>273</span> * @see minplayer.players.base#pause
<span class='line'>274</span> * @return {boolean} If this action was performed.
<span class='line'>275</span> */</span><span class="WHIT">
<span class='line'>276</span> </span><span class="NAME">minplayer.players.vimeo.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'>277</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'>278</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'pause'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>279</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'>280</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>281</span>
<span class='line'>282</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'>283</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>284</span>
<span class='line'>285</span> </span><span class="COMM">/**
<span class='line'>286</span> * @see minplayer.players.base#stop
<span class='line'>287</span> * @return {boolean} If this action was performed.
<span class='line'>288</span> */</span><span class="WHIT">
<span class='line'>289</span> </span><span class="NAME">minplayer.players.vimeo.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'>290</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'>291</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'unload'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>292</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'>293</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>294</span>
<span class='line'>295</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'>296</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span>
<span class='line'>298</span> </span><span class="COMM">/**
<span class='line'>299</span> * @see minplayer.players.base#seek
<span class='line'>300</span> * @return {boolean} If this action was performed.
<span class='line'>301</span> */</span><span class="WHIT">
<span class='line'>302</span> </span><span class="NAME">minplayer.players.vimeo.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'>303</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'>304</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'seekTo'</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 class='line'>305</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'>306</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>307</span>
<span class='line'>308</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'>309</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span>
<span class='line'>311</span> </span><span class="COMM">/**
<span class='line'>312</span> * @see minplayer.players.base#setVolume
<span class='line'>313</span> * @return {boolean} If this action was performed.
<span class='line'>314</span> */</span><span class="WHIT">
<span class='line'>315</span> </span><span class="NAME">minplayer.players.vimeo.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'>316</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'>317</span> </span><span class="WHIT"> </span><span class="NAME">this.volume.set</span><span class="PUNC">(</span><span class="NAME">vol</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'setVolume'</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 class='line'>319</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'>320</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>321</span>
<span class='line'>322</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'>323</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>324</span>
<span class='line'>325</span> </span><span class="COMM">/**
<span class='line'>326</span> * @see minplayer.players.base#getVolume
<span class='line'>327</span> */</span><span class="WHIT">
<span class='line'>328</span> </span><span class="NAME">minplayer.players.vimeo.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'>329</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'getVolume'</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'>330</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">vol</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>332</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>333</span>
<span class='line'>334</span> </span><span class="COMM">/**
<span class='line'>335</span> * @see minplayer.players.base#getDuration.
<span class='line'>336</span> */</span><span class="WHIT">
<span class='line'>337</span> </span><span class="NAME">minplayer.players.vimeo.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'>338</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isReady</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.duration.value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">this.duration.value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>342</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'>343</span> </span><span class="WHIT"> </span><span class="NAME">this.player.api</span><span class="PUNC">(</span><span class="STRN">'getDuration'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">duration</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">duration</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>348</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>349</span> </span></pre></body></html>