Audio out Error

53 views
Skip to first unread message

Andres Miyara

unread,
Jan 15, 2017, 11:09:34 AM1/15/17
to Node-RED
Hi, i've downloaded the latest dashboard, and it comes with a node called "audio out" if you pass to it an string, an digital voice "reads it", if you pass it the buffer of a mp3 file, it reproduce. The issue comes when i try to reproduce the mp3 file multiple times (if i send an string multiple times the problem doesnt exist), the message that the browser send is:

Error playing audio: NotSupportedError: Failed to construct 'AudioContext': The number of hardware contexts provided (6) is grater than or equal to the maximun bound (6).

i think that the browser can only reproduce 6 times any file (i dont know why), does it have a solution?

Andrés.

Mark Setrem

unread,
Jan 15, 2017, 12:17:59 PM1/15/17
to Node-RED
It would be useful if you included which browser and which operating system you are using.

But have you hit the maximum number of simultaneous downloads? Which is usually set at 6 in Chrome.

Zenofmud

unread,
Jan 15, 2017, 12:25:11 PM1/15/17
to node...@googlegroups.com
The issue comes when i try to reproduce the mp3 file multiple times
Are you adding multiple ‘Audio Out’ nodes to your flow or are you sending multiple mp3 via the one ‘Audio Out’ node?
Including your flow might help

Andres Miyara

unread,
Jan 15, 2017, 12:41:33 PM1/15/17
to Node-RED
thanks for the fast answers. I'm using chrome, and win7 (64bits if that data is necesary).This flow allows me to have an sound notification of the chat page when a new message arrives. The flow that i'm using its the following:


