コード例 #1
0
  public boolean turnVideoOn(String sParticipantId, VideoChannelPtr in) {
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "turnVideoOn: Participant " + sParticipantId + " not found");
      return false;
    }

    RenderViewData d = null;
    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.d(TAG, "Participant " + sParticipantId + " is not connected to any GLView");
      d = getFreeRender();
      if (d != null) _users.get(sParticipantId).setViewId(d._view_id);

    } else {
      d = _renders.get(view_id);
    }

    if (d != null) {
      d._render.connect(in, sParticipantId);
      d._video_on = true;
      d._user = sParticipantId;
      LogSdk.d(TAG, "video is ON for " + sParticipantId + " GLView " + d._view_id);
      return true;
    } else {
      LogSdk.w(TAG, "No available GVView found for Participant " + sParticipantId);
    }
    return false;
  }
コード例 #2
0
 public int prepareParticipantAsActiveRender(String sParticipantId) {
   int numActiveRenders = getActiveRenders();
   LogSdk.i(Utils.getOoVooTag(), "Active renders = " + numActiveRenders);
   if ((!_on_full_mode
       && numActiveRenders < ParticipantsManager.MAX_ACTIVE_PARTICIPANTS_IN_CALL)) {
     LogSdk.i(Utils.getOoVooTag(), "Add joined user to active renders " + sParticipantId);
     RenderViewData d = getFreeRender();
     if (d != null) {
       _users.get(sParticipantId).setViewId(d._view_id);
       LogSdk.i(
           Utils.getOoVooTag(), "Add free render for " + sParticipantId + " as " + d._view_id);
       d._video_on = false;
       d._user = sParticipantId;
       return d._view_id;
     } else {
       LogSdk.i(
           Utils.getOoVooTag(), "No available GLView found for Participant " + sParticipantId);
     }
   } else {
     LogSdk.i(
         Utils.getOoVooTag(),
         "ConferenceManager.OnParticipantJoinedSession - can't add user to active surfaces");
   }
   return -1;
 }
コード例 #3
0
 private void fillEmptyRenders() {
   for (Map.Entry<String, VideoParticipant> e : _users.entrySet()) {
     VideoParticipant participant = e.getValue();
     if (participant.getViewId() == -1) {
       RenderViewData d = getFreeRender();
       if (d != null) {
         participant.setViewId(d._view_id);
         LogSdk.i(
             Utils.getOoVooTag(),
             "Add free render for " + participant._participantId + " as " + d._view_id);
         d._video_on = true;
         d._user = participant.getParticipantId();
         ConferenceCore.instance().receiveParticipantVideoOn(participant.getParticipantId());
       } else {
         break;
       }
     }
   }
 }
コード例 #4
0
  public void turnVideoOff(String sParticipantId) {
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "Participant " + sParticipantId + " not found");
      return;
    }

    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.w(TAG, "No GLview found for participant " + sParticipantId);
      return;
    }

    RenderViewData d = _renders.get(view_id);
    if (d != null) {
      if (d._render != null) d._render.disconnect();
      if (!_on_pause && !_on_full_mode) {
        d._video_on = false;
        d._user = null;
      }
      LogSdk.d(TAG, "video is OFF for " + sParticipantId);
    } else LogSdk.w(TAG, "turnVideoOff: No GVView found for Participant " + sParticipantId);
  }
コード例 #5
0
  public boolean removeParticipant(String sParticipantId) {
    boolean updateFullMode = false;
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "remove Participant failed! Participant " + sParticipantId + " not found");
      return updateFullMode;
    }
    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.d(TAG, "Participant " + sParticipantId + " is not connected to any GLView");
    } else {
      RenderViewData d = _renders.get(view_id);
      updateFullMode = d.isFullMode;
      d._render.disconnect();
      d._video_on = false;
      d._user = null;
    }
    _users.remove(sParticipantId);

    if (updateFullMode) {
      _on_full_mode = true;
      for (int i = 0; i < _renders.size(); i++) {
        RenderViewData d = _renders.valueAt(i);
        if (d._view_id != view_id) {
          String user = getParticipantByViewId(d._view_id);
          LogSdk.d(TAG, "pausing GLview " + d._view_id + " for user " + user);
          if (d._video_on) {
            ConferenceCore.instance().receiveParticipantVideoOff(user);
            LogSdk.d(TAG, "send turn video Off for user " + user);
          }
        } else {
          d.isFullMode = false;
        }
      }
    }
    LogSdk.d(TAG, "remove Participant " + sParticipantId + " GLView " + view_id + " is free.");
    return updateFullMode;
  }
コード例 #6
0
  public boolean removeParticipant(String sParticipantId) {
    boolean updateFullMode = false;
    if (!_users.containsKey(sParticipantId)) {
      LogSdk.e(TAG, "remove Participant failed! Participant " + sParticipantId + " not found");
      return updateFullMode;
    }
    Integer view_id = _users.get(sParticipantId).getViewId();
    if (view_id == -1) {
      LogSdk.d(TAG, "Participant " + sParticipantId + " is not connected to any GLView");
    } else {
      RenderViewData d = _renders.get(view_id);
      updateFullMode = d.isFullMode;
      d.isFullMode = false;
      d._render.disconnect();
      d._video_on = false;
      d._user = null;
    }
    _users.remove(sParticipantId);

    if (updateFullMode) moveToMultiMode(-1);

    LogSdk.d(TAG, "remove Participant " + sParticipantId + " GLView " + view_id + " is free.");
    return updateFullMode;
  }