guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjum...@apache.org
Subject [45/51] [abbrv] [partial] incubator-guacamole-website git commit: Deploy first version of the Apache Guacamole website (reworded and restyled from the old guac-dev.org).
Date Thu, 05 May 2016 23:37:20 GMT
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-website/blob/af9b9c05/content/doc/0.8.3/guacamole-common-js/symbols/src/src_main_resources_audio.js.html
----------------------------------------------------------------------
diff --git a/content/doc/0.8.3/guacamole-common-js/symbols/src/src_main_resources_audio.js.html
b/content/doc/0.8.3/guacamole-common-js/symbols/src/src_main_resources_audio.js.html
new file mode 100644
index 0000000..a928aee
--- /dev/null
+++ b/content/doc/0.8.3/guacamole-common-js/symbols/src/src_main_resources_audio.js.html
@@ -0,0 +1,249 @@
+<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="WHIT">
+<span class='line'>  2</span> </span><span class="COMM">/* *****
BEGIN LICENSE BLOCK *****
+<span class='line'>  3</span>  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+<span class='line'>  4</span>  *
+<span class='line'>  5</span>  * The contents of this file are subject to the
Mozilla Public License Version
+<span class='line'>  6</span>  * 1.1 (the "License"); you may not use this file
except in compliance with
+<span class='line'>  7</span>  * the License. You may obtain a copy of the License
at
+<span class='line'>  8</span>  * http://www.mozilla.org/MPL/
+<span class='line'>  9</span>  *
+<span class='line'> 10</span>  * Software distributed under the License is distributed
on an "AS IS" basis,
+<span class='line'> 11</span>  * WITHOUT WARRANTY OF ANY KIND, either express
or implied. See the License
+<span class='line'> 12</span>  * for the specific language governing rights and
limitations under the
+<span class='line'> 13</span>  * License.
+<span class='line'> 14</span>  *
+<span class='line'> 15</span>  * The Original Code is guacamole-common-js.
+<span class='line'> 16</span>  *
+<span class='line'> 17</span>  * The Initial Developer of the Original Code is
+<span class='line'> 18</span>  * Michael Jumper.
+<span class='line'> 19</span>  * Portions created by the Initial Developer are
Copyright (C) 2010
+<span class='line'> 20</span>  * the Initial Developer. All Rights Reserved.
+<span class='line'> 21</span>  *
+<span class='line'> 22</span>  * Contributor(s):
+<span class='line'> 23</span>  *
+<span class='line'> 24</span>  * Alternatively, the contents of this file may
be used under the terms of
+<span class='line'> 25</span>  * either the GNU General Public License Version
2 or later (the "GPL"), or
+<span class='line'> 26</span>  * the GNU Lesser General Public License Version
2.1 or later (the "LGPL"),
+<span class='line'> 27</span>  * in which case the provisions of the GPL or the
LGPL are applicable instead
+<span class='line'> 28</span>  * of those above. If you wish to allow use of
your version of this file only
+<span class='line'> 29</span>  * under the terms of either the GPL or the LGPL,
and not to allow others to
+<span class='line'> 30</span>  * use your version of this file under the terms
of the MPL, indicate your
+<span class='line'> 31</span>  * decision by deleting the provisions above and
replace them with the notice
+<span class='line'> 32</span>  * and other provisions required by the GPL or
the LGPL. If you do not delete
+<span class='line'> 33</span>  * the provisions above, a recipient may use your
version of this file under
+<span class='line'> 34</span>  * the terms of any one of the MPL, the GPL or
the LGPL.
+<span class='line'> 35</span>  *
+<span class='line'> 36</span>  * ***** END LICENSE BLOCK ***** */</span><span
class="WHIT">
+<span class='line'> 37</span> 
+<span class='line'> 38</span> </span><span class="COMM">/**
+<span class='line'> 39</span>  * Namespace for all Guacamole JavaScript objects.
+<span class='line'> 40</span>  * @namespace
+<span class='line'> 41</span>  */</span><span class="WHIT">
+<span class='line'> 42</span> </span><span class="KEYW">var</span><span
class="WHIT"> </span><span class="NAME">Guacamole</span><span class="WHIT">
</span><span class="PUNC">=</span><span class="WHIT"> </span><span
class="NAME">Guacamole</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'> 43</span> 
+<span class='line'> 44</span> </span><span class="COMM">/**
+<span class='line'> 45</span>  * Abstract audio channel which queues and plays
arbitrary audio data.
+<span class='line'> 46</span>  * @constructor
+<span class='line'> 47</span>  */</span><span class="WHIT">
+<span class='line'> 48</span> </span><span class="NAME">Guacamole.AudioChannel</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'> 49</span> 
+<span class='line'> 50</span> </span><span class="WHIT">    </span><span
class="COMM">/**
+<span class='line'> 51</span>      * Reference to this AudioChannel.
+<span class='line'> 52</span>      * @private
+<span class='line'> 53</span>      */</span><span class="WHIT">
+<span class='line'> 54</span> </span><span class="WHIT">    </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">channel</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
</span><span class="KEYW">this</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">/**
+<span class='line'> 57</span>      * When the next packet should play.
+<span class='line'> 58</span>      * @private
+<span class='line'> 59</span>      */</span><span class="WHIT">
+<span class='line'> 60</span> </span><span class="WHIT">    </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">next_packet_time</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'> 61</span> 
+<span class='line'> 62</span> </span><span class="WHIT">    </span><span
class="COMM">/**
+<span class='line'> 63</span>      * Queues up the given data for playing by
this channel once all previously
+<span class='line'> 64</span>      * queued data has been played. If no data
has been queued, the data will
+<span class='line'> 65</span>      * play immediately.
+<span class='line'> 66</span>      * 
+<span class='line'> 67</span>      * @param {String} mimetype The mimetype of
the data provided.
+<span class='line'> 68</span>      * @param {Number} duration The duration of
the data provided, in
+<span class='line'> 69</span>      *                          milliseconds.
+<span class='line'> 70</span>      * @param {String} data The base64-encoded
data to play.
+<span class='line'> 71</span>      */</span><span class="WHIT">
+<span class='line'> 72</span> </span><span class="WHIT">    </span><span
class="NAME">this.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="NAME">mimetype</span><span class="PUNC">,</span><span class="WHIT">
</span><span class="NAME">duration</span><span class="PUNC">,</span><span
class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span
class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 73</span> 
+<span class='line'> 74</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">packet</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
+<span class='line'> 75</span> </span><span class="WHIT">        
   </span><span class="KEYW">new</span><span class="WHIT"> </span><span
