Java 类org.webrtc.MediaStream 实例源码

项目:newwebrtc    文件:VideoChatActivity.java   
@Override
public void onAddRemoteStream(final MediaStream remoteStream, final PnPeer peer) {
    super.onAddRemoteStream(remoteStream, peer); // Will log values
    VideoChatActivity.this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(VideoChatActivity.this,"Connected to " + peer.getId(), Toast.LENGTH_SHORT).show();
            try {
                if(remoteStream.audioTracks.size()==0 || remoteStream.videoTracks.size()==0) return;
                mCallStatus.setVisibility(View.GONE);
                remoteStream.videoTracks.get(0).addRenderer(new VideoRenderer(remoteRender));
                VideoRendererGui.update(remoteRender, 0, 0, 100, 100, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
                VideoRendererGui.update(localRender, 72, 65, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FIT, true);
            }
            catch (Exception e){ e.printStackTrace(); }
        }
    });
}
项目:nc-android-webrtcpeer    文件:PeerConnectionClient.java   
@Override
public void onAddStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
                reportError("Weird-looking stream: " + stream);
                return;
            }
            if (stream.videoTracks.size() == 1) {
                remoteVideoTrack = stream.videoTracks.get(0);
                remoteVideoTrack.setEnabled(renderVideo);
                for (VideoRenderer.Callbacks remoteRender : remoteRenders) {
                    remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
                }
            }
        }
    });
}
项目:AppRTC-Android    文件:PeerConnectionClient.java   
@Override
public void onAddStream(final MediaStream stream) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (peerConnection == null || isError) {
        return;
      }
      if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
        reportError("Weird-looking stream: " + stream);
        return;
      }
      if (stream.videoTracks.size() == 1) {
        remoteVideoTrack = stream.videoTracks.get(0);
        remoteVideoTrack.setEnabled(renderVideo);
        for (VideoRenderer.Callbacks remoteRender : remoteRenders) {
          remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
        }
      }
    }
  });
}
项目:AndroidRTC    文件:PeerConnectionClient.java   
@Override
public void onAddStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
                reportError("Weird-looking stream: " + stream);
                return;
            }
            if (stream.videoTracks.size() == 1) {
                remoteVideoTrack = stream.videoTracks.get(0);
                remoteVideoTrack.setEnabled(renderVideo);
                for (VideoRenderer.Callbacks remoteRender : remoteRenders) {
                    remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
                }
            }
        }
    });
}
项目:webrtc-android-codelab    文件:MainActivity.java   
private void gotRemoteStream(MediaStream stream) {
    //we have remote video stream. add to the renderer.
    final VideoTrack videoTrack = stream.videoTracks.getFirst();
    AudioTrack audioTrack = stream.audioTracks.getFirst();
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                remoteRenderer = new VideoRenderer(remoteVideoView);
                remoteVideoView.setVisibility(View.VISIBLE);
                videoTrack.addRenderer(remoteRenderer);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

}
项目:webrtc-android    文件:PeerConnectionClient.java   
@Override
public void onAddStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
                reportError("Weird-looking stream: " + stream);
                return;
            }
            if (stream.videoTracks.size() == 1) {
                remoteVideoTrack = stream.videoTracks.get(0);
                remoteVideoTrack.setEnabled(renderVideo);
                remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
            }
        }
    });
}
项目:viska-android    文件:CallingActivity.java   
private void initializeOutboundCall() {
  id = UUID.randomUUID().toString();

  final Application application = (Application) getApplication();
  final PeerConnectionFactory factory = application.getWebRtcFactory();

  final MediaStream mediaStream = factory.createLocalMediaStream(UUID.randomUUID().toString());
  mediaStream.addTrack(factory.createAudioTrack(
          UUID.randomUUID().toString(),
          factory.createAudioSource(CONSTRAINTS)
  ));

  peerConnection = factory.createPeerConnection(
      application.getBuiltInIceServers(),
      CONSTRAINTS,
      new PeerConnectionObserver()
  );
  peerConnection.addStream(mediaStream);
  peerConnection.createOffer(sdpObserver, CONSTRAINTS);
}
项目:voip_android    文件:PeerConnectionClient.java   
@Override
public void onAddStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
                reportError("Weird-looking stream: " + stream);
                return;
            }
            if (stream.videoTracks.size() == 1) {
                remoteVideoTrack = stream.videoTracks.get(0);
                remoteVideoTrack.setEnabled(renderVideo);
                for (VideoRenderer.Callbacks remoteRender : remoteRenders) {
                    remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
                }
            }
        }
    });
}
项目:respoke-sdk-android    文件:RespokeCall.java   
@Override public void onAddStream(final MediaStream stream){
    new Handler(Looper.getMainLooper()).post(new Runnable() {
        public void run() {
            if (isActive()) {
                if (stream.audioTracks.size() <= 1 && stream.videoTracks.size() <= 1) {
                    if (stream.videoTracks.size() == 1) {
                        stream.videoTracks.get(0).addRenderer(
                                new VideoRenderer(remoteRender));
                    }
                } else {
                    postErrorToListener("An invalid stream was added");
                }
            }
        }
    });
}
项目:react-native-webrtc    文件:PeerConnectionObserver.java   
@Override
public void onRemoveStream(MediaStream mediaStream) {
    String streamReactTag = webRTCModule.onRemoveStream(mediaStream);
    if (streamReactTag == null) {
        return;
    }
    WritableMap params = Arguments.createMap();
    params.putInt("id", id);
    params.putString("streamId", streamReactTag);
    webRTCModule.sendEvent("peerConnectionRemovedStream", params);
}
项目:react-native-webrtc    文件:RTCVideoViewManager.java   
@ReactProp(name = "streamURL")
public void setStreamURL(WebRTCView view, String streamURL) {
  MediaStream mediaStream;
  if (streamURL == null) {
    mediaStream = null;
  } else {
    WebRTCModule module = mContext.getNativeModule(WebRTCModule.class);
    mediaStream = module.mMediaStreams.get(streamURL);
  }
  view.setStream(mediaStream);
}
项目:react-native-webrtc    文件:WebRTCView.java   
/**
 * Sets the {@code MediaStream} to be rendered by this {@code WebRTCView}.
 * The implementation renders the first {@link VideoTrack}, if any, of the
 * specified {@code mediaStream}.
 *
 * @param mediaStream The {@code MediaStream} to be rendered by this
 * {@code WebRTCView} or {@code null}.
 */
