Open ghost opened 10 years ago
test it work
broadcaster code
<script src="http://www.rtcmulticonnection.org/latest.js"></script>
<button id="audio">Audio stream</button>
<script>
var connection = new RTCMultiConnection('channel-654654-34434-12121');
connection.session = {
data: true
};
connection.open();
document.querySelector('#audio').onclick = function() {
connection.addStream({audio:true,oneway:true});
};
</script>
viewers code
<script src="http://www.rtcmulticonnection.org/latest.js"></script>
<script>
var connection = new RTCMultiConnection('channel-654654-34434-12121');
connection.session = {
audio: true
};
connection.connect();
</script>
test here http://htmledit.squarefree.com/ open two browser windows and paste the above code
WoW!!! Thanks!!! RTCMultiConnection is cool!!
@AlanPS I really didn't understand your question. Icecast2/shoutcast can easily be used along with nodejs to stream binary data (ogg/mp3 encoded) to the browser and you can play them directly in the <audio>
element. Otherwise you can read mp4 (h264 encoded) or webm (vp8 encoded) over nodejs and stream binary and play blocks as soon as received without waiting for entire file to be streamed.
RecordRTC is useful only to record locally and push to server using HTTP-POST or other means.
Hi, @muaz-khan what I needed was what @serhanters posted...Thanks!!!
This system works on differents ips / machines? Can transmit like a radio right?
Works only in chrome?
@serhanters this code dont work, the client does not receive the áudio!
@AlanPS you wont transmit pre-recorded audio or live audio?
broadcaster
<script src="http://www.rtcmulticonnection.org/latest.js"></script>
<script>
var connection = new RTCMultiConnection('radio');
connection.session = {
audio: true,
oneway:true
};
connection.open();
</script>
viewers
<script src="http://www.rtcmulticonnection.org/latest.js"></script>
<script>
connection = new RTCMultiConnection('radio');
connection.join(connection.channel);
</script>
Hi @serhanters , i will transmit live áudio, this second script dont works again!
@muaz-khan This system works on differents ips / machines? Can transmit like a radio right?
Works only in chrome?
RTCMultiConnection can transmit audio on multiple browsers and devices in both one-way and two-way directions however firewall bypassing depends entirely upon ice-servers you're using. XirSys claims to bypassing many restricted symmetric networks and you should try their TURN servers as well.
Remember, it rarely fails on chrome if any single user is sitting behind a public network.
You should try following snippet:
<script src="//www.rtcmulticonnection.org/latest.js"></script>
<button id="openNewSessionButton">Open New Room</button>
<script>
var connection = new RTCMultiConnection();
// easiest way to customize what you need!
connection.session = {
audio: true,
oneway: true
};
// on getting local or remote media stream
connection.onstream = function(e) {
document.body.appendChild(e.mediaElement);
};
// setup signaling channel
connection.connect();
// open new session
document.querySelector('#openNewSessionButton').onclick = function() {
connection.open();
};
</script>
Yes, now!!! Thanks @muaz-khan!! Thanks @serhanters!!
Hi, I'm trying to make a radio that sends the audio for audio player in html5 and I'm seeing the "WebRTC-broadcasting" and wanted to know if you have any way to send the audio being recorded live for audio player in html5?
And this example dont work: https://github.com/muaz-khan/WebRTC-Experiment/tree/master/webrtc-broadcasting