Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Implement signaling #16

Merged
merged 108 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
af908d7
Add dependencies for logger
Kirguir Jan 15, 2019
023ac33
Impl simple logger and dual logger
Kirguir Jan 15, 2019
5d4a315
Upd CHANGELOG
Kirguir Jan 16, 2019
74b4e12
Remove CHANGELOG
Kirguir Jan 16, 2019
52a65d3
Impl member and members repository
Kirguir Jan 17, 2019
122d780
Impl handle WS connection
Kirguir Jan 18, 2019
579d4a4
Merge branch 'master' into add_member
Kirguir Jan 18, 2019
d0d691f
Impl default caller and responder
Kirguir Jan 18, 2019
89dee99
Merge branch 'add_member' into handle_ws
Kirguir Jan 18, 2019
278116d
Corrections
tyranron Jan 21, 2019
61366f2
Add state to context ws session
Kirguir Jan 21, 2019
3ef7c30
Add hashmap macro
Kirguir Jan 21, 2019
747ab14
Impl control API errors
Kirguir Jan 22, 2019
c556eb4
Merge branch 'add_member' into handle_ws
Kirguir Jan 22, 2019
8b8edb8
Impl WsSessionRepository
Kirguir Jan 25, 2019
04afc2d
Some corrections
tyranron Jan 28, 2019
c00ad31
Impl remove session from repository
Kirguir Jan 28, 2019
251b3e0
Remove impl actor for MemberRepository
Kirguir Jan 28, 2019
f22945e
Remove unused crates
Kirguir Jan 29, 2019
368b805
Merge branch 'add_member' into handle_ws
Kirguir Jan 29, 2019
0e854d0
Fill up missing docs
tyranron Jan 29, 2019
4bb6096
Remove impl actor for WsSessionRepository
Kirguir Jan 30, 2019
fcb1072
Refactoring and simplify WsSessionRepository
Kirguir Jan 30, 2019
ded6728
Merge branch 'add_member' into handle_ws
Kirguir Jan 30, 2019
4174597
Add docs
Kirguir Jan 30, 2019
1ab77fe
Returns cloned member from repo
Kirguir Jan 31, 2019
ef72144
Merge branch 'add_member' into handle_ws
Kirguir Jan 31, 2019
5d46ecb
Merge branch 'master' into handle_ws
Kirguir Jan 31, 2019
75b48cc
Some fix
Kirguir Jan 31, 2019
1852bad
Remove checking old connection of member
Kirguir Feb 4, 2019
1a3caca
Impl test for handler ws connection
Kirguir Feb 5, 2019
7cfc1eb
Impl handle event
Kirguir Feb 6, 2019
50adead
Impl handle Command::Close
Kirguir Feb 6, 2019
7b84926
Impl close message
Kirguir Feb 7, 2019
7edfc62
Add heartbeat messages
Kirguir Feb 8, 2019
0ca4987
Impl handle heartbeat messages
Kirguir Feb 8, 2019
76ae3b0
Refactoring repositories
Kirguir Feb 12, 2019
00c7610
Impl simple peer state machine
Kirguir Feb 13, 2019
3e37b5b
Remove redudant serde_derive dependency
tyranron Feb 13, 2019
3183780
Refactor
tyranron Feb 13, 2019
7a5117d
Impl room and repository of rooms
Kirguir Feb 21, 2019
4e696cb
Merge branch 'handle_ws' into add_peer
Kirguir Feb 21, 2019
53ea312
fix disconnects_on_idle test, use FutureResponse instead of HttpResponse
alexlapa Feb 22, 2019
0c650d0
abstract on transport
alexlapa Feb 25, 2019
96d6845
Impl peers
Kirguir Feb 25, 2019
a71d5f3
Simplify RpcConnection trait
Kirguir Feb 25, 2019
261ed38
Impl correct close WsSession
Kirguir Feb 26, 2019
0470201
Fix send close message to Room
Kirguir Feb 27, 2019
e9523b1
Merge branch 'handle_ws' into add_peer
Kirguir Feb 27, 2019
55b9c3e
Impl crate offers for caller and responder
Kirguir Mar 1, 2019
4703bd3
Impl receive sdp_answer and send it to caller
Kirguir Mar 4, 2019
6687b87
Impl create tracks and store link into peers
Kirguir Mar 7, 2019
d82e299
Move room to media module
Kirguir Mar 8, 2019
0decf28
impl ice candidates relay, impl test client, refactor
alexlapa Mar 11, 2019
f99aab5
Merge branch 'master' into add_peer
Kirguir Mar 11, 2019
c652287
Move command and event to client module
Kirguir Mar 12, 2019
ffeb144
Impl send event by Room
Kirguir Mar 19, 2019
756f293
Impl handle Command::MakeSdpOffer
Kirguir Mar 20, 2019
90201da
Impl return future by handler Command
Kirguir Mar 21, 2019
bda5ba2
Fix errors
Kirguir Mar 22, 2019
30550cd
Impl remove peers of member on close RPC connection.
Kirguir Mar 28, 2019
2ca0a6a
Merge branch 'peer_actor' into add_peer
Kirguir Mar 28, 2019
55169da
Some fix
Kirguir Mar 28, 2019
39e0747
Refactoring watchdog for RPC connection
Kirguir Mar 29, 2019
3aff730
Update test for room
Kirguir Mar 29, 2019
6e7633f
Refactoring of handler established RPC connection
Kirguir Apr 3, 2019
06774bb
Handler error send event
Kirguir Apr 4, 2019
0d472b8
Impl transition into failure state for peer
Kirguir Apr 5, 2019
d3cd4a8
Revert rename ws session
Kirguir Apr 8, 2019
022c980
Merge branch 'master' into add_peer
Kirguir Apr 8, 2019
7eb2837
Ignore connection errors when closing Room
Kirguir Apr 8, 2019
d852df2
Refactoring send message from WsSession to Room use try_send
Kirguir Apr 9, 2019
0618206
Add reconnect timeout parameter to config
Kirguir Apr 10, 2019
f40661f
Merge branch 'master' into add_peer
Kirguir Apr 11, 2019
e41a7e2
refactor session.rs
alexlapa Apr 11, 2019
24e2413
move rpc connection to module
alexlapa Apr 11, 2019
b0de9a7
minor refactor
alexlapa Apr 11, 2019
a8eb8e0
add todos
alexlapa Apr 12, 2019
d708a21
Impl handler StartSignaling
Kirguir Apr 15, 2019
7bf48f0
Make linter happy
Kirguir Apr 16, 2019
bf29c77
remove Handler<Heartbeat> for WsSession
alexlapa Apr 23, 2019
e80bec8
fix signaling_test
alexlapa Apr 23, 2019
41dece5
add protocol from jason
alexlapa Apr 25, 2019
b7de721
make clippy happy
alexlapa Apr 25, 2019
92de12d
fix tests
alexlapa Apr 25, 2019
a83de49
fix event send
alexlapa Apr 25, 2019
9a50956
fix event send
alexlapa Apr 25, 2019
3d0f92d
update signaling_test to new protocol
alexlapa Apr 25, 2019
bd8a2ac
mover room to signalling package, cleanup unused code
alexlapa Apr 25, 2019
dc4754c
drop ws if Established result is err
alexlapa Apr 26, 2019
ab54777
refactor
alexlapa Apr 26, 2019
6ec9a32
refactor
alexlapa Apr 26, 2019
1d1348f
refactor
alexlapa Apr 29, 2019
32e4144
add PeerRepository
alexlapa Apr 30, 2019
0b0d564
add ParticipantService
alexlapa Apr 30, 2019
d531e20
fix signalling start
alexlapa May 1, 2019
07e5f09
impl_from_peer
alexlapa May 1, 2019
974c023
TryFrom<PeerStateMachine> for Peer<T>
alexlapa May 1, 2019
958d4ef
TryFrom<&PeerStateMachine> for &Peer<T>
alexlapa May 1, 2019
94e99b1
refactor
alexlapa May 2, 2019
b24996a
refactor
alexlapa May 2, 2019
b09e5b8
add docs
alexlapa May 2, 2019
ca8d888
add docs
alexlapa May 2, 2019
7347dba
add docs
alexlapa May 2, 2019
0f4fdc1
fix start_signaling test
alexlapa May 2, 2019
04d4000
move TestConnection to rpc_connection
alexlapa May 2, 2019
9befaf4
delete obsolete test
alexlapa May 2, 2019
265369e
refactor
alexlapa May 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ toml = "0.4"
[dev-dependencies]
serial_test = "0.2"
serial_test_derive = "0.2"
tokio = "0.1"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ Medea
Medea media server

