Exemplo 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);
 }
Exemplo n.º 2
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));
     }
   }
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
  private void subscribeToStream(Stream stream) {
    Log.d(LOGTAG, "subscribing to stream");
    mSubscriber = new Subscriber(this, stream);
    CircleVideoRenderer circleVideoRenderer = new CircleVideoRenderer(getApplicationContext());
    mSubscriber.setRenderer(circleVideoRenderer);
    mSubscriber.setVideoListener(this);
    mSubscriber.setSubscribeToAudio(true);
    mSubscriber.setSubscribeToVideo(true);
    mSession.subscribe(mSubscriber);

    if (mSubscriber.getSubscribeToVideo()) {
      // start loading spinning
      mLoadingSub.setVisibility(View.VISIBLE);
    }

    Log.d(LOGTAG, "leaving subscribing to stream");
  }
 @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());
 }
Exemplo n.º 6
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;
  }
Exemplo n.º 7
0
 @Override
 public void onStreamReceived(Session session, Stream stream) {
   mSubscriber = new Subscriber(mContext, stream);
   mSubscriber.setVideoListener(mVideoListener);
   mSession.subscribe(mSubscriber);
 }