Skip to content

Commit 2ddf1b6

Browse files
separate libfec.js from quiet-js
1 parent d21bc51 commit 2ddf1b6

9 files changed

+200
-22
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libfec.js

docs/Quiet.html

+133-7
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ <h5>Parameters:</h5>
228228

229229
<dt class="tag-source">Source:</dt>
230230
<dd class="tag-source"><ul class="dummy"><li>
231-
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line138">line 138</a>
231+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line155">line 155</a>
232232
</li></ul></dd>
233233

234234

@@ -424,7 +424,7 @@ <h5>Parameters:</h5>
424424

425425
<dt class="tag-source">Source:</dt>
426426
<dd class="tag-source"><ul class="dummy"><li>
427-
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line318">line 318</a>
427+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line348">line 348</a>
428428
</li></ul></dd>
429429

430430

@@ -456,6 +456,132 @@ <h5>Example</h5>
456456

457457

458458

459+
<dt>
460+
<h4 class="name" id="setLibfecPrefix"><span class="type-signature">&lt;static> </span>setLibfecPrefix<span class="signature">(prefix)</span><span class="type-signature"></span></h4>
461+
462+
463+
</dt>
464+
<dd>
465+
466+
467+
<div class="description">
468+
Set the path prefix of libfec.js.
469+
Although not strictly required, it is highly recommended to include this library.
470+
<br><br>
471+
This function, if used, must be called before quiet-emscripten.js has started loading.
472+
If it is not called first, then emscripten will not load libfec.js.
473+
</div>
474+
475+
476+
477+
478+
479+
480+
481+
<h5>Parameters:</h5>
482+
483+
484+
<table class="params">
485+
<thead>
486+
<tr>
487+
488+
<th>Name</th>
489+
490+
491+
<th>Type</th>
492+
493+
494+
495+
496+
497+
<th class="last">Description</th>
498+
</tr>
499+
</thead>
500+
501+
<tbody>
502+
503+
504+
<tr>
505+
506+
<td class="name"><code>prefix</code></td>
507+
508+
509+
<td class="type">
510+
511+
512+
<span class="param-type">string</span>
513+
514+
515+
516+
</td>
517+
518+
519+
520+
521+
522+
<td class="description last">The path prefix where emscripten will fetch libfec.js</td>
523+
</tr>
524+
525+
526+
</tbody>
527+
</table>
528+
529+
530+
531+
<dl class="details">
532+
533+
534+
535+
536+
537+
538+
539+
540+
541+
542+
543+
544+
545+
546+
547+
548+
549+
550+
551+
<dt class="tag-source">Source:</dt>
552+
<dd class="tag-source"><ul class="dummy"><li>
553+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line138">line 138</a>
554+
</li></ul></dd>
555+
556+
557+
558+
559+
560+
561+
562+
</dl>
563+
564+
565+
566+
567+
568+
569+
570+
571+
572+
573+
574+
575+
576+
<h5>Example</h5>
577+
578+
<pre class="prettyprint"><code>setLibfecPrefix("/"); // fetches /libfec.js</code></pre>
579+
580+
581+
</dd>
582+
583+
584+
459585
<dt>
460586
<h4 class="name" id="setMemoryInitializerPrefix"><span class="type-signature">&lt;static> </span>setMemoryInitializerPrefix<span class="signature">(prefix)</span><span class="type-signature"></span></h4>
461587

@@ -797,7 +923,7 @@ <h5>Parameters:</h5>
797923

798924
<dt class="tag-source">Source:</dt>
799925
<dd class="tag-source"><ul class="dummy"><li>
800-
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line166">line 166</a>
926+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line183">line 183</a>
801927
</li></ul></dd>
802928

803929

@@ -948,7 +1074,7 @@ <h5>Parameters:</h5>
9481074

9491075
<dt class="tag-source">Source:</dt>
9501076
<dd class="tag-source"><ul class="dummy"><li>
951-
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line316">line 316</a>
1077+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line346">line 346</a>
9521078
</li></ul></dd>
9531079

9541080

@@ -1017,7 +1143,7 @@ <h4 class="name" id="onTransmitFinish"><span class="type-signature"></span>onTra
10171143

10181144
<dt class="tag-source">Source:</dt>
10191145
<dd class="tag-source"><ul class="dummy"><li>
1020-
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line162">line 162</a>
1146+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line179">line 179</a>
10211147
</li></ul></dd>
10221148

10231149

@@ -1179,7 +1305,7 @@ <h5>Parameters:</h5>
11791305

11801306
<dt class="tag-source">Source:</dt>
11811307
<dd class="tag-source"><ul class="dummy"><li>
1182-
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line164">line 164</a>
1308+
<a href="quiet.js.html">quiet.js</a>, <a href="quiet.js.html#line181">line 181</a>
11831309
</li></ul></dd>
11841310

11851311

@@ -1229,7 +1355,7 @@ <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="Quiet
12291355
<br clear="both">
12301356

12311357
<footer>
1232-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Feb 22 2016 15:03:17 GMT-0800 (PST)
1358+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Tue Feb 23 2016 15:04:57 GMT-0800 (PST)
12331359
</footer>
12341360

12351361
<script> prettyPrint(); </script>

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="Quiet
6969
<br clear="both">
7070

7171
<footer>
72-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Feb 22 2016 15:03:17 GMT-0800 (PST)
72+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Tue Feb 23 2016 15:04:57 GMT-0800 (PST)
7373
</footer>
7474