public void setStream(MediaStream mediaStream) {
    VideoTrack videoTrack;

    if (mediaStream == null) {
        videoTrack = null;
    } else {
        List<VideoTrack> videoTracks = mediaStream.videoTracks;

        videoTrack = videoTracks.isEmpty() ? null : videoTracks.get(0);
    }

    setVideoTrack(videoTrack);
}
项目:PeSanKita-android    文件:WebRtcCallService.java   
@Override
public void onAddStream(MediaStream stream) {
  Log.w(TAG, "onAddStream:" + stream);

  for (AudioTrack audioTrack : stream.audioTracks) {
    audioTrack.setEnabled(true);
  }

  if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
    VideoTrack videoTrack = stream.videoTracks.getFirst();
    videoTrack.setEnabled(true);
    videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
  }

}
项目:PeSanKita-android    文件:PeerConnectionWrapper.java   
public PeerConnectionWrapper(@NonNull Context context,
                             @NonNull PeerConnectionFactory factory,
                             @NonNull PeerConnection.Observer observer,
                             @NonNull VideoRenderer.Callbacks localRenderer,
                             @NonNull List<PeerConnection.IceServer> turnServers,
                             boolean hideIp)
{
  List<PeerConnection.IceServer> iceServers = new LinkedList<>();
  iceServers.add(STUN_SERVER);
  iceServers.addAll(turnServers);

  MediaConstraints                constraints      = new MediaConstraints();
  MediaConstraints                audioConstraints = new MediaConstraints();
  PeerConnection.RTCConfiguration configuration    = new PeerConnection.RTCConfiguration(iceServers);

  configuration.bundlePolicy  = PeerConnection.BundlePolicy.MAXBUNDLE;
  configuration.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;

  if (hideIp) {
    configuration.iceTransportsType = PeerConnection.IceTransportsType.RELAY;
  }

  constraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
  audioConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));

  this.peerConnection = factory.createPeerConnection(configuration, constraints, observer);
  this.videoCapturer  = createVideoCapturer(context);

  MediaStream mediaStream = factory.createLocalMediaStream("ARDAMS");
  this.audioSource = factory.createAudioSource(audioConstraints);
  this.audioTrack  = factory.createAudioTrack("ARDAMSa0", audioSource);
  this.audioTrack.setEnabled(false);
  mediaStream.addTrack(audioTrack);

  if (videoCapturer != null) {
    this.videoSource = factory.createVideoSource(videoCapturer);
    this.videoTrack = factory.createVideoTrack("ARDAMSv0", videoSource);

    this.videoTrack.addRenderer(new VideoRenderer(localRenderer));
    this.videoTrack.setEnabled(false);
    mediaStream.addTrack(videoTrack);
  } else {
    this.videoSource = null;
    this.videoTrack  = null;
  }

  this.peerConnection.addStream(mediaStream);
}
项目:newwebrtc    文件:VideoChatActivity.java   
@Override
public void onLocalStream(final MediaStream localStream) {
    super.onLocalStream(localStream); // Will log values
    VideoChatActivity.this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if(localStream.videoTracks.size()==0) return;
            localStream.videoTracks.get(0).addRenderer(new VideoRenderer(localRender));
        }
    });
}
项目:nc-android-webrtcpeer    文件:PeerConnectionClient.java   
@Override
public void onRemoveStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            remoteVideoTrack = null;
        }
    });
}
项目:AppRTC-Android    文件:PeerConnectionClient.java   
@Override
public void onRemoveStream(final MediaStream stream) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      remoteVideoTrack = null;
    }
  });
}
项目:AndroidRTC    文件:PeerConnectionClient.java   
@Override
public void onRemoveStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            remoteVideoTrack = null;
        }
    });
}
项目:Cable-Android    文件:WebRtcCallService.java   
@Override
public void onAddStream(MediaStream stream) {
  Log.w(TAG, "onAddStream:" + stream);

  for (AudioTrack audioTrack : stream.audioTracks) {
    audioTrack.setEnabled(true);
  }

  if (stream.videoTracks != null && stream.videoTracks.size() == 1) {
    VideoTrack videoTrack = stream.videoTracks.getFirst();
    videoTrack.setEnabled(true);
    videoTrack.addRenderer(new VideoRenderer(remoteRenderer));
  }
}
项目:Cable-Android    文件:PeerConnectionWrapper.java   
public PeerConnectionWrapper(@NonNull Context context,
                             @NonNull PeerConnectionFactory factory,
                             @NonNull PeerConnection.Observer observer,
                             @NonNull VideoRenderer.Callbacks localRenderer,
                             @NonNull List<PeerConnection.IceServer> turnServers,
                             boolean hideIp)
{
  List<PeerConnection.IceServer> iceServers = new LinkedList<>();
  iceServers.add(STUN_SERVER);
  iceServers.addAll(turnServers);

  MediaConstraints                constraints      = new MediaConstraints();
  MediaConstraints                audioConstraints = new MediaConstraints();
  PeerConnection.RTCConfiguration configuration    = new PeerConnection.RTCConfiguration(iceServers);

  configuration.bundlePolicy  = PeerConnection.BundlePolicy.MAXBUNDLE;
  configuration.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;

  if (hideIp) {
    configuration.iceTransportsType = PeerConnection.IceTransportsType.RELAY;
  }

  constraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
  audioConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));

  this.peerConnection = factory.createPeerConnection(configuration, constraints, observer);
  this.videoCapturer  = createVideoCapturer(context);

  MediaStream mediaStream = factory.createLocalMediaStream("ARDAMS");
  this.audioSource = factory.createAudioSource(audioConstraints);
  this.audioTrack  = factory.createAudioTrack("ARDAMSa0", audioSource);
  this.audioTrack.setEnabled(false);
  mediaStream.addTrack(audioTrack);

  if (videoCapturer != null) {
    this.videoSource = factory.createVideoSource(videoCapturer);
    this.videoTrack = factory.createVideoTrack("ARDAMSv0", videoSource);

    this.videoTrack.addRenderer(new VideoRenderer(localRenderer));
    this.videoTrack.setEnabled(false);
    mediaStream.addTrack(videoTrack);
  } else {
    this.videoSource = null;
    this.videoTrack  = null;
  }

  this.peerConnection.addStream(mediaStream);
}
项目:WebRTC-VideoCall-Anrdoid    文件:VideoCallActivity.java   
@Override
        public void onAddStream(MediaStream mediaStream) {
            LogUtils.e("onAddStream");
//            peerConnection.addStream(mediaStream);
            mediaStream.videoTracks.get(0).addRenderer(remoteVideoRender);
//            VideoRendererGui.update(remoteRender, 0, 0, 100, 100, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, true);
//            VideoRendererGui.update(localRender, 72, 65, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FIT, true);

        }
