You are here

src_minplayer.playLoader.base.js.html in HTML5 Media 7

  1 /** The minplayer namespace. */
  2 var minplayer = minplayer || {};
  3 
  4 /** Define the playLoader object. */
  5 minplayer.playLoader = minplayer.playLoader || {};
  6 
  7 /**
  8  * @constructor
  9  * @extends minplayer.display
 10  * @class The play loader base class, which is used to control the busy
 11  * cursor, big play button, and the opaque background which shows when the
 12  * player is paused.
 13  *
 14  * @param {object} context The jQuery context.
 15  * @param {object} options This components options.
 16  */
 17 minplayer.playLoader.base = function(context, options) {
 18 
 19   // Define the flags that control the busy cursor.
 20   this.busy = new minplayer.flags();
 21 
 22   // Define the flags that control the big play button.
 23   this.bigPlay = new minplayer.flags();
 24 
 25   /** The preview image. */
 26   this.preview = null;
 27 
 28   // Derive from display
 29   minplayer.display.call(this, 'playLoader', context, options);
 30 };
 31 
 32 /** Derive from minplayer.display. */
 33 minplayer.playLoader.base.prototype = new minplayer.display();
 34 
 35 /** Reset the constructor. */
 36 minplayer.playLoader.base.prototype.constructor = minplayer.playLoader.base;
 37 
 38 /**
 39  * The constructor.
 40  */
 41 minplayer.playLoader.base.prototype.construct = function() {
 42 
 43   // Call the media display constructor.
 44   minplayer.display.prototype.construct.call(this);
 45 
 46   // Get the media plugin.
 47   this.get('media', function(media) {
 48 
 49     // Only bind if this player does not have its own play loader.
 50     if (!media.hasPlayLoader()) {
 51 
 52       // Load the preview image.
 53       this.loadPreview();
 54 
 55       // Trigger a play event when someone clicks on the controller.
 56       if (this.elements.bigPlay) {
 57         this.elements.bigPlay.unbind().bind('click', function(event) {
 58           event.preventDefault();
 59           jQuery(this).hide();
 60           media.play();
 61         });
 62       }
 63 
 64       // Bind to the player events to control the play loader.
 65       media.unbind('loadstart').bind('loadstart', {obj: this}, function(event) {
 66         event.data.obj.busy.setFlag('media', true);
 67         event.data.obj.bigPlay.setFlag('media', true);
 68         if (event.data.obj.preview) {
 69           event.data.obj.elements.preview.show();
 70         }
 71         event.data.obj.checkVisibility();
 72       });
 73       media.bind('waiting', {obj: this}, function(event) {
 74         event.data.obj.busy.setFlag('media', true);
 75         event.data.obj.checkVisibility();
 76       });
 77       media.bind('loadeddata', {obj: this}, function(event) {
 78         event.data.obj.busy.setFlag('media', false);
 79         event.data.obj.checkVisibility();
 80       });
 81       media.bind('playing', {obj: this}, function(event) {
 82         event.data.obj.busy.setFlag('media', false);
 83         event.data.obj.bigPlay.setFlag('media', false);
 84         if (event.data.obj.preview) {
 85           event.data.obj.elements.preview.hide();
 86         }
 87         event.data.obj.checkVisibility();
 88       });
 89       media.bind('pause', {obj: this}, function(event) {
 90         event.data.obj.bigPlay.setFlag('media', true);
 91         event.data.obj.checkVisibility();
 92       });
 93     }
 94     else {
 95 
 96       // Hide the busy cursor.
 97       if (this.elements.busy) {
 98         this.elements.busy.unbind().hide();
 99       }
100 
101       // Hide the big play button.
102       if (this.elements.bigPlay) {
103         this.elements.bigPlay.unbind().hide();
104       }
105 
106       // Hide the display.
107       this.display.unbind().hide();
108     }
109   });
110 
111   // We are now ready.
112   this.ready();
113 };
114 
115 /**
116  * Loads the preview image.
117  */
118 minplayer.playLoader.base.prototype.loadPreview = function() {
119 
120   // If the preview element exists.
121   if (this.elements.preview) {
122 
123     // Get the poster image.
124     if (!this.options.preview) {
125       this.options.preview = this.elements.media.attr('poster');
126     }
127 
128     // Reset the media's poster image.
129     this.elements.media.attr('poster', '');
130 
131     // If there is a preview to show...
132     if (this.options.preview) {
133 
134       // Say that this has a preview.
135       this.elements.preview.addClass('has-preview').show();
136 
137       // Create a new preview image.
138       this.preview = new minplayer.image(this.elements.preview, this.options);
139 
140       // Create the image.
141       this.preview.load(this.options.preview);
142     }
143     else {
144 
145       // Hide the preview.
146       this.elements.preview.hide();
147     }
148   }
149 };
150 
151 /**
152  * Hide or show certain elements based on the state of the busy and big play
153  * button.
154  */
155 minplayer.playLoader.base.prototype.checkVisibility = function() {
156 
157   // Hide or show the busy cursor based on the flags.
158   if (this.busy.flag) {
159     this.elements.busy.show();
160   }
161   else {
162     this.elements.busy.hide();
163   }
164 
165   // Hide or show the big play button based on the flags.
166   if (this.bigPlay.flag) {
167     this.elements.bigPlay.show();
168   }
169   else {
170     this.elements.bigPlay.hide();
171   }
172 
173   // Show the control either flag is set.
174   if (this.bigPlay.flag || this.busy.flag) {
175     this.display.show();
176   }
177 
178   // Hide the whole control if both flags are 0.
179   if (!this.bigPlay.flag && !this.busy.flag) {
180     this.display.hide();
181   }
182 };
183 