class="NAME">Guacamole.AudioChannel.Packet</span><span class="PUNC">(</span><span
class="NAME">mimetype</span><span class="PUNC">,</span><span class="WHIT">
</span><span class="NAME">data</span><span class="PUNC">)</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'> 76</span> 
+<span class='line'> 77</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">now</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
</span><span class="NAME">Guacamole.AudioChannel.getTimestamp</span><span
class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'> 78</span> 
+<span class='line'> 79</span> </span><span class="WHIT">        </span><span
class="COMM">// If underflow is detected, reschedule new packets relative to now.</span><span
class="WHIT">
+<span class='line'> 80</span> </span><span class="WHIT">        </span><span
class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="NAME">next_packet_time</span><span class="WHIT"> </span><span
class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">now</span><span
class="PUNC">)</span><span class="WHIT">
+<span class='line'> 81</span> </span><span class="WHIT">        
   </span><span class="NAME">next_packet_time</span><span class="WHIT">
</span><span class="PUNC">=</span><span class="WHIT"> </span><span
class="NAME">now</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 82</span> 
+<span class='line'> 83</span> </span><span class="WHIT">        </span><span
class="COMM">// Schedule next packet</span><span class="WHIT">
+<span class='line'> 84</span> </span><span class="WHIT">        </span><span
class="NAME">packet.play</span><span class="PUNC">(</span><span class="NAME">next_packet_time</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 85</span> </span><span class="WHIT">        </span><span
class="NAME">next_packet_time</span><span class="WHIT"> </span><span
class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT">
</span><span class="NAME">duration</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'> 86</span> 
+<span class='line'> 87</span> </span><span class="WHIT">    </span><span
class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 88</span> 
+<span class='line'> 89</span> </span><span class="PUNC">}</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'> 90</span> 
+<span class='line'> 91</span> </span><span class="COMM">// Define
context if available</span><span class="WHIT">
+<span class='line'> 92</span> </span><span class="KEYW">if</span><span
class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">window.webkitAudioContext</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="NAME">Guacamole.AudioChannel.context</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">webkitAudioContext</span><span
class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'> 94</span> </span><span class="PUNC">}</span><span
class="WHIT">
+<span class='line'> 95</span> 
+<span class='line'> 96</span> </span><span class="COMM">/**
+<span class='line'> 97</span>  * Returns a base timestamp which can be used for
scheduling future audio
+<span class='line'> 98</span>  * playback. Scheduling playback for the value
returned by this function plus
+<span class='line'> 99</span>  * N will cause the associated audio to be played
back N milliseconds after
+<span class='line'>100</span>  * the function is called.
+<span class='line'>101</span>  *
+<span class='line'>102</span>  * @return {Number} An arbitrary channel-relative
timestamp, in milliseconds.
+<span class='line'>103</span>  */</span><span class="WHIT">
+<span class='line'>104</span> </span><span class="NAME">Guacamole.AudioChannel.getTimestamp</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'>105</span> 
+<span class='line'>106</span> </span><span class="WHIT">    </span><span
class="COMM">// If we have an audio context, use its timestamp</span><span class="WHIT">
+<span class='line'>107</span> </span><span class="WHIT">    </span><span
class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="NAME">Guacamole.AudioChannel.context</span><span class="PUNC">)</span><span
class="WHIT">
+<span class='line'>108</span> </span><span class="WHIT">        </span><span
class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Guacamole.AudioChannel.context.currentTime</span><span
class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT">
</span><span class="NUMB">1000</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>109</span> 
+<span class='line'>110</span> </span><span class="WHIT">    </span><span
class="COMM">// If we have high-resolution timers, use those</span><span class="WHIT">
+<span class='line'>111</span> </span><span class="WHIT">    </span><span
class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="NAME">window.performance</span><span class="PUNC">)</span><span
class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>112</span> 
+<span class='line'>113</span> </span><span class="WHIT">        </span><span
class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="NAME">window.performance.now</span><span class="PUNC">)</span><span
class="WHIT">
+<span class='line'>114</span> </span><span class="WHIT">        
   </span><span class="KEYW">return</span><span class="WHIT"> </span><span