[{"id":"8837ae5a.192c","type":"ui_audio","z":"ef0ea01e.b1269","name":"","group":"69009ed0.526c78","voice":"5","x":700,"y":400,"wires":[]},{"id":"9750be0c.c9e53","type":"file in","z":"ef0ea01e.b1269","name":"","filename":"Path to mp3 file","format":"","x":520,"y":400,"wires":[["8837ae5a.192c"]]},{"id":"c6f52c71.2e697","type":"ui_toast","z":"ef0ea01e.b1269","position":"top right","displayTime":"5","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":530,"y":440,"wires":[]},{"id":"dfd28566.6f1838","type":"delay","z":"ef0ea01e.b1269","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":320,"y":420,"wires":[["c6f52c71.2e697","9750be0c.c9e53"]]},{"id":"959a22fe.1410e","type":"inject","z":"ef0ea01e.b1269","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":420,"wires":[["dfd28566.6f1838"]]},{"id":"736b3a7a.f9a464","type":"websocket in","z":"ef0ea01e.b1269","name":"","server":"afb63a67.34cac8","x":90,"y":360,"wires":[["3310f2eb.1d1e6e","dfd28566.6f1838"]]},{"id":"3310f2eb.1d1e6e","type":"function","z":"ef0ea01e.b1269","name":"","func":"delete msg._session;\nreturn msg;\n\n","outputs":1,"x":264,"y":360,"wires":[["16beb21e.9a85de"]]},{"id":"16beb21e.9a85de","type":"websocket out","z":"ef0ea01e.b1269","name":"","server":"afb63a67.34cac8","x":445,"y":360,"wires":[]},{"id":"d8f963c1.c5303","type":"http in","z":"ef0ea01e.b1269","name":"","url":"/chat","method":"get","x":80,"y":500,"wires":[["a155d1b8.89b69"]]},{"id":"a155d1b8.89b69","type":"template","z":"ef0ea01e.b1269","name":"","field":"","template":"<head>\n  <meta name=\"viewport\" content=\"width=320, initial-scale=1\">\n  <title>Chat</title>\n</head>\n\n<body>\n  <div id=\"wrapper\">\n    <div id=\"chat_box\" class=\"content\"></div>\n\n    <div id=\"footer\">\n      <div class=\"content\">\n        <input type=\"text\" id=\"user\" placeholder=\"Who are you?\" />\n        <input type=\"text\" id=\"message\" placeholder=\"What do you want to say?\" />\n        <input type=\"button\" id=\"send_btn\" value=\"Send\" onclick=\"sendMessage()\">\n      </div>\n    </div>\n  </div>\n</body>\n\n<script type=\"text/javascript\">\n  var wsUri = \"ws://{{req.headers.host}}/ws/chat\";\n  var ws = new WebSocket(wsUri);\n\n  function createSystemMessage(message) {\n    var message = document.createTextNode(message);\n\n    var messageBox = document.createElement('p');\n    messageBox.className = 'system';\n\n    messageBox.appendChild(message);\n\n    var chat = document.getElementById('chat_box');\n    chat.appendChild(messageBox);\n  }\n\n  function createUserMessage(user, message) {\n    var user = document.createTextNode(user + ': ');\n\n    var userBox = document.createElement('span');\n    userBox.className = 'username';\n    userBox.appendChild(user);\n\n    var message = document.createTextNode(message);\n\n    var messageBox = document.createElement('p');\n    messageBox.appendChild(userBox);\n    messageBox.appendChild(message);\n\n    var chat = document.getElementById('chat_box');\n    chat.appendChild(messageBox);\n  }\n\n  ws.onopen = function(ev) {\n    createSystemMessage('[Connected]');\n  };\n\n  ws.onclose = function(ev) {\n    createSystemMessage('[Disconnected]');\n  }\n\n  ws.onmessage = function(ev) {\n    var payload = JSON.parse(ev.data);\n    createUserMessage(payload.user, payload.message);\n\n    var chat = document.getElementById('chat_box');\n    chat.scrollTop = chat.scrollHeight;\n  }\n\n  function sendMessage() {\n    var user = document.getElementById('user');\n    var message = document.getElementById('message');\n\n    var payload = {\n      message: message.value,\n      user: user.value,\n      ts: (new Date()).getTime()\n    };\n\n    ws.send(JSON.stringify(payload));\n    message.value = \"\";\n  };\n</script>\n\n<style type=\"text/css\">\n  * {\n    font-family: \"Palatino Linotype\", \"Book Antiqua\", Palatino, serif;\n    font-style: italic;\n    font-size: 24px;\n  }\n\n  html, body, #wrapper {\n    margin: 0;\n    padding: 0;\n    height: 100%;\n  }\n\n  #wrapper {\n    background-color: #ecf0f1;\n  }\n\n  #chat_box {\n    box-sizing: border-box;\n    height: 100%;\n    overflow: auto;\n    padding-bottom: 50px;\n  }\n\n  #footer {\n    box-sizing: border-box;\n    position: fixed;\n    bottom: 0;\n    height: 50px;\n    width: 100%;\n    background-color: #2980b9;\n  }\n\n  #footer .content {\n    padding-top: 4px;\n    position: relative;\n  }\n\n  #user { width: 20%; }\n  #message { width: 68%; }\n  #send_btn {\n    width: 10%;\n    position: absolute;\n    right: 0;\n    bottom: 0;\n    margin: 0;\n  }\n\n  .content {\n    width: 70%;\n    margin: 0 auto;\n  }\n\n  input[type=\"text\"],\n  input[type=\"button\"] {\n    border: 0;\n    color: #fff;\n  }\n\n  input[type=\"text\"] {\n    background-color: #146EA8;\n    padding: 3px 10px;\n  }\n\n  input[type=\"button\"] {\n    background-color: #f39c12;\n    border-right: 2px solid #e67e22;\n    border-bottom: 2px solid #e67e22;\n    min-width: 70px;\n    display: inline-block;\n  }\n\n  input[type=\"button\"]:hover {\n    background-color: #e67e22;\n    border-right: 2px solid #f39c12;\n    border-bottom: 2px solid #f39c12;\n    cursor: pointer;\n  }\n\n  .system,\n  .username {\n    color: #aaa;\n    font-style: italic;\n    font-family: monospace;\n    font-size: 16px;\n  }\n\n  @media(max-width: 1000px) {\n    .content { width: 90%; }\n  }\n\n  @media(max-width: 780px) {\n    #footer { height: 91px; }\n    #chat_box { padding-bottom: 91px; }\n\n    #user { width: 100%; }\n    #message { width: 80%; }\n  }\n\n  @media(max-width: 400px) {\n    #footer { height: 135px; }\n    #chat_box { padding-bottom: 135px; }\n\n    #message { width: 100%; }\n    #send_btn {\n      position: relative;\n      margin-top: 3px;\n      width: 100%;\n    }\n  }\n</style>\n","x":246,"y":500,"wires":[["6f5f113f.a7bb6"]]},{"id":"6f5f113f.a7bb6","type":"http response","z":"ef0ea01e.b1269","name":"","x":389,"y":500,"wires":[]},{"id":"346cd8b4.523688","type":"ui_text","z":"ef0ea01e.b1269","group":"69009ed0.526c78","order":0,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":430,"y":560,"wires":[]},{"id":"9b6a3c9a.6c126","type":"ui_text_input","z":"ef0ea01e.b1269","name":"","label":"","group":"69009ed0.526c78","order":0,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"","x":280,"y":560,"wires":[["346cd8b4.523688"]]},{"id":"4a772af.0f4ddd4","type":"inject","z":"ef0ea01e.b1269","name":"","topic":"","payload":"","payloadType":"str","repeat":"0.5","crontab":"","once":false,"x":90,"y":560,"wires":[["9b6a3c9a.6c126"]]},{"id":"69009ed0.526c78","type":"ui_group","z":"","name":"Default","tab":"d16315cd.213268","disp":true,"width":"6"},{"id":"afb63a67.34cac8","type":"websocket-listener","path":"/ws/chat","wholemsg":"false"},{"id":"d16315cd.213268","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

Mark Setrem

unread,
Jan 15, 2017, 12:43:03 PM1/15/17
to Node-RED

Andres Miyara

unread,
Jan 15, 2017, 1:15:39 PM1/15/17
to Node-RED
Sorry, but i'm not very good at web services, there is a way to fixit?

Dave C-J

unread,
Jan 15, 2017, 1:30:30 PM1/15/17
to node...@googlegroups.com
maybe... there were some hints in the link Mark posted - in particular a link to - https://www.techwalla.com/articles/how-to-change-the-number-of-simultaneous-downloads-in-chrome

Reply all
Reply to author
Forward
0 new messages