JSPM

  • Created
  • Published
  • Downloads 1034
  • Score
    100M100P100Q123808F
  • License MIT

Generic Jingle via WebRTC session manager.

Package Exports

  • jingle

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jingle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Jingle WebRTC

Example

var conn = new RealtimeConnection(); // stanza.io, xmpp-ftw, strophe, etc
var jingle = new Jingle();
var attachMediaStream = require('attachmediastream');
var localMedia = require('localMedia');

localMedia.on('localStream', function (stream) {
    attachMediaStream(stream, document.getElementById('localVideo'), {
        mirror: true,
        muted: true
    });
});

jingle.on('send', function (data) {
     conn.send(data);
});

jingle.on('peerStreamAdded', function (session, stream) {
     attachMediaStream(stream, document.getElementById('remoteVideo'));
});

// Answering a call request.
jingle.on('incoming', function (session) {
     // attach a media stream if desired
     // session.addStream(localMedia.localStream);
     session.accept(); // Or display an incoming call banner, etc
});

// Starting an A/V session.
localMedia.start(null, function (stream) {
    var sess = jingle.createMediaSession('peer@example.com/resouce');
    sess.addStream(stream);
    sess.start();
});

Installing

$ npm install jingle

Building bundled/minified version (for AMD, etc)

$ grunt

The bundled and minified files will be in the generated build directory.

License

MIT

Created by

If you like this, follow @lancestout or @hcornflower on twitter.