Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Commit

Permalink
stanza.io with separated localmedia
Browse files Browse the repository at this point in the history
  • Loading branch information
fippo committed Jul 17, 2014
1 parent 4577928 commit 79f50cd
Show file tree
Hide file tree
Showing 3 changed files with 9,886 additions and 8,238 deletions.
23 changes: 14 additions & 9 deletions stanzaio/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title>stanza.io — Jingle Interop Testing</title>
<script src="attachmediastream.bundle.js"></script>
<script src="stanzaio.bundle.js"></script>
<script src="localmedia.bundle.js"></script>
<style>
video {
width: 320px;
Expand Down Expand Up @@ -49,6 +50,14 @@ <h2>Remote Video</h2>

<script>
var client;
var localMedia = new LocalMedia();
localMedia.on('localStream', function (stream) {
attachMediaStream(stream, document.getElementById('localVideo'), {
muted: true,
mirror: true
});
});

var loginInfo = document.getElementById('loginInfo');

var inlog = console.log.bind(console, '<<in');
Expand Down Expand Up @@ -96,18 +105,12 @@ <h2>Remote Video</h2>

client.connect();

client.on('jingle:localstream:added', function (stream) {
attachMediaStream(stream, document.getElementById('localVideo'), {
muted: true,
mirror: true
});
});

client.on('jingle:remotestream:added', function (session, stream) {
attachMediaStream(stream, document.getElementById('remoteVideo'));
});

client.on('jingle:incoming', function (session) {
session.addStream(localMedia.localStream);
session.accept();
});

Expand All @@ -124,13 +127,15 @@ <h2>Remote Video</h2>
href.style.display = 'block';
});

client.jingle.startLocalMedia();
localMedia.start();

var callInfo = document.getElementById('callInfo');
callInfo.onsubmit = function (e) {
e.preventDefault();
var jid = document.getElementById('peer').value;
client.call(jid);
var session = client.jingle.createMediaSession(jid);
session.addStream(localMedia.localStream);
session.start();
return false;
};

Expand Down
Loading

0 comments on commit 79f50cd

Please sign in to comment.