
Did you know that work is being done to enable videoconferencing from HTML5 applications? Ian Hickson has been doing work on the
The
Example usage:
The spec includes a way to work with Stream objects for the data coming from the device and to record Streams. It also includes an API for working with peer-to-peer connections, such as sendBitmap() or sendFile() to send data between a peer connection. The entire standard is still being baked but here is what a P2P connection might look like in pseudo-code:
// contains details such as the IP address of a server that can speak some
// protocol to help the client determine its public IP address, route packets
// if necessary, etc.
var local = new ConnectionPeer(serverConfig);
local.getLocalConfiguration(function (configuration) {
if (configuration != '') {
...; // send configuration to other peer using out-of-band mechanism
} else {
// we've exhausted our options; wait for connection
}
});
function ... (configuration) {
// called whenever we get configuration information out-of-band
local.addRemoteConfiguration(configuration);
}
local.onconnect = function (event) {
// we are connected!
local.sendText('Hello');
local.addStream(...); // send video
local.onstream = function (event) {
// receive video
// (videoElement is some <video> element)
if (local.remoteStreams.length> 0)
videoElement.src = local.remoteStreams[0].url;
};
};
