Code Monkey home page Code Monkey logo

jingle.js's Introduction

Jingle WebRTC

Example

var Jingle = require('jingle');

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
    });
});

// Capture incoming Jingle data and feed it to the Jingle
// session manager for processing
conn.on('data', function (data) {
    jingle.process(data);
});

// Capture outgoing Jingle signaling traffic and send it via
// a realtime connection
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('[email protected]/resouce');
    sess.addStream(stream);
    sess.start();
});

Integrations

stanza.io and strophe.jinglejs for integrations of this library.

Installing

$ npm install jingle

Building bundled/minified version (for AMD, etc)

$ make build

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

Documentation

License

MIT

Created by

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

jingle.js's People

Contributors

legastero avatar fippo avatar lloydwatkin avatar piotrekbator avatar sualko avatar

Stargazers

Vasiliy Zyablitsev avatar Kainoa Kanter avatar gitaudotdev avatar Philipp Huth avatar Max Wu avatar  avatar Andrii Davydov avatar lfdd avatar Monir Abu Hilal avatar Alex Shi avatar Mauro Asprea avatar  avatar Evan Cofsky avatar Salvador Gerardo avatar Konstantinos avatar Sazzad Hossain (Tushar) Khan avatar Xiaoli Wang avatar Denis Izmaylov avatar Max avatar Asad Dhamani avatar Petr Bela avatar Bruno Gomes avatar Taka avatar Mikal avatar JC Brand avatar Mark Cola avatar Ashier de Leon avatar Onofre Souza avatar Sangkyun Yoon avatar  avatar Jay Phillips avatar  avatar Grant Haywood avatar Gene Diaz avatar ʞ-uɐʇsıɹʇ avatar Ivan Tugay avatar Ying LI avatar Angus H. avatar Gustav Rydstedt avatar Casper Qvortrup avatar Sebastian Schlatow avatar Brad avatar seunggi avatar Will Fife avatar Hady Mahmoud avatar Marcus Stong avatar Michael Anthony avatar Jorge Rubiano avatar Xander Dumaine avatar Jason Lee Ertle avatar Thomas Laursen avatar Tanmay Patel avatar Robert Sköld avatar Mihail Diordiev avatar  avatar William Thivierge avatar Vladimir Mironov avatar  avatar Michael Fairchild avatar TP avatar Barry J. Burns (pluggo) avatar Abhishek Kumar avatar dap avatar krishnaarava avatar Dave Siegel avatar Gaurav Gupta avatar Hokuto Takai avatar pjstein avatar Joshua Chi avatar Garrick van Buren avatar  avatar Fraser Xu avatar Neil Chintomby avatar Andres Vidal avatar Stefaney Roberts avatar Jan Lelis avatar Maythee Anegboonlap avatar Cameron Jacobson avatar Carlos Lage avatar Morrigain H avatar Mic Wehrle avatar Danny Coates avatar David Dias avatar C J Silverio avatar Bryce Baril avatar Patrick avatar George Shank avatar Damon Oehlman avatar

Watchers

 avatar Jon Hjelle avatar Neustradamus avatar Sebastian Schlatow avatar Nigel Brooke avatar  avatar JC Brand avatar Sergey Dobrov avatar Casey Bowman avatar James Cloos avatar Marc Laporte avatar Erol Soyöz avatar Michael Anthony avatar Garrett Jensen avatar  avatar Philipp Huth avatar

jingle.js's Issues

Use on a server via node?

Is it possible to create a jingle session from node.js to Prosody using jingle.js and stanza.io? I'd like to communicate with Jitsi Focus from node.js.

Unable to require jingle

From the command line the following has ceased to work.
npm install jingle
node -i
require('jingle')

It fails with the following error

ReferenceError: navigator is not defined
at Object. (/Users/charleswall/temp/node_modules/jingle/node_modules/jingle-media-session/node_modules/rtcpeerconnection/node_modules/webrtc-adapter-test/adapter.js:39:5)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/charleswall/temp/node_modules/jingle/node_modules/jingle-media-session/node_modules/rtcpeerconnection/rtcpeerconnection.js:8:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)

I've done some digging and several dependencies in there was a change that I think caused the issue.
otalk/RTCPeerConnection@2716b3a#diff-b9cfc7f2cdf78a7f4b91a753d10865a2

I thought I'd post it here in case you have a work around. It is currently a blocker for us. I will continue to research the issue, but any help is appreciated.

Calling from Android app: Failed to set remote answer sdp: Offer and answer descriptions m-lines are not matching. Rejecting answer.

I am trying to call an android app I am working on from jsxc and when I send the answer I get an error from jsxc:

Failed to set remote answer sdp: Offer and answer descriptions m-lines are not matching. Rejecting answer.

The Session Description for the answer is:

v=0
o=- 1500876249205 1500876266185 IN IP4 0.0.0.0
s=-
t=0 0
a=msid-semantic: WMS *
m=audio 1 UDP/TLS/RTP/SAVPF 111 103 9 0 8 105 13 110 113 126
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:a8GS
a=ice-pwd:GgfdYqaOPClWN6Z8gR3oPH
a=fingerprint:sha-256 8F:45:B1:51:A5:19:D8:79:B1:0D:BD:00:38:47:EB:A2:37:15:62:21:5D:7C:7A:B5:D8:F8:E3:66:26:81:4E:3F
a=sendrecv
a=mid:audio
a=msid:ARDAMS ARDAMSa0
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
a=rtcp-fb:111 transport-cc
a=rtpmap:103 ISAC/16000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:3286066724 cname:2gc3oCS6/i6rqJc6
a=ssrc:3286066724 msid:ARDAMS ARDAMSa0

