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; }
public void Resume() { LogSdk.d(TAG, "Resume: on_pause=" + _on_pause); _on_pause = false; for (int i = 0; i < _renders.size(); i++) { RenderViewData d = _renders.valueAt(i); if ((d._video_on && d._user != null) && (!_on_full_mode || (_on_full_mode && d.isFullMode))) { ConferenceCore.instance().receiveParticipantVideoOn(d._user); LogSdk.d(TAG, "resume GLview " + d._view_id + " for user " + d._user); } } }
public void setVideoStateOn(String participant, Boolean on, short state) { Integer view_id = _users.get(participant).getViewId(); if (view_id != null && view_id != -1) { _renders.get(view_id).setVideoStateOn(on, state); LogSdk.d(TAG, "Set video state to " + state + " for participant " + participant); } }
public void moveToFullMode(int viewIdForFullMode) { _on_full_mode = true; for (int i = 0; i < _renders.size(); i++) { RenderViewData d = _renders.valueAt(i); if (d._view_id != viewIdForFullMode) { 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); } d.isFullMode = false; } else { d.isFullMode = true; } } }
public void addGLView(int view_id) { boolean isPreview = (view_id == R.id.myVideoSurface || view_id == R.id.preview_layout_id ? true : false); _renders.put(view_id, new RenderViewData(view_id, isPreview)); LogSdk.d(TAG, "adding GLview " + view_id + " total = " + _renders.size()); if (isPreview) { _users.put("", new VideoParticipant("", "Me", view_id)); } }
public void Pause() { LogSdk.d(TAG, "Pause: on_pause=" + _on_pause); _on_pause = true; for (int i = 0; i < _renders.size(); i++) { RenderViewData d = _renders.valueAt(i); 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); d.updateVideoState(VIDEO_PAUSED_DUE_QOS); // d._render.channel().Disconnect(); // d._render = null; } } }
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; }
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; }
public void updateGLViews(SessionUIPresenter presenter) { // _on_pause = false; for (int i = 0; i < _renders.size(); i++) { RenderViewData d = _renders.valueAt(i); LogSdk.d(TAG, "updating GLview " + d._view_id + " for user " + d._user); GLSurfaceView glview = (GLSurfaceView) presenter.findViewById(d._view_id); if (glview == null) { LogSdk.e(TAG, "NULL GL view!!! " + d._view_id); continue; } try { glview.setEGLContextClientVersion(2); d._render = new VideoRenderer(glview); glview.setRenderer(d._render); glview.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // .RENDERMODE_CONTINUOUSLY); } catch (IllegalStateException e) { } } }
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); }
public void moveToMultiMode(int viewIdForFullMode) { _on_full_mode = false; int numActiveRenders = 0; for (int i = 0; i < _renders.size(); i++) { RenderViewData d = _renders.valueAt(i); if (d._view_id != viewIdForFullMode) { d.isFullMode = false; if (d._video_on && d._user != null) { numActiveRenders++; ConferenceCore.instance().receiveParticipantVideoOn(d._user); LogSdk.d(TAG, "resume GLview " + d._view_id + " for user " + d._user); } } else { numActiveRenders++; } } if (numActiveRenders < ParticipantsManager.MAX_ACTIVE_PARTICIPANTS_IN_CALL && _users.size() > numActiveRenders) { fillEmptyRenders(); } }
public void addGLView(int view_id) { _renders.put(view_id, new RenderViewData(view_id)); LogSdk.d(TAG, "adding GLview " + view_id + " total = " + _renders.size()); }
private void switchParticipantVideoOff(Participant participant) { LogSdk.d(Utils.getOoVooTag(), "turning video off for " + participant.getId()); mConferenceManager.turnParticipantVideoOff(participant.getId(), participant.getDisplayName()); }