コード例 #1
0
 @Override
 public void setPrimaryItem(ViewGroup container, int position, Object object) {
   for (MySubscriber p : mSubscribers) {
     if (p == object) {
       if (!p.getSubscribeToVideo()) {
         p.setSubscribeToVideo(true);
       }
     } else {
       if (p.getSubscribeToVideo()) {
         p.setSubscribeToVideo(false);
       }
     }
   }
 }
コード例 #2
0
  @Override
  protected void onStreamReceived(Stream stream) {
    MySubscriber p = new MySubscriber(mContext, stream);

    // we can use connection data to obtain each user id
    p.setUserId(stream.getConnection().getData());

    // Subscribe audio only if we have more than one player
    if (mSubscribers.size() != 0) {
      p.setSubscribeToVideo(false);
    }

    // Subscribe to this player
    this.subscribe(p);

    mSubscribers.add(p);
    mSubscriberStream.put(stream, p);
    mSubscriberConnection.put(stream.getConnection().getConnectionId(), p);
    mPagerAdapter.notifyDataSetChanged();

    presentText("\n" + p.getName() + " has joined the chat");
  }