@SuppressWarnings("deprecation") private void attachVideoPreview() { // Video stuff if(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.USE_VIDEO)) { if(cameraPreview == null) { Log.d(THIS_FILE, "Create Local Renderer"); cameraPreview = ViERenderer.CreateLocalRenderer(this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(256, 256); //lp.leftMargin = 2; //lp.topMargin= 4; lp.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); cameraPreview.setVisibility(View.GONE); mainFrame.addView(cameraPreview, lp); }else { Log.d(THIS_FILE, "NO NEED TO Create Local Renderer"); } if(videoWakeLock == null) { videoWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "com.csipsimple.videoCall"); videoWakeLock.setReferenceCounted(false); } } if(videoWakeLock != null && videoWakeLock.isHeld()) { videoWakeLock.release(); } }
public void DisplayBuyerLocalSurfaceView() { // Create a RelativeLayout container that will hold a SurfaceView, // and set it as the content of our activity. SurfaceView localView = ViERenderer.CreateLocalRenderer(getActivity()); // localView.setLayoutParams(layoutParams); ViewGroup vgLocal = getView().getLocalCameraView(); localView.setZOrderOnTop(true); vgLocal.removeAllViews(); vgLocal.setBackgroundColor(getActivity().getResources().getColor( android.R.color.white)); vgLocal.addView(localView); // vgLocal.setVisibility(View.GONE); }
public void DisplaySellerLocalSurfaceView() { // Create a RelativeLayout container that will hold a SurfaceView, // and set it as the content of our activity. getView().getRemoteCameraView().setVisibility(View.GONE); SurfaceView sv = ViERenderer.CreateLocalRenderer(getActivity()); getView().addLocalCameraView(sv); // localView.setLayoutParams(layoutParams); }
public synchronized void setCallState(SipCallSession aCallInfo) { callInfo = aCallInfo; if (callInfo == null) { updateElapsedTimer(); cachedInvState = SipCallSession.InvState.INVALID; cachedMediaState = MediaState.ERROR; cachedCanRecord = false; cachedIsRecording = false; cachedIsHold = false; cachedVideo = false; cachedZrtpActive = false; cachedZrtpVerified = false; return; } Log.d(THIS_FILE, "Set call state : " + callInfo.getCallState()); updateRemoteName(); updateCallStateBar(); updateQuickActions(); updateElapsedTimer(); cachedInvState = callInfo.getCallState(); cachedMediaState = callInfo.getMediaStatus(); cachedCanRecord = callInfo.canRecord(); cachedIsRecording = callInfo.isRecording(); cachedIsHold = callInfo.isLocalHeld(); cachedVideo = callInfo.mediaHasVideo(); cachedZrtpActive = callInfo.getHasZrtp(); cachedZrtpVerified = callInfo.isZrtpSASVerified(); // VIDEO STUFF -- EXPERIMENTAL if(canVideo) { if (callInfo.getCallId() >= 0 && cachedVideo) { if (renderView == null) { renderView = ViERenderer.CreateRenderer(getContext(), true); photo.setVisibility(View.GONE); RelativeLayout container = (RelativeLayout) findViewById(R.id.call_card_container); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_LEFT, RelativeLayout.TRUE); lp.addRule(RelativeLayout.ALIGN_RIGHT, RelativeLayout.TRUE); lp.addRule(RelativeLayout.ALIGN_TOP, RelativeLayout.TRUE); lp.addRule(RelativeLayout.ABOVE, R.id.call_action_bar); renderView.setLayoutParams(lp); container.addView(renderView, 0); Log.d(THIS_FILE, "Render window added"); SipService.setVideoWindow(callInfo.getCallId(), renderView, false); View v = findViewById(R.id.end_call_bar); ViewGroup.LayoutParams lp2 = v.getLayoutParams(); lp2.height = ViewGroup.LayoutParams.WRAP_CONTENT; v.setLayoutParams(lp2); } hasVideo = true; }else { if(renderView != null) { renderView.setVisibility(View.GONE); photo.setVisibility(View.VISIBLE); } hasVideo = false; } } if (onTriggerListener != null) { onTriggerListener.onDisplayVideo(hasVideo && canVideo); } // End of video stuff //requestLayout(); /* if(dragListener != null) { dragListener.setCallState(callInfo); } */ }