7575
<script> prettyPrint(); </script>

docs/quiet.js.html

+36-5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,23 @@ <h1 class="page-title">Source: quiet.js</h1>
162162
Module.memoryInitializerPrefixURL = prefix;
163163
}
164164

165+
/**
166+
* Set the path prefix of libfec.js.
167+
* Although not strictly required, it is highly recommended to include this library.
168+
* &lt;br>&lt;br>
169+
* This function, if used, must be called before quiet-emscripten.js has started loading.
170+
* If it is not called first, then emscripten will not load libfec.js.
171+
* @function setLibfecPrefix
172+
* @memberof Quiet
173+
* @param {string} prefix - The path prefix where emscripten will fetch libfec.js
174+
* @example
175+
* setLibfecPrefix("/"); // fetches /libfec.js
176+
*/
177+
function setLibfecPrefix(prefix) {
178+
Module.dynamicLibraries = Module.dynamicLibraries || [];
179+
Module.dynamicLibraries.push(prefix + "libfec.js");
180+
}
181+
165182
/**
166183
* Add a callback to be called when Quiet is ready for use, e.g. when transmitters and receivers can be created.
167184
* @function addReadyCallback
@@ -312,9 +329,9 @@ <h1 class="page-title">Source: quiet.js</h1>
312329
audioInputReadyCallbacks.push(c);
313330
}
314331

315-
function createAudioInput() {
316-
audioInput = 0; // prevent others from trying to create
317-
gUM.call(navigator, {
332+
function gUMConstraints() {
333+
if (navigator.webkitGetUserMedia !== undefined) {
334+
return {
318335
audio: {
319336
optional: [
320337
{googAutoGainControl: false},
@@ -328,7 +345,20 @@ <h1 class="page-title">Source: quiet.js</h1>
328345
{googAudioMirroring: false}
329346
]
330347
}
331-
}, function(e) {
348+
};
349+
}
350+
return {
351+
audio: {
352+
echoCancellation: false
353+
}
354+
};
355+
};
356+
357+
358+
function createAudioInput() {
359+
audioInput = 0; // prevent others from trying to create
360+
gUM.call(navigator, gUMConstraints(),
361+
function(e) {
332362
audioInput = audioCtx.createMediaStreamSource(e);
333363

334364
// stash a very permanent reference so this isn't collected
@@ -440,6 +470,7 @@ <h1 class="page-title">Source: quiet.js</h1>
440470
emscriptenInitialized: onEmscriptenInitialized,
441471
setProfilesPrefix: setProfilesPrefix,
442472
setMemoryInitializerPrefix: setMemoryInitializerPrefix,
473+
setLibfecPrefix: setLibfecPrefix,
443474
addReadyCallback: addReadyCallback,
444475
transmitter: transmitter,
445476
receiver: receiver
@@ -467,7 +498,7 @@ <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="Quiet
467498
<br clear="both">
468499

469500
<footer>
470-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Feb 22 2016 15:03:17 GMT-0800 (PST)
501+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Tue Feb 23 2016 15:04:57 GMT-0800 (PST)
471502
</footer>
472503

473504
<script> prettyPrint(); </script>

examples/text/receivetext.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var TextReceiver = (function() {
22
Quiet.setProfilesPrefix("/");
33
Quiet.setMemoryInitializerPrefix("/");
4+
Quiet.setLibfecPrefix("/");
45
var target;
56
var content = "";
67

examples/text/sendtext.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var TextTransmitter = (function() {
22
Quiet.setProfilesPrefix("/");
33
Quiet.setMemoryInitializerPrefix("/");
4+
Quiet.setLibfecPrefix("/");
45
var btn;
56
var textbox;
67
var transmit;

quiet-emscripten.js

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quiet-emscripten.js.mem

-195 KB
Binary file not shown.

quiet.js

+18
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,23 @@ var Quiet = (function() {
135135
Module.memoryInitializerPrefixURL = prefix;
136136
}
137137

138+
/**
139+
* Set the path prefix of libfec.js.
140+
* Although not strictly required, it is highly recommended to include this library.
141+
* <br><br>
142+
* This function, if used, must be called before quiet-emscripten.js has started loading.
143+
* If it is not called first, then emscripten will not load libfec.js.
144+
* @function setLibfecPrefix
145+
* @memberof Quiet
146+
* @param {string} prefix - The path prefix where emscripten will fetch libfec.js
147+
* @example
148+
* setLibfecPrefix("/"); // fetches /libfec.js
149+
*/
150+
function setLibfecPrefix(prefix) {
151+
Module.dynamicLibraries = Module.dynamicLibraries || [];
152+
Module.dynamicLibraries.push(prefix + "libfec.js");
153+
}
154+
138155
/**
139156
* Add a callback to be called when Quiet is ready for use, e.g. when transmitters and receivers can be created.
140157
* @function addReadyCallback
@@ -426,6 +443,7 @@ var Quiet = (function() {
426443
emscriptenInitialized: onEmscriptenInitialized,
427444
setProfilesPrefix: setProfilesPrefix,
428445
setMemoryInitializerPrefix: setMemoryInitializerPrefix,
446+
setLibfecPrefix: setLibfecPrefix,
429447
addReadyCallback: addReadyCallback,
430448
transmitter: transmitter,
431449
receiver: receiver

0 commit comments

Comments
 (0)