Any help you can provide is appreciated. I am using Chrome 59 on the PC.

Call history

What can be the preferable way to get call history and each call duration?

genericSession doesn't call Wildemitter constructor

A simple

WildEmitter.call(this);

is missing. What worries me a little is that this went unnoticed so far. I'm perfectly happy not to have the session as a wildemitter and do all emits via the parent.

thoughts?

Error: Cannot find module 'localMedia'

The example in the README.md is failing to work for me.

require('localMedia') on line 6 is throwing an error.

npm has a package 'localmedia' I can install ( https://github.com/otalk/localmedia )
however this package when included returns undefined.

After some reading, I found some evidence to suggest this may be a package conflict: http://stackoverflow.com/questions/25063868/node-require-returns-undefined/25068604#25068604

where is the localMedia package in your example being drawn from?

simulcast

my .accept currently looks roughly like this for simulcast:

    accept: function () {
        var self = this;

        log(this.sid + ': Accepted incoming session');

        this.state = 'active';
        this.pc.answer(function (err, answer) {
            if (err) {
                return log(self.sid + ': Could not create WebRTC answer', err);
            }
            if (self.pc.getLocalStreams().length &&
                    self.pc.getLocalStreams()[0].getVideoTracks().length > 1) {
                // possibly detect two tracks from the same device by comparing labels
                var sim = [];
                answer.jingle.contents[1].description.sources.forEach(function (source) {
                    sim.push(source.ssrc);
                });
                // order as specified by 
                // https://github.com/jitsi/jitsi-videobridge/blob/master/doc/simulcast.md
                sim.reverse();
                answer.jingle.contents[1].description.sourceGroups = [
                    {
                        semantics: 'SIM',
                        sources: sim
                    }
                ];
            }
            self.send('session-accept', answer.jingle);
        });
    },

Needs to be merged into master

Changelog?

Do you have a changelog somewhere? I think this would be super helpfull for upgrades.

Is there any reason, why you do not create new tags for new builds?

transport-info with new ufrag/pwd does not trigger ice-restart

a transport-info with a new ufrag/pwd doesn't trigger an ice restart since it only passes the candidates to the peerconnection via addIceCandidate.

I think the right thing to do is to detect the change and then do a fulll setRemoteDescription/setLocalDescription

How not to use `stun:stun.l.google.com:19302` as `ice` server?

Here https://github.com/otalk/jingle.js/blob/master/index.js#L45 stun:stun.l.google.com:19302 is the default.
And Here https://github.com/legastero/stanza.io/blob/master/lib/plugins/jingle.js#L9 using jingle without passing any conf; And so its by default getting the above specified ice server and I have only the option to add more ice server.
So how not to use stun:stun.l.google.com:19302 as ice server? Or to clear the default the ice servers?

Initiator answer fails when responder adds streams

This might be something I'm doing wrong, but I haven't been able to track down a reason.

I'm getting the error offerer must use actpass value for setup attribute from

TraceablePeerConnection.createOffer at
PeerConnection.setLocalDescription at
PeerConnection.CreateAnswer at
PeerConnection.answer at
PeerConnection.handleOffer at
JingleMediaSession.onSourceAdd

When I start the session, this all fires off as normal, but when the responder adds a stream, the error is thrown by when the answer occurs on self.pc.answer in onSourceAdd in jingle-media-session on L491. The new stream from the responder does actually come through, and can be displayed by the initiator, but the answer fails to process with the error above.

A couple oddities that I'm seeing, and I'm not sure if they're related:

  1. The Initiator gets a "default" stream in peerStreamAdded event that seems to have no media actually tied to it - is this expected? I can't find where this is coming from.
  2. No peerStreamAdded event is fired on the responder's session, even though the initiator created the session with createMediaSession(jid, sid, stream) with a valid stream. The event still doesn't occur even if the initiator manually calls addStream on the session.

Any help you're able to lend would be greatly appreciated. If there's a better forum to discuss this than the issues, please let me know!

Results aren't processed.

Results are sent (source):

    session.process(action, req.jingle, function (err) {
        if (err) {
            ......
        } else {
            self.emit('send', {
                to: sender,
                id: rid,
                type: 'result',
            });
            ......
        }
    });

But when processed (source):

    var self = this;

    // Extract the request metadata that we need to verify
    var sid = !!req.jingle ? req.jingle.sid : null;
    var session = this.sessions[sid] || null;
    var rid = req.id;
    var sender = req.from.full || req.from;

    if (req.type === 'error') {
        ......
    }

    if (req.type === 'result') {
        if (session) {
            session.pendingAction = false;
        }
        return;
    }

sid is not included in results, so the session is never found, and pendingAction is never cleared.

Error: Cannot find module 'undefined'

Hi @legastero I'm trying to use jingle.js in my project, but my app is not using any module system, so I just use the jingle.bundle.js file and include it in my html header.

But when I try to create a new jingle instance with var jingle = new Jingle(), it returns me this:

Error: Cannot find module 'undefined'

Do you have idea about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.