__DEVELOPMENT IN PROGRESS__

{"MakeSdpOffer":{"peer":0,"sdp_offer":"caller_offer"}}
161 changes: 161 additions & 0 deletions signaling_test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<!DOCTYPE html>
<html>
<head>
<title>Chat</title>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>

<script type="text/javascript">

var socket;
var pcs = {};

function connectSocket(caller) {
let role = caller ? "1/caller_credentials" : "2/responder_credentials";
socket = new WebSocket("ws://localhost:8080/ws/1/" + role);
socket.onmessage = handleSocketMessage;

window.setInterval(function () {
socket.send("{\"ping\":1}");
}, 8000);
};

function handleSocketMessage(message) {

var msg = JSON.parse(message.data);

switch (msg.event) {
case 'PeerCreated':
handlePeerCreated(msg.data);
break;
case 'SdpAnswerMade':
handleSdpAnswerMade(msg.data);
break;
case 'IceCandidateDiscovered':
handleIceCandidateDiscovered(msg.data);
break;
}
}

async function handlePeerCreated(msg) {
var sendAudio = false;
var sendVideo = false;
var recvAudio = false;
var recvVideo = false;

msg.tracks.forEach((track) => {

if (track.media_type.Audio != undefined) {
if (track.direction.Send != undefined) {
sendAudio = true;
}

if (track.direction.Recv != undefined) {
recvAudio = true;
}

}
if (track.media_type.Video != undefined) {
if (track.direction.Send != undefined) {
sendVideo = true;
}

if (track.direction.Recv != undefined) {
recvVideo = true;
}
}
});

pcs[msg.peer_id] = new RTCPeerConnection();

var pc = pcs[msg.peer_id];
pc.ontrack = function (e) {
console.log("ontrack");
partnervid.srcObject = e.streams[0];
};

if (sendVideo || sendAudio) {
const stream = await navigator.mediaDevices.getUserMedia({
audio: sendAudio,
video: sendVideo
});

yourvid.srcObject = stream;

stream.getTracks().forEach((track) => {
pc.addTrack(track, stream);
});
}


var mediaConstraints = {
'mandatory': {
'OfferToReceiveAudio': recvAudio,
'OfferToReceiveVideo': recvVideo
}
};

if (msg.sdp_offer != undefined && msg.sdp_offer != null) {
pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(msg.sdp_offer)));
var answer = await pc.createAnswer(mediaConstraints);
pc.setLocalDescription(answer);

