15
WebRTC for Android, iOS and Web
+Justin Uberti @juberti
+Sam Dutton @sw12
int main(char** argv, int argc) {
// TODO(webrtc-team): Build the world's� best communications platform
return 0;
}
Any application
Audio, video, and data
Open source, open protocols
High quality
Peer-to-peer
End-to-end security
Chrome commented on this revision
LGTM! When can we have it?
Photo source: Eric Fischer
WebRTC
Photo source: Eric Fischer
AndroidiOSWebRTC
1.5 billion+
WebRTC browsers
3 billion+
WebRTC app downloads
✓ Web�
✓ Android�
✓ iOS
Audio track
Video track
MediaStream
Audio track
Video track
getUserMedia()
Get a media stream
Web: getUserMedia
�navigator.getUserMedia(constraints, onStream);�function onStream(localStream) {� // do something with stream�}
Get a media stream
Android: org.webrtc.VideoCapturer�
VideoCapturer c = VideoCapturer.create(device);
PeerConnectionFactory factory = new PeerConnectionFactory();�MediaStream localStream = factory.createLocalMediaStream(streamName);
VideoSource s = factory.createVideoSource(c, constraints);�VideoTrack t = factory.createVideoTrack(trackName, s);�localStream.addTrack(t);
Get a media stream
iOS: RTCVideoCapturer
RTCVideoCapturer* c = [capturerWithDeviceName device];
RTCMediaStream* localStream = [factory mediaStreamWithLabel:streamName];
RTCVideoSource* s = [[factory videoSourceWithCapturer:c ...];
RTCVideoTrack* t = [[RTCVideoTrack alloc] source:s ...];
[localStream addVideoTrack:t];
Peer connection
Peer connection
MediaStream
Audio�+
Video
Audio�+
Video
Stream between peers
Web: RTCPeerConnection
�pc = new RTCPeerConnection(config);
pc.onaddstream = onRemoteStream;�pc.addStream(localStream);
pc.createOffer(onCreateSuccess);�function onCreateSuccess(offer) { sendMessage(offer); }
Stream between peers
Android: org.webrtc.PeerConnection
�PeerConnection pc = � factory.createPeerConnection(iceServers, constraints, observer);
pc.addStream(localStream);
pc.createOffer(this, offerConstraints);�public void onCreateSuccess(� final SessionDescription offer) { sendMessage(offer); }
Stream between peers
iOS: RTCPeerConnection
RTCPeerConnection* pc = [factory peerConnectionWithICEServers:iceServers� constraints:constraints delegate:self];
[pc addStream:localStream];
[pc createOfferWithDelegate:self constraints:offerConstraints];�- (void)peerConnection:(RTCPeerConnection *)peerConnection� didCreateSessionDescription:(RTCSessionDescription *)offer� error:(NSError *)error { sendMessage(offer); }
Peer connection
Render
Peer connection
MediaStream
MediaStream
Audio�+
Video
Audio�+
Video
Display a media stream
Web: <video>
function onRemoteStream(remoteStream) {� videoElement.src = window.URL.createObjectURL(remoteStream);�}
Display a media stream
Android: org.webrtc.VideoRenderer
public void onAddStream(final MediaStream stream) {� VideoTrack track = stream.getVideoTracks(0);
YuvImageRenderer renderer = remoteRenderer;
track.addRenderer(new VideoRenderer(renderer));�}
Display a media stream
iOS: RTCEAGLVideoView
- (void)peerConnection:(RTCPeerConnection *)peerConnection� addedStream:(RTCMediaStream *)stream {
RTCVideoTrack* track = stream.videoTracks[0];
RTCEAGLVideoView* view = _remoteVideoView;
[track addRenderer:view]; �}
AppRTC
High performance media
Fast call setup
Easy to understand and extend
github.com/webrtc��webrtc.org
WebSocket + GCE
Smart signaling
Tailbone
Coturn server + GCE
500 ms
Thank You!
+Justin Uberti @juberti
+Sam Dutton @sw12
15