class="NAME">window.performance.now</span><span class="PUNC">(</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>115</span> 
+<span class='line'>116</span> </span><span class="WHIT">        </span><span
class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="NAME">window.performance.webkitNow</span><span class="PUNC">)</span><span
class="WHIT">
+<span class='line'>117</span> </span><span class="WHIT">        
   </span><span class="KEYW">return</span><span class="WHIT"> </span><span
class="NAME">window.performance.webkitNow</span><span class="PUNC">(</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>118</span> </span><span class="WHIT">        
+<span class='line'>119</span>     </span><span class="PUNC">}</span><span
class="WHIT">
+<span class='line'>120</span> 
+<span class='line'>121</span> </span><span class="WHIT">    </span><span
class="COMM">// Fallback to millisecond-resolution system time</span><span class="WHIT">
+<span class='line'>122</span> </span><span class="WHIT">    </span><span
class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span
class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span
class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getTime</span><span
class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>123</span> 
+<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>  * Abstract representation of an audio packet.
+<span class='line'>128</span>  * 
+<span class='line'>129</span>  * @constructor
+<span class='line'>130</span>  * 
+<span class='line'>131</span>  * @param {String} mimetype The mimetype of the
data contained by this packet.
+<span class='line'>132</span>  * @param {String} data The base64-encoded sound
data contained by this packet.
+<span class='line'>133</span>  */</span><span class="WHIT">
+<span class='line'>134</span> </span><span class="NAME">Guacamole.AudioChannel.Packet</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">mimetype</span><span class="PUNC">,</span><span class="WHIT">
</span><span class="NAME">data</span><span class="PUNC">)</span><span
class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>135</span> 
+<span class='line'>136</span> </span><span class="WHIT">    </span><span
class="COMM">/**
+<span class='line'>137</span>      * Schedules this packet for playback at the
given time.
+<span class='line'>138</span>      *
+<span class='line'>139</span>      * @function
+<span class='line'>140</span>      * @param {Number} when The time this packet
should be played, in
+<span class='line'>141</span>      *                      milliseconds.
+<span class='line'>142</span>      */</span><span class="WHIT">
+<span class='line'>143</span> </span><span class="WHIT">    </span><span
class="NAME">this.play</span><span class="WHIT"> </span><span class="PUNC">=</span><span
class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span
class="WHIT"> </span><span class="COMM">// Defined conditionally depending
on support</span><span class="WHIT">
+<span class='line'>144</span> 
+<span class='line'>145</span> </span><span class="WHIT">    </span><span
class="COMM">// If audio API available, use it.</span><span class="WHIT">
+<span class='line'>146</span> </span><span class="WHIT">    </span><span
class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="NAME">Guacamole.AudioChannel.context</span><span class="PUNC">)</span><span
class="WHIT"> </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="KEYW">var</span><span class="WHIT"> </span><span class="NAME">readyBuffer</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'>149</span> 
+<span class='line'>150</span> </span><span class="WHIT">        </span><span
class="COMM">// By default, when decoding finishes, store buffer for future</span><span
class="WHIT">
+<span class='line'>151</span> </span><span class="WHIT">        </span><span
class="COMM">// playback</span><span class="WHIT">
+<span class='line'>152</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">handleReady</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">buffer</span><span class="PUNC">)</span><span class="WHIT">
</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>153</span> </span><span class="WHIT">        
   </span><span class="NAME">readyBuffer</span><span class="WHIT">