项目:nubo-test    文件:PeerVideoActivity.java   
@Override
public void onRemoteStreamAdded(MediaStream mediaStream, NBMPeerConnection nbmPeerConnection) {
    Log.i(TAG, "onRemoteStreamAdded");
    nbmWebRTCPeer.setActiveMasterStream(mediaStream);
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            mCallStatus.setText("");
        }
    });
}
项目:webrtc-android    文件:RtcActivity.java   
@Override
public void onLocalStream(MediaStream localStream) {
    localStream.videoTracks.get(0).addRenderer(new VideoRenderer(localRender));
    VideoRendererGui.update(localRender,
            LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING,
            LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING,
            scalingType, true);
}
项目:webrtc-android    文件:RtcActivity.java   
@Override
public void onAddRemoteStream(MediaStream remoteStream, int endPoint) {
    remoteStream.videoTracks.get(0).addRenderer(new VideoRenderer(remoteRender));
    VideoRendererGui.update(remoteRender,
            REMOTE_X, REMOTE_Y,
            REMOTE_WIDTH, REMOTE_HEIGHT, scalingType, true);
    VideoRendererGui.update(localRender,
            LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED,
            LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED,
            scalingType, true);
}
项目:webrtc-android    文件:PeerConnectionClient.java   
@Override
public void onRemoveStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            remoteVideoTrack = null;
        }
    });
}
项目:viska-android    文件:CallingActivity.java   
public void onAnswerButtonClicked(final View view) {
  progressState.changeValue(ProgressState.NEGOTIATING);
  showHangButton();

  final PeerConnectionFactory factory = ((Application) getApplication()).getWebRtcFactory();
  final MediaStream stream = factory.createLocalMediaStream(UUID.randomUUID().toString());
  stream.addTrack(factory.createAudioTrack(
      UUID.randomUUID().toString(),
      factory.createAudioSource(CONSTRAINTS)
  ));
  peerConnection.addStream(stream);
  peerConnection.createAnswer(sdpObserver, new MediaConstraints());
}
项目:VideoMeeting    文件:RoomChatPresenter.java   
private void addRender(MediaStream stream, int position) {
    VideoRenderer.Callbacks render;
    L.d("addRender position is " + position);
    if (position == 0) {
        render = localRender;
    } else {
        render = VideoRendererGui.create(position % 2 == 0 ? 0 : 50,
                position / 2 * 50,
                50, 50,
                scalingType, false);
    }
    stream.videoTracks.get(0).addRenderer(new VideoRenderer(render));
}
项目:nubo-test-tree    文件:MasterVideoActivity.java   
@Override
    public void onRemoteStreamAdded(MediaStream mediaStream, NBMPeerConnection nbmPeerConnection) {
        Log.i(TAG, "onRemoteStreamAdded");
//        nbmWebRTCPeer.attachRendererToRemoteStream(remoteRender, mediaStream);
//        runOnUiThread(new Runnable() {
//            @Override
//            public void run() {
//                mCallStatus.setText("");
//            }
//        });
    }