File

player/doc/symbols/src/src_minplayer.playLoader.base.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">/** Define the playLoader object. */</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="NAME">minplayer.playLoader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.playLoader</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.display
<span class='line'> 10</span>  * @class The play loader base class, which is used to control the busy
<span class='line'> 11</span>  * cursor, big play button, and the opaque background which shows when the
<span class='line'> 12</span>  * player is paused.
<span class='line'> 13</span>  *
<span class='line'> 14</span>  * @param {object} context The jQuery context.
<span class='line'> 15</span>  * @param {object} options This components options.
<span class='line'> 16</span>  */</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="NAME">minplayer.playLoader.base</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="PUNC">{</span><span class="WHIT">
<span class='line'> 18</span> 
<span class='line'> 19</span> </span><span class="WHIT">  </span><span class="COMM">// Define the flags that control the busy cursor.</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="WHIT">  </span><span class="NAME">this.busy</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.flags</span><span class="PUNC">(</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="WHIT">  </span><span class="COMM">// Define the flags that control the big play button.</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">  </span><span class="NAME">this.bigPlay</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.flags</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="WHIT">  </span><span class="COMM">/** The preview image. */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">  </span><span class="NAME">this.preview</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span> 
<span class='line'> 28</span> </span><span class="WHIT">  </span><span class="COMM">// Derive from display</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">  </span><span class="NAME">minplayer.display.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'playLoader'</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="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 31</span> 
<span class='line'> 32</span> </span><span class="COMM">/** Derive from minplayer.display. */</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="NAME">minplayer.playLoader.base.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.display</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 34</span> 
<span class='line'> 35</span> </span><span class="COMM">/** Reset the constructor. */</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="NAME">minplayer.playLoader.base.prototype.constructor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.playLoader.base</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 37</span> 
<span class='line'> 38</span> </span><span class="COMM">/**
<span class='line'> 39</span>  * The constructor.
<span class='line'> 40</span>  */</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="NAME">minplayer.playLoader.base.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'> 42</span> 
<span class='line'> 43</span> </span><span class="WHIT">  </span><span class="COMM">// Call the media display constructor.</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">  </span><span class="NAME">minplayer.display.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'> 45</span> 
<span class='line'> 46</span> </span><span class="WHIT">  </span><span class="COMM">// Get the media plugin.</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">  </span><span class="NAME">this.get</span><span class="PUNC">(</span><span class="STRN">'media'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">media</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 48</span> 
<span class='line'> 49</span> </span><span class="WHIT">    </span><span class="COMM">// Only bind if this player does not have its own play loader.</span><span class="WHIT">
<span class='line'> 50</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">media.hasPlayLoader</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'> 51</span> 
<span class='line'> 52</span> </span><span class="WHIT">      </span><span class="COMM">// Load the preview image.</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">      </span><span class="NAME">this.loadPreview</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> 
<span class='line'> 55</span> </span><span class="WHIT">      </span><span class="COMM">// Trigger a play event when someone clicks on the controller.</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.elements.bigPlay</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">        </span><span class="NAME">this.elements.bigPlay.unbind</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">'click'</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'> 58</span> </span><span class="WHIT">          </span><span class="NAME">event.preventDefault</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">          </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">          </span><span class="NAME">media.play</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</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">// Bind to the player events to control the play loader.</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">      </span><span class="NAME">media.unbind</span><span class="PUNC">(</span><span class="STRN">'loadstart'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">'loadstart'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">obj</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</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'> 66</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.busy.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</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'> 67</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.bigPlay.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</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'> 68</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">event.data.obj.preview</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">          </span><span class="NAME">event.data.obj.elements.preview.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.checkVisibility</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">      </span><span class="NAME">media.bind</span><span class="PUNC">(</span><span class="STRN">'waiting'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">obj</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</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'> 74</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.busy.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</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'> 75</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.checkVisibility</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">      </span><span class="NAME">media.bind</span><span class="PUNC">(</span><span class="STRN">'loadeddata'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">obj</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</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'> 78</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.busy.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.checkVisibility</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">      </span><span class="NAME">media.bind</span><span class="PUNC">(</span><span class="STRN">'playing'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">obj</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</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'> 82</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.busy.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.bigPlay.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">event.data.obj.preview</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">          </span><span class="NAME">event.data.obj.elements.preview.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.checkVisibility</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">      </span><span class="NAME">media.bind</span><span class="PUNC">(</span><span class="STRN">'pause'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">obj</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</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'> 90</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.bigPlay.setFlag</span><span class="PUNC">(</span><span class="STRN">'media'</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'> 91</span> </span><span class="WHIT">        </span><span class="NAME">event.data.obj.checkVisibility</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 94</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'> 95</span> 
<span class='line'> 96</span> </span><span class="WHIT">      </span><span class="COMM">// Hide the busy cursor.</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.elements.busy</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">        </span><span class="NAME">this.elements.busy.unbind</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>100</span> 
<span class='line'>101</span> </span><span class="WHIT">      </span><span class="COMM">// Hide the big play button.</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.elements.bigPlay</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="NAME">this.elements.bigPlay.unbind</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>105</span> 
<span class='line'>106</span> </span><span class="WHIT">      </span><span class="COMM">// Hide the display.</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">      </span><span class="NAME">this.display.unbind</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>110</span> 
<span class='line'>111</span> </span><span class="WHIT">  </span><span class="COMM">// We are now ready.</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">  </span><span class="NAME">this.ready</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>113</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> 
<span class='line'>115</span> </span><span class="COMM">/**
<span class='line'>116</span>  * Loads the preview image.
<span class='line'>117</span>  */</span><span class="WHIT">
<span class='line'>118</span> </span><span class="NAME">minplayer.playLoader.base.prototype.loadPreview</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'>119</span> 
<span class='line'>120</span> </span><span class="WHIT">  </span><span class="COMM">// If the preview element exists.</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.elements.preview</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>122</span> 
<span class='line'>123</span> </span><span class="WHIT">    </span><span class="COMM">// Get the poster image.</span><span class="WHIT">
<span class='line'>124</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.preview</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">      </span><span class="NAME">this.options.preview</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.elements.media.attr</span><span class="PUNC">(</span><span class="STRN">'poster'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>127</span> 
<span class='line'>128</span> </span><span class="WHIT">    </span><span class="COMM">// Reset the media's poster image.</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">    </span><span class="NAME">this.elements.media.attr</span><span class="PUNC">(</span><span class="STRN">'poster'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>130</span> 
<span class='line'>131</span> </span><span class="WHIT">    </span><span class="COMM">// If there is a preview to show...</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.options.preview</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>133</span> 
<span class='line'>134</span> </span><span class="WHIT">      </span><span class="COMM">// Say that this has a preview.</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">      </span><span class="NAME">this.elements.preview.addClass</span><span class="PUNC">(</span><span class="STRN">'has-preview'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>136</span> 
<span class='line'>137</span> </span><span class="WHIT">      </span><span class="COMM">// Create a new preview image.</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">      </span><span class="NAME">this.preview</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.image</span><span class="PUNC">(</span><span class="NAME">this.elements.preview</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>139</span> 
<span class='line'>140</span> </span><span class="WHIT">      </span><span class="COMM">// Create the image.</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">      </span><span class="NAME">this.preview.load</span><span class="PUNC">(</span><span class="NAME">this.options.preview</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>143</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'>144</span> 
<span class='line'>145</span> </span><span class="WHIT">      </span><span class="COMM">// Hide the preview.</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">      </span><span class="NAME">this.elements.preview.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>149</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>150</span> 
<span class='line'>151</span> </span><span class="COMM">/**
<span class='line'>152</span>  * Hide or show certain elements based on the state of the busy and big play
<span class='line'>153</span>  * button.
<span class='line'>154</span>  */</span><span class="WHIT">
<span class='line'>155</span> </span><span class="NAME">minplayer.playLoader.base.prototype.checkVisibility</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'>156</span> 
<span class='line'>157</span> </span><span class="WHIT">  </span><span class="COMM">// Hide or show the busy cursor based on the flags.</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.busy.flag</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">    </span><span class="NAME">this.elements.busy.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>161</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'>162</span> </span><span class="WHIT">    </span><span class="NAME">this.elements.busy.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>164</span> 
<span class='line'>165</span> </span><span class="WHIT">  </span><span class="COMM">// Hide or show the big play button based on the flags.</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.bigPlay.flag</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">    </span><span class="NAME">this.elements.bigPlay.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> </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">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">    </span><span class="NAME">this.elements.bigPlay.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>172</span> 
<span class='line'>173</span> </span><span class="WHIT">  </span><span class="COMM">// Show the control either flag is set.</span><span class="WHIT">
<span class='line'>174</span> </span><span class="WHIT">  </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.bigPlay.flag</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.busy.flag</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT">    </span><span class="NAME">this.display.show</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="PUNC">}</span><span class="WHIT">
<span class='line'>177</span> 
<span class='line'>178</span> </span><span class="WHIT">  </span><span class="COMM">// Hide the whole control if both flags are 0.</span><span class="WHIT">
<span class='line'>179</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.bigPlay.flag</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">this.busy.flag</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">    </span><span class="NAME">this.display.hide</span><span class="PUNC">(</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="WHIT">
<span class='line'>182</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> </span></pre></body></html>