Comments (8)
As long as you keep quickconnect as a JS API and glue as a HTML API, any required changes for interoperability make sense to me. :-)
from rtc-quickconnect.
Just made some tweaks to the examples in a branch to give a feel for what the API might look like:
And here is the updated code from the conference example:
var quickconnect = require('rtc-quickconnect');
var crel = require('crel');
// create containers for our local and remote video
var local = crel('div', { class: 'local' });
var remote = crel('div', { class: 'remote' });
var peerMedia = {};
quickconnect('http://rtc.io/switchboard/', { ns: 'dctest' })
// add some media (use rtc-captureclass) to configure the stream
.addMedia('camera:0 min:1280x768', function(err, media) {
media.render(local);
})
// when a peer is connected (and active) pass it to us for use
.on('peer:connect', function(pc, id, data) {
// render the remote streams
pc.getRemoteStreams().forEach(renderRemote(id));
})
// when a peer leaves, remove teh media
.on('peer:leave', function(id) {
// remove media for the target peer from the dom
(peerMedia[id] || []).splice(0).forEach(function(el) {
el.parentNode.removeChild(el);
});
})
// render a remote video
function renderRemote(id) {
// create the peer media list
peerMedia[id] = peerMedia[id] || [];
return function(stream) {
peerMedia[id] = peerMedia[id].concat(media(stream).render(remote));
}
}
/* extra code to handle dynamic html and css creation */
// add some basic styling
document.head.appendChild(crel('style', [
'.local { position: absolute; right: 10px; }',
'.local video { max-width: 200px; }'
].join('\n')));
// add the local and remote elements
document.body.appendChild(local);
document.body.appendChild(remote);
from rtc-quickconnect.
Reworked the conference example again, I think it makes sense to keep rtc-media decoupled from rtc-quickconnect. Primarily because it means people can add media streams however they managed to capture them.
Updated sample code:
var quickconnect = require('rtc-quickconnect');
var media = require('rtc-media');
var crel = require('crel');
// create containers for our local and remote video
var local = crel('div', { class: 'local' });
var remote = crel('div', { class: 'remote' });
var media
var peerMedia = {};
// capture local media
var localMedia = media();
// once media is captured, connect
localMedia.once('capture', function(stream) {
quickconnect('http://rtc.io/switchboard/', { ns: 'dctest' })
// broadcast our captured media to other participants in the room
.broadcast(stream)
// when a peer is connected (and active) pass it to us for use
.on('peer:connect', function(pc, id, data) {
// render the remote streams
pc.getRemoteStreams().forEach(renderRemote(id));
})
// when a peer leaves, remove teh media
.on('peer:leave', function(id) {
// remove media for the target peer from the dom
(peerMedia[id] || []).splice(0).forEach(function(el) {
el.parentNode.removeChild(el);
});
})
});
// render the local media
localMedia.render(local);
// render a remote video
function renderRemote(id) {
// create the peer media list
peerMedia[id] = peerMedia[id] || [];
return function(stream) {
peerMedia[id] = peerMedia[id].concat(media(stream).render(remote));
}
}
/* extra code to handle dynamic html and css creation */
// add some basic styling
document.head.appendChild(crel('style', [
'.local { position: absolute; right: 10px; }',
'.local video { max-width: 200px; }'
].join('\n')));
// add the local and remote elements
document.body.appendChild(local);
document.body.appendChild(remote);
from rtc-quickconnect.
Conferencing example working as at 8a674f9 - only tested between Chrome 31 and Firefox 26 on Debian at this stage though.
from rtc-quickconnect.
Yes, please keep rtc-media separate - many people just want to use the camera input and not a peerconnection, so this is useful by itself.
from rtc-quickconnect.
That wasn't really what I meant... it's just more that rtc-media isn't in the dependency tree of quickconnect. rtc-media will most definitely remain separate and usable in it's own right :)
from rtc-quickconnect.
Though after re-reading my comment I can see how you got the impression it would be merged in...
from rtc-quickconnect.
Done - 0.8.1
released and working nicely with FF.
from rtc-quickconnect.
Related Issues (20)
- Unable to connect to peer outside of local network
- Targetting new datachannel to particular end host
- requestChannel fails to register new data channel initiated from peer
- phantom data channels created on peer page reload/reconnect
- dependency install failure - utf-8-validate HOT 10
- TypeError: PeerConnection is not a function HOT 3
- Trying to connect to socket.io server throws " Connection closed before receiving a handshake response"
- Announce contains the user id of the person starting the call not who is announcing HOT 2
- On 3 way call the number of messages sent to signaller server increases at least 4 times until it stabilizes or fails HOT 2
- Ignoring messages that are not directed to each participant in a call is required when broadcasting to a room HOT 4
- `stream:added` can be emitted more than once for a stream
- Existing users will re-announce when any user in that room disconnected HOT 2
- Does increasing the heartbeat time increase the likelihood of getting "call expired" events?
- RTCPeerConnection object not clearing after participant leaves HOT 9
- Small grammatical errors in docs
- Failed to set remote offer sdp HOT 2
- Change room name on an existing rtc-quickconnect instance HOT 3
- Adapter.js throws an exception when removeStream is called HOT 6
- Failed to execute 'removeTrack' on 'RTCPeerConnection': parameter 1 is not of type 'RTCRtpSender HOT 1
- XML Parsing Error: no root element found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtc-quickconnect.