webRTC ppt

参考1

kurento

Android Get a media stream

webRTC ppt_第1张图片
image.png
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);

Stream between peers


webRTC ppt_第2张图片
image.png
PeerConnection pc = 
    factory.createPeerConnection(iceServers, constraints, observer);
pc.addStream(localStream);
pc.createOffer(this, offerConstraints);
public void onCreateSuccess(
    final SessionDescription offer) { sendMessage(offer); }

Display a media stream


webRTC ppt_第3张图片
image.png
public void onAddStream(final MediaStream stream) {
  VideoTrack track = stream.getVideoTracks(0);
  YuvImageRenderer renderer = remoteRenderer;
  track.addRenderer(new VideoRenderer(renderer));
}

你可能感兴趣的:(webRTC ppt)