websockets-streaming-audio
Advanced tools
Comparing version 1.0.33 to 1.0.35
{ | ||
"name": "websockets-streaming-audio", | ||
"version": "1.0.33", | ||
"version": "1.0.35", | ||
"author": "Scott Stensland <scottstensland@gmail.com> (http://catfoodnation.com/)", | ||
@@ -34,2 +34,3 @@ "bugs": { | ||
"start_min": "node src_min/app.js", | ||
"start_loki": "node src/app_loki.js", | ||
"start": "node src/app.js", | ||
@@ -36,0 +37,0 @@ "test": "make" |
@@ -38,3 +38,3 @@ | ||
var callback_send_audio_to_audio_player = null; | ||
var retrieved_audio_buffer_obj = {}; | ||
// var retrieved_audio_buffer_obj = {}; | ||
@@ -224,2 +224,7 @@ var array_stats_for_launch = []; | ||
function output_stored_media() { | ||
send_audio_to_server.output_media(); | ||
} | ||
var manage_audio = (function() { | ||
@@ -248,2 +253,11 @@ | ||
// ------------ below testing only ------------ // | ||
web_audio_obj.set_send_audio_to_server(output_stored_media); | ||
// bbbbbbbbbbb | ||
// ------------ above testing only ------------ // | ||
return { | ||
@@ -273,3 +287,3 @@ | ||
console.log(given_msg_to_ww); | ||
// console.log(given_msg_to_ww); | ||
@@ -384,4 +398,4 @@ ww_handle.postMessage(JSON.stringify(given_msg_to_ww)); | ||
// var array_min_thr_N_size = { browser_queue_max_size : 10, browser_queue_min_threshold : 6 };// good one | ||
var array_min_thr_N_size = { browser_queue_max_size : 16, browser_queue_min_threshold : 6 }; | ||
var array_min_thr_N_size = { browser_queue_max_size : 10, browser_queue_min_threshold : 6 };// good one | ||
// var array_min_thr_N_size = { browser_queue_max_size : 16, browser_queue_min_threshold : 6 }; | ||
// var array_min_thr_N_size = { browser_queue_max_size : 18, browser_queue_min_threshold : 6 };// good | ||
@@ -402,4 +416,4 @@ // var array_min_thr_N_size = { browser_queue_max_size : 24, browser_queue_min_threshold : 6 }; | ||
// stream_audio_msg.ww_queue_max_size = browser_queue_max_size * 2; // integer multiple >= 2 | ||
// stream_audio_msg.ww_queue_max_size = browser_queue_max_size * 4; // integer multiple >= 2 | ||
stream_audio_msg.ww_queue_max_size = browser_queue_max_size * 6; // integer multiple >= 2 # good one | ||
stream_audio_msg.ww_queue_max_size = browser_queue_max_size * 4; // integer multiple >= 2 | ||
// stream_audio_msg.ww_queue_max_size = browser_queue_max_size * 6; // integer multiple >= 2 # good one | ||
// stream_audio_msg.ww_queue_max_size = browser_queue_max_size * 8; // integer multiple >= 2 | ||
@@ -423,3 +437,3 @@ | ||
console.log(ww_directed_mode); | ||
// console.log(ww_directed_mode); | ||
@@ -463,2 +477,65 @@ switch (ww_directed_mode) { | ||
var send_audio_to_server = (function() { | ||
var array_this_media = []; | ||
return { | ||
store_this_buffer : function (retrieved_audio_buffer_obj) { | ||
array_this_media.push(retrieved_audio_buffer_obj); | ||
}, | ||
output_media : function() { | ||
// return; | ||
// return array_this_media; | ||
var saveByteArray = (function () { | ||
var a = document.createElement("a"); | ||
document.body.appendChild(a); | ||
a.style = "display: none"; | ||
return function (data, name) { | ||
var blob = new Blob(data, {type: "octet/stream"}), | ||
url = window.URL.createObjectURL(blob); | ||
a.href = url; | ||
a.download = name; | ||
a.click(); | ||
window.URL.revokeObjectURL(url); | ||
}; | ||
}()); | ||
// return; | ||
console.log("aaaaaaaaaaaaaaaaaa cb_send_audio_to_server"); | ||
console.log("array_retrieved_media_buffers length " + array_this_media.length); | ||
// bbbbbbbbbbbb | ||
for (var curr_element in array_this_media) { | ||
var curr_buffer = array_this_media[curr_element]; | ||
console.log(curr_element + " length " + curr_buffer.buffer.length); | ||
} | ||
// --- | ||
// var sampleBytes = base64ToArrayBuffer('R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs'); | ||
// saveByteArray([sampleBytes], 'black1x1.gif'); | ||
} | ||
}; | ||
}()); | ||
ww_handle.onmessage = function(event) { // handle traffic from ww | ||
@@ -485,2 +562,4 @@ | ||
var retrieved_audio_buffer_obj = {}; | ||
retrieved_audio_buffer_obj.buffer = new Float32Array(data_from_ww); | ||
@@ -490,2 +569,10 @@ | ||
// --------- following testing only --------- // | ||
// now send this array buffer back to server side | ||
send_audio_to_server.store_this_buffer(retrieved_audio_buffer_obj); | ||
// bbbbbbbbbbbbbbb | ||
} else if (typeof event.data === "string") { | ||
@@ -492,0 +579,0 @@ |
@@ -9,2 +9,3 @@ | ||
var cb_request_another_buffer = null; | ||
var cb_send_audio_to_server = null; | ||
@@ -393,2 +394,13 @@ var streaming_status_ready = "streaming_status_ready"; | ||
function set_send_audio_to_server(send_audio_to_server) { | ||
cb_send_audio_to_server = send_audio_to_server; | ||
} | ||
function output_stored_media_as_downloaded_file () { | ||
cb_send_audio_to_server(); | ||
} | ||
function stop_audio() { | ||
@@ -411,2 +423,6 @@ | ||
console.log("OK just set flag_streaming_status = streaming_status_ready"); | ||
// ---------------- testing only ---------------- // | ||
output_stored_media_as_downloaded_file(); | ||
} | ||
@@ -469,2 +485,3 @@ | ||
set_cb_is_streaming_done : set_cb_is_streaming_done, | ||
set_send_audio_to_server : set_send_audio_to_server, | ||
process_audio_buffer : process_audio_buffer, | ||
@@ -471,0 +488,0 @@ manage_media_headers : manage_media_headers |
@@ -210,2 +210,11 @@ | ||
// --- | ||
// for (var index = 0; index < 4; index += 1) { | ||
// console.log(temp_stream_chunk_obj.buffer[index]); | ||
// } | ||
// --- | ||
num_read_send_gulps += 1; | ||
@@ -222,4 +231,9 @@ num_bytes_sent += temp_stream_chunk_obj.buffer.length; | ||
// stens TODO 20150115 | ||
socket_conn.send(temp_stream_chunk_obj.buffer, {binary: true, mask: false}); // binary buffer | ||
// below error happens if we use below parms to send | ||
// WebSocket connection to 'ws://localhost:8888/' failed: A server must not mask any frames that it sends to the client | ||
// socket_conn.send(temp_stream_chunk_obj.buffer, {binary: true, mask: true}); // binary buffer | ||
flag_active = false; | ||
@@ -379,2 +393,8 @@ | ||
// console.log("received_json"); | ||
// console.log(received_json); | ||
var requested_action = received_json.requested_action; | ||
@@ -381,0 +401,0 @@ |
@@ -203,6 +203,6 @@ | ||
// var image = context.createImageData(canvas.width, canvas.height); | ||
for (var i = 0; i < 200; i++) { | ||
// for (var i = 0; i < 200; i++) { | ||
console.log(server_buffer[i]); | ||
} | ||
// console.log(server_buffer[i]); | ||
// } | ||
@@ -235,3 +235,2 @@ // --- | ||
} | ||
}; | ||
@@ -238,0 +237,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35590920
43
4842
11
8