Ejemplo n.º 1
0
 private void attachSubscriberView(Subscriber subscriber) {
   RelativeLayout.LayoutParams layoutParams =
       new RelativeLayout.LayoutParams(
           getResources().getDisplayMetrics().widthPixels,
           getResources().getDisplayMetrics().heightPixels);
   mSubscriberViewContainer.removeView(mSubscriber.getView());
   mSubscriberViewContainer.addView(mSubscriber.getView(), layoutParams);
   subscriber.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
 }
Ejemplo n.º 2
0
 @Override
 public void onStreamReceived(Session session, Stream stream) {
   Log.v(TAG, "Received stream from session " + session.getSessionId() + ": " + stream.getName());
   Log.v(TAG, "Starting to receive video from session " + session.getSessionId());
   videoInSubscriber = new Subscriber(context, stream);
   getSession().subscribe(videoInSubscriber);
   videoInViewGroup.addView(videoInSubscriber.getView());
 }
Ejemplo n.º 3
0
 private void unsubscribeFromStream(Stream stream) {
   mStreams.remove(stream);
   if (mSubscriber.getStream().getStreamId().equals(stream.getStreamId())) {
     mSubscriberViewContainer.removeView(mSubscriber.getView());
     mSubscriber = null;
     if (!mStreams.isEmpty()) {
       subscribeToStream(mStreams.get(0));
     }
   }
 }
Ejemplo n.º 4
0
        @Override
        public void onVideoDataReceived(SubscriberKit subscriber) {

          mSubscriber.setStyle(
              BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
          ViewGroup frame = mCallback.getSubscribtionFrame();
          frame.removeAllViews();
          RelativeLayout.LayoutParams params =
              new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
          frame.removeAllViews();
          View subscriberView = mSubscriber.getView();
          frame.removeView(subscriberView);
          frame.addView(subscriberView, params);
        }
Ejemplo n.º 5
0
  @Override
  public void onDisconnected(Session session) {
    Log.i(LOGTAG, "Disconnected from the session.");
    if (mPublisher != null) {
      // mPublisherViewContainer.removeView(mPublisher.getView());
    }

    if (mSubscriber != null) {
      mSubscriberViewContainer.removeView(mSubscriber.getView());
    }

    mPublisher = null;
    mSubscriber = null;
    mStreams.clear();
    mSession = null;
  }