admin管理员组文章数量:1025536
I am developing a radio system with a microphone, the system admin will speak into the microphone and the audio will be transmitted in real time to the User ... I'm newbie using node.js and I'm unsure of how to make the stream the audio from the microphone to the User ... can anyone help me?
I have the following problem, I have the audio from the microphone being recorded in a blob and I need to know how to stream live this blob ...
I do not have code to show only gives audio recording ...
<script>
function getByID(id) {
return document.getElementById(id);
}
var recordAudio = getByID('record-audio'),
stopRecordingAudio = getByID('stop-recording-audio');
var audio = getByID('audio');
var audioConstraints = {
audio: true,
video: false
};
</script>
<script>
var audioStream;
var recorder;
recordAudio.onclick = function() {
if (!audioStream)
navigator.getUserMedia(audioConstraints, function(stream) {
if (window.IsChrome) stream = new window.MediaStream(stream.getAudioTracks());
audioStream = stream;
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
// "audio" is a default type
recorder = window.RecordRTC(stream, {
type: 'audio'
});
recorder.startRecording();
}, function() {
});
else {
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
if (recorder) recorder.startRecording();
}
window.isAudio = true;
this.disabled = true;
stopRecordingAudio.disabled = false;
};
stopRecordingAudio.onclick = function() {
this.disabled = true;
recordAudio.disabled = false;
audio.src = '';
if (recorder)
recorder.stopRecording(function(url) {
audio.src = url;
audio.muted = false;
audio.play();
document.getElementById('audio-url-preview').innerHTML = '<a href="' + url + '" target="_blank">Recorded Audio URL</a>';
});
};
</script>
I am developing a radio system with a microphone, the system admin will speak into the microphone and the audio will be transmitted in real time to the User ... I'm newbie using node.js and I'm unsure of how to make the stream the audio from the microphone to the User ... can anyone help me?
I have the following problem, I have the audio from the microphone being recorded in a blob and I need to know how to stream live this blob ...
I do not have code to show only gives audio recording ...
<script>
function getByID(id) {
return document.getElementById(id);
}
var recordAudio = getByID('record-audio'),
stopRecordingAudio = getByID('stop-recording-audio');
var audio = getByID('audio');
var audioConstraints = {
audio: true,
video: false
};
</script>
<script>
var audioStream;
var recorder;
recordAudio.onclick = function() {
if (!audioStream)
navigator.getUserMedia(audioConstraints, function(stream) {
if (window.IsChrome) stream = new window.MediaStream(stream.getAudioTracks());
audioStream = stream;
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
// "audio" is a default type
recorder = window.RecordRTC(stream, {
type: 'audio'
});
recorder.startRecording();
}, function() {
});
else {
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
if (recorder) recorder.startRecording();
}
window.isAudio = true;
this.disabled = true;
stopRecordingAudio.disabled = false;
};
stopRecordingAudio.onclick = function() {
this.disabled = true;
recordAudio.disabled = false;
audio.src = '';
if (recorder)
recorder.stopRecording(function(url) {
audio.src = url;
audio.muted = false;
audio.play();
document.getElementById('audio-url-preview').innerHTML = '<a href="' + url + '" target="_blank">Recorded Audio URL</a>';
});
};
</script>
Share
Improve this question
asked Jun 6, 2014 at 18:58
Alan PSAlan PS
1972 silver badges12 bronze badges
1
- 1 but WebRTC is not easy, I did not figured out how to – Alan PS Commented Jun 6, 2014 at 19:03
1 Answer
Reset to default 2I am no expert but I recalled that there are few articles about capturing audio on the html5rocks.
http://updates.html5rocks./2012/01/Web-Audio-FAQ http://www.html5rocks./en/tutorials/getusermedia/intro/#toc-webaudio-api
You should try to search in the npm library. I think it might have some streaming node modules. (Starting develop from a core node.js API is really hard, i couldn't figured it out too.)
Also take a look at this:
Node.js synchronized audio streaming between server and clients?
and here is node modules for sending binary data (i think it's support streaming a blob): http://binaryjs./
Hoped these helps!
I am developing a radio system with a microphone, the system admin will speak into the microphone and the audio will be transmitted in real time to the User ... I'm newbie using node.js and I'm unsure of how to make the stream the audio from the microphone to the User ... can anyone help me?
I have the following problem, I have the audio from the microphone being recorded in a blob and I need to know how to stream live this blob ...
I do not have code to show only gives audio recording ...
<script>
function getByID(id) {
return document.getElementById(id);
}
var recordAudio = getByID('record-audio'),
stopRecordingAudio = getByID('stop-recording-audio');
var audio = getByID('audio');
var audioConstraints = {
audio: true,
video: false
};
</script>
<script>
var audioStream;
var recorder;
recordAudio.onclick = function() {
if (!audioStream)
navigator.getUserMedia(audioConstraints, function(stream) {
if (window.IsChrome) stream = new window.MediaStream(stream.getAudioTracks());
audioStream = stream;
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
// "audio" is a default type
recorder = window.RecordRTC(stream, {
type: 'audio'
});
recorder.startRecording();
}, function() {
});
else {
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
if (recorder) recorder.startRecording();
}
window.isAudio = true;
this.disabled = true;
stopRecordingAudio.disabled = false;
};
stopRecordingAudio.onclick = function() {
this.disabled = true;
recordAudio.disabled = false;
audio.src = '';
if (recorder)
recorder.stopRecording(function(url) {
audio.src = url;
audio.muted = false;
audio.play();
document.getElementById('audio-url-preview').innerHTML = '<a href="' + url + '" target="_blank">Recorded Audio URL</a>';
});
};
</script>
I am developing a radio system with a microphone, the system admin will speak into the microphone and the audio will be transmitted in real time to the User ... I'm newbie using node.js and I'm unsure of how to make the stream the audio from the microphone to the User ... can anyone help me?
I have the following problem, I have the audio from the microphone being recorded in a blob and I need to know how to stream live this blob ...
I do not have code to show only gives audio recording ...
<script>
function getByID(id) {
return document.getElementById(id);
}
var recordAudio = getByID('record-audio'),
stopRecordingAudio = getByID('stop-recording-audio');
var audio = getByID('audio');
var audioConstraints = {
audio: true,
video: false
};
</script>
<script>
var audioStream;
var recorder;
recordAudio.onclick = function() {
if (!audioStream)
navigator.getUserMedia(audioConstraints, function(stream) {
if (window.IsChrome) stream = new window.MediaStream(stream.getAudioTracks());
audioStream = stream;
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
// "audio" is a default type
recorder = window.RecordRTC(stream, {
type: 'audio'
});
recorder.startRecording();
}, function() {
});
else {
audio.src = URL.createObjectURL(audioStream);
audio.muted = true;
audio.play();
if (recorder) recorder.startRecording();
}
window.isAudio = true;
this.disabled = true;
stopRecordingAudio.disabled = false;
};
stopRecordingAudio.onclick = function() {
this.disabled = true;
recordAudio.disabled = false;
audio.src = '';
if (recorder)
recorder.stopRecording(function(url) {
audio.src = url;
audio.muted = false;
audio.play();
document.getElementById('audio-url-preview').innerHTML = '<a href="' + url + '" target="_blank">Recorded Audio URL</a>';
});
};
</script>
Share
Improve this question
asked Jun 6, 2014 at 18:58
Alan PSAlan PS
1972 silver badges12 bronze badges
1
- 1 but WebRTC is not easy, I did not figured out how to – Alan PS Commented Jun 6, 2014 at 19:03
1 Answer
Reset to default 2I am no expert but I recalled that there are few articles about capturing audio on the html5rocks.
http://updates.html5rocks./2012/01/Web-Audio-FAQ http://www.html5rocks./en/tutorials/getusermedia/intro/#toc-webaudio-api
You should try to search in the npm library. I think it might have some streaming node modules. (Starting develop from a core node.js API is really hard, i couldn't figured it out too.)
Also take a look at this:
Node.js synchronized audio streaming between server and clients?
and here is node modules for sending binary data (i think it's support streaming a blob): http://binaryjs./
Hoped these helps!
本文标签: javascriptHow to stream the blobStack Overflow
版权声明:本文标题:javascript - How to stream the blob - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745627104a2159930.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论