socket.send(JSON.stringify({
command: "MakeSdpAnswer",
data: {
peer_id: msg.peer_id,
sdp_answer: JSON.stringify(answer)
}
}));
} else {
var offer = await pc.createOffer(mediaConstraints);
pc.setLocalDescription(offer);
socket.send(JSON.stringify({
command: "MakeSdpOffer",
data: {
peer_id: msg.peer_id,
sdp_offer: JSON.stringify(offer)
}
}));
}


pc.onicecandidate = function (e) {

if (e.candidate) {
socket.send(JSON.stringify({
command: "SetIceCandidate",
data: {
peer_id: msg.peer_id,
candidate: JSON.stringify(e.candidate)
}
}))
}

};
}

async function handleSdpAnswerMade(msg) {
var pc = pcs[msg.peer_id];
pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(msg.sdp_answer)))
}

async function handleIceCandidateDiscovered(msg) {
var pc = pcs[msg.peer_id];
pc.addIceCandidate(JSON.parse(msg.candidate));
}

</script>
</head>
<body>
<div>
<div>
<div>
<video id="yourvid" muted autoplay width="100%" height="100%"></video>
</div>
<div>
<video id="partnervid" autoplay width="100%" height="100%"></video>
</div>
</div>
</div>
</body>
</html>
7 changes: 3 additions & 4 deletions src/api/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Implementation of Client API.

pub mod room;
pub mod server;
pub mod session;
mod session;

pub use self::{room::*, server::*, session::*};
pub mod rpc_connection;
pub mod server;
180 changes: 0 additions & 180 deletions src/api/client/room.rs

This file was deleted.

Loading