</span><span class="PUNC">=</span><span class="WHIT"> </span><span
class="NAME">buffer</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>154</span> </span><span class="WHIT">        </span><span
class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>155</span> 
+<span class='line'>156</span> </span><span class="WHIT">        </span><span
class="COMM">// Convert to ArrayBuffer</span><span class="WHIT">
+<span class='line'>157</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">binary</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
</span><span class="NAME">window.atob</span><span class="PUNC">(</span><span
class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>158</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">arrayBuffer</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">ArrayBuffer</span><span class="PUNC">(</span><span class="NAME">binary.length</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>159</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">bufferView</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">Uint8Array</span><span class="PUNC">(</span><span class="NAME">arrayBuffer</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>160</span> 
+<span class='line'>161</span> </span><span class="WHIT">        </span><span
class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span
class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span
class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span
class="NAME">binary.length</span><span class="PUNC">;</span><span
class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span
class="PUNC">)</span><span class="WHIT">
+<span class='line'>162</span> </span><span class="WHIT">        
   </span><span class="NAME">bufferView</span><span class="PUNC">[</span><span
class="NAME">i</span><span class="PUNC">]</span><span class="WHIT">
</span><span class="PUNC">=</span><span class="WHIT"> </span><span
class="NAME">binary.charCodeAt</span><span class="PUNC">(</span><span
class="NAME">i</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">// Get context and start decoding</span><span class="WHIT">
+<span class='line'>165</span> </span><span class="WHIT">        </span><span
class="NAME">Guacamole.AudioChannel.context.decodeAudioData</span><span class="PUNC">(</span><span
class="WHIT">
+<span class='line'>166</span> </span><span class="WHIT">        
   </span><span class="NAME">arrayBuffer</span><span class="PUNC">,</span><span
class="WHIT">
+<span class='line'>167</span> </span><span class="WHIT">        
   </span><span class="KEYW">function</span><span class="PUNC">(</span><span
class="NAME">buffer</span><span class="PUNC">)</span><span class="WHIT">
</span><span class="PUNC">{</span><span class="WHIT"> </span><span
class="NAME">handleReady</span><span class="PUNC">(</span><span class="NAME">buffer</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
</span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>168</span> </span><span class="WHIT">        </span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>169</span> 
+<span class='line'>170</span> </span><span class="WHIT">        </span><span
class="COMM">// Set up buffer source</span><span class="WHIT">
+<span class='line'>171</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">source</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
</span><span class="NAME">Guacamole.AudioChannel.context.createBufferSource</span><span
class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>172</span> </span><span class="WHIT">        </span><span
class="NAME">source.connect</span><span class="PUNC">(</span><span
class="NAME">Guacamole.AudioChannel.context.destination</span><span class="PUNC">)</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>173</span> 
+<span class='line'>174</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">play_when</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>175</span> 
+<span class='line'>176</span> </span><span class="WHIT">        </span><span
class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">playDelayed</span><span
class="PUNC">(</span><span class="NAME">buffer</span><span class="PUNC">)</span><span
class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>177</span> </span><span class="WHIT">        
   </span><span class="NAME">source.buffer</span><span class="WHIT">
</span><span class="PUNC">=</span><span class="WHIT"> </span><span
class="NAME">buffer</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>178</span> </span><span class="WHIT">        
   </span><span class="NAME">source.noteOn</span><span class="PUNC">(</span><span
class="NAME">play_when</span><span class="WHIT"> </span><span class="PUNC">/</span><span
class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">)</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>179</span> </span><span class="WHIT">        </span><span
class="PUNC">}</span><span class="WHIT">
+<span class='line'>180</span> 
+<span class='line'>181</span> </span><span class="WHIT">        </span><span
class="COMM">/** @ignore */</span><span class="WHIT">
+<span class='line'>182</span> </span><span class="WHIT">        </span><span
class="NAME">this.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="NAME">when</span><span class="PUNC">)</span><span class="WHIT">
</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>183</span> </span><span class="WHIT">        
   
+<span class='line'>184</span>             </span><span class="NAME">play_when</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
</span><span class="NAME">when</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>185</span> </span><span class="WHIT">        
   
+<span class='line'>186</span>             </span><span class="COMM">//
If buffer available, play it NOW</span><span class="WHIT">
+<span class='line'>187</span> </span><span class="WHIT">        
   </span><span class="KEYW">if</span><span class="WHIT"> </span><span
class="PUNC">(</span><span class="NAME">readyBuffer</span><span class="PUNC">)</span><span
class="WHIT">
+<span class='line'>188</span> </span><span class="WHIT">        
       </span><span class="NAME">playDelayed</span><span class="PUNC">(</span><span
class="NAME">readyBuffer</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">// Otherwise, play when decoded</span><span
class="WHIT">
+<span class='line'>191</span> </span><span class="WHIT">        
   </span><span class="KEYW">else</span><span class="WHIT">
+<span class='line'>192</span> </span><span class="WHIT">        
       </span><span class="NAME">handleReady</span><span class="WHIT">
</span><span class="PUNC">=</span><span class="WHIT"> </span><span
class="NAME">playDelayed</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>193</span> 
+<span class='line'>194</span> </span><span class="WHIT">        </span><span
class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>195</span> 
+<span class='line'>196</span> </span><span class="WHIT">    </span><span
class="PUNC">}</span><span class="WHIT">
+<span class='line'>197</span> 
+<span class='line'>198</span> </span><span class="WHIT">    </span><span
class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span
class="WHIT">
+<span class='line'>199</span> 
+<span class='line'>200</span> </span><span class="WHIT">        </span><span
class="COMM">// Build data URI</span><span class="WHIT">
+<span class='line'>201</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data_uri</span><span
class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
</span><span class="STRN">"data:"</span><span class="WHIT"> </span><span
class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">mimetype</span><span
class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
</span><span class="STRN">";base64,"</span><span class="WHIT"> </span><span
class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">data</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>202</span> </span><span class="WHIT">       
+<span class='line'>203</span>         </span><span class="COMM">//
Create audio element to house and play the data</span><span class="WHIT">
+<span class='line'>204</span> </span><span class="WHIT">        </span><span
class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">audio</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">Audio</span><span class="PUNC">(</span><span class="PUNC">)</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>205</span> </span><span class="WHIT">        </span><span
class="NAME">audio.src</span><span class="WHIT"> </span><span class="PUNC">=</span><span
class="WHIT"> </span><span class="NAME">data_uri</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>206</span> </span><span class="WHIT">      
+<span class='line'>207</span>         </span><span class="COMM">/**
@ignore */</span><span class="WHIT">
+<span class='line'>208</span> </span><span class="WHIT">        </span><span
class="NAME">this.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="NAME">when</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 class='line'>210</span>             </span><span class="COMM">//
Calculate time until play</span><span class="WHIT">
+<span class='line'>211</span> </span><span class="WHIT">        
   </span><span class="KEYW">var</span><span class="WHIT"> </span><span
class="NAME">now</span><span class="WHIT"> </span><span class="PUNC">=</span><span
class="WHIT"> </span><span class="NAME">Guacamole.AudioChannel.getTimestamp</span><span
class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span
class="WHIT">
+<span class='line'>212</span> </span><span class="WHIT">        
   </span><span class="KEYW">var</span><span class="WHIT"> </span><span
class="NAME">delay</span><span class="WHIT"> </span><span class="PUNC">=</span><span
class="WHIT"> </span><span class="NAME">when</span><span class="WHIT">
</span><span class="PUNC">-</span><span class="WHIT"> </span><span
class="NAME">now</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>213</span> </span><span class="WHIT">        
   
+<span class='line'>214</span>             </span><span class="COMM">//
Play now if too late</span><span class="WHIT">
+<span class='line'>215</span> </span><span class="WHIT">        
   </span><span class="KEYW">if</span><span class="WHIT"> </span><span
class="PUNC">(</span><span class="NAME">delay</span><span class="WHIT">
</span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span
class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
+<span class='line'>216</span> </span><span class="WHIT">        
       </span><span class="NAME">audio.play</span><span class="PUNC">(</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>217</span> 
+<span class='line'>218</span> </span><span class="WHIT">        
   </span><span class="COMM">// Otherwise, schedule later playback</span><span
class="WHIT">
+<span class='line'>219</span> </span><span class="WHIT">        
   </span><span class="KEYW">else</span><span class="WHIT">
+<span class='line'>220</span> </span><span class="WHIT">        
       </span><span class="NAME">window.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'>221</span> </span><span class="WHIT">        
           </span><span class="NAME">audio.play</span><span class="PUNC">(</span><span
class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>222</span> </span><span class="WHIT">        
       </span><span class="PUNC">}</span><span class="PUNC">,</span><span
class="WHIT"> </span><span class="NAME">delay</span><span class="PUNC">)</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>223</span> 
+<span class='line'>224</span> </span><span class="WHIT">        </span><span
class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>225</span> 
+<span class='line'>226</span> </span><span class="WHIT">    </span><span
class="PUNC">}</span><span class="WHIT">
+<span class='line'>227</span> 
+<span class='line'>228</span> </span><span class="PUNC">}</span><span
class="PUNC">;</span><span class="WHIT">
+<span class='line'>229</span> </span></pre>
+<!-- Google Analytics -->
+<script type="text/javascript">
+  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+  ga('create', 'UA-75289145-1', 'auto');
+  ga('send', 'pageview');
+
+</script>
+<!-- End Google Analytics -->
+</body></html>
\ No newline at end of file


Mime
View raw message