项目:nubo-test-tree    文件:ViewerVideoActivity.java   
@Override
public void onRemoteStreamAdded(MediaStream mediaStream, NBMPeerConnection nbmPeerConnection) {
    Log.i(TAG, "onRemoteStreamAdded");
    nbmWebRTCPeer.attachRendererToRemoteStream(remoteRender, mediaStream);
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            mCallStatus.setText("");
        }
    });
}
项目:janus-gateway-android    文件:EchoTest.java   
@Override
public void onRemoteStream(MediaStream stream) {
    stream.videoTracks.get(0).setEnabled(true);
    if(stream.videoTracks.get(0).enabled())
        Log.d("JANUSCLIENT", "video tracks enabled");
    stream.videoTracks.get(0).addRenderer(new VideoRenderer(remoteRender));
    VideoRendererGui.update(remoteRender, 0, 0, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, true);
    VideoRendererGui.update(localRender, 72, 72, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
}
项目:webrtcpeer-android    文件:MediaResourceManager.java   
public void run() {
    Log.d(TAG, "Attaching VideoRenderer to remote stream (" + remoteStream + ")");

    // Check if the remote stream has a video track
    if (remoteStream.videoTracks.size() == 1) {
        // Get the video track
        VideoTrack remoteVideoTrack = remoteStream.videoTracks.get(0);
        // Set video track enabled if we have enabled video rendering
        remoteVideoTrack.setEnabled(renderVideo);

        VideoRenderer videoRenderer = remoteVideoRenderers.get(remoteRender);
        if (videoRenderer != null) {
            MediaStream mediaStream = remoteVideoMediaStreams.get(videoRenderer);
            if (mediaStream != null) {
                VideoTrack videoTrack = remoteVideoTracks.get(mediaStream);
                if (videoTrack != null) {
                    videoTrack.removeRenderer(videoRenderer);
                }
            }
        }

        VideoRenderer newVideoRenderer = new VideoRenderer(remoteRender);
        remoteVideoTrack.addRenderer(newVideoRenderer);
        remoteVideoRenderers.put(remoteRender, newVideoRenderer);
        remoteVideoMediaStreams.put(newVideoRenderer, remoteStream);
        remoteVideoTracks.put(remoteStream, remoteVideoTrack);
        Log.d(TAG, "Attached.");
    }
}
项目:UMA-AndroidWebRTC    文件:WebRTCCliente.java   
@Override
public void onAddStream(MediaStream mediaStream) {
    Log.d(TAG,"SE AÑADE UN CLIENTE onAddStream "+mediaStream.label());

  // remote streams are displayed from 1 to MAX_PEER (0 is localStream)
  mListener.onAddRemoteStream(mediaStream, endPoint+1);
}
项目:actor-platform    文件:AndroidMediaStream.java   
public AndroidMediaStream(MediaStream stream) {
    this.isLocal = false;
    this.stream = stream;
    this.allTracks = new WebRTCMediaTrack[stream.audioTracks.size() + stream.videoTracks.size()];
    this.audioTracks = new WebRTCMediaTrack[stream.audioTracks.size()];
    for (int i = 0; i < this.audioTracks.length; i++) {
        audioTracks[i] = new AndroidAudioTrack(stream.audioTracks.get(i), this);
        allTracks[i] = audioTracks[i];
    }
    this.videoTracks = new WebRTCMediaTrack[stream.videoTracks.size()];
    for (int i = 0; i < this.videoTracks.length; i++) {
        videoTracks[i] = new AndroidVideoTrack(stream.videoTracks.get(i), this);
        allTracks[audioTracks.length + i] = videoTracks[i];
    }
}
项目:voip_android    文件:PeerConnectionClient.java   
@Override
public void onRemoveStream(final MediaStream stream) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            remoteVideoTrack = null;
        }
    });
}
项目:respoke-sdk-android    文件:RespokeCall.java   
@Override public void onRemoveStream(final MediaStream stream){
    new Handler(Looper.getMainLooper()).post(new Runnable() {
        public void run() {
            if (isActive()) {
                stream.videoTracks.get(0).dispose();
            }
        }
    });
}
项目:WebRTCDemo    文件:AppRTCDemoActivity.java   
@Override public void onAddStream(final MediaStream stream){
  runOnUiThread(new Runnable() {
      public void run() {
        abortUnless(stream.audioTracks.size() <= 1 &&
            stream.videoTracks.size() <= 1,
            "Weird-looking stream: " + stream);
        if (stream.videoTracks.size() == 1) {
          stream.videoTracks.get(0).addRenderer(
              new VideoRenderer(remoteRender));
        }
      }
    });
}
项目:WebRTCDemo    文件:AppRTCDemoActivity.java   
@Override public void onRemoveStream(final MediaStream stream){
  runOnUiThread(new Runnable() {
      public void run() {
        stream.videoTracks.get(0).dispose();
      }
    });
}
项目:restcomm-android-sdk    文件:PeerConnectionClient.java   
@Override
    public void onAddStream(final MediaStream stream) {
      executor.execute(new Runnable() {
        @Override
        public void run() {
          if (peerConnection == null || isError) {
            return;
          }
          if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
            reportError("Weird-looking stream: " + stream);
            return;
          }
          if (stream.videoTracks.size() == 1) {
            remoteVideoTrack = stream.videoTracks.get(0);
            remoteVideoTrack.setEnabled(renderRemoteVideo);
            if (remoteRenders.size() > 1) {
              // until we get the backgrounding working let's only handle 1
              throw new RuntimeException("Only supporting size 1 remoteRenders");
            }
            else if (remoteRenders.size() == 1) {
              remoteVideoRenderer = new VideoRenderer(remoteRenders.get(0));
              remoteVideoTrack.addRenderer(remoteVideoRenderer);
            }
/*
            for (VideoRenderer.Callbacks remoteRender : remoteRenders) {
              remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
            }
*/
            events.onRemoteVideo();
          }
        }
      });
    }
项目:restcomm-android-sdk    文件:PeerConnectionClient.java   
@Override
public void onRemoveStream(final MediaStream stream) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      remoteVideoTrack = null;
    }
  });
}
项目:matrix-android-sdk    文件:MXWebRtcView.java   
/**
 * Sets the {@code MediaStream} to be rendered by this {@code WebRTCView}.
 * The implementation renders the first {@link VideoTrack}, if any, of the
 * specified {@code mediaStream}.
 *
 * @param mediaStream The {@code MediaStream} to be rendered by this
 *                    {@code WebRTCView} or {@code null}.
 */
public void setStream(MediaStream mediaStream) {
    VideoTrack videoTrack;

    if (mediaStream == null) {
        videoTrack = null;
    } else {
        List<VideoTrack> videoTracks = mediaStream.videoTracks;

        videoTrack = videoTracks.isEmpty() ? null : videoTracks.get(0);
    }

    setVideoTrack(videoTrack);
}