org.webrtc.RendererCommon.ScalingType Java Examples

The following examples show how to use org.webrtc.RendererCommon.ScalingType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CallActivity.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
private void updateVideoView() {
    remoteRenderLayout.setPosition(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIGHT);
    remoteRender.setScalingType(scalingType);
    remoteRender.setMirror(false);

    if (iceConnected) {
        localRenderLayout.setPosition(
                LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED);
        localRender.setScalingType(ScalingType.SCALE_ASPECT_FIT);
    } else {
        localRenderLayout.setPosition(
                LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING);
        localRender.setScalingType(scalingType);
    }
    localRender.setMirror(true);

    localRender.requestLayout();
    remoteRender.requestLayout();
}
 
Example #2
Source File: RCConnection.java    From restcomm-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initializeVideo(boolean videoEnabled, PercentFrameLayout localRenderLayout, PercentFrameLayout remoteRenderLayout)
{
   if (localRenderLayout == null ||remoteRenderLayout == null) {
      return;
   }

   scalingType = ScalingType.SCALE_ASPECT_FILL;

   this.localRenderLayout = localRenderLayout;
   this.remoteRenderLayout = remoteRenderLayout;

   localRender = (SurfaceViewRenderer)localRenderLayout.getChildAt(0);
   remoteRender = (SurfaceViewRenderer)remoteRenderLayout.getChildAt(0);

   localRender.init(peerConnectionClient.getRenderContext(), null);
   localRender.setZOrderMediaOverlay(true);
   remoteRender.init(peerConnectionClient.getRenderContext(), null);
   updateVideoView(VideoViewState.NONE);
}
 
Example #3
Source File: CallActivity.java    From Yahala-Messenger with MIT License 4 votes vote down vote up
@Override
public void onVideoScalingSwitch(ScalingType scalingType) {
    this.scalingType = scalingType;
    updateVideoView();
}
 
Example #4
Source File: RCConnection.java    From restcomm-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
private void updateVideoView(VideoViewState state)
{
   RCLogger.i(TAG, "updateVideoView(), state: " + state);
   // only if both local and remote views for video have been provided do we want to go ahead
   // and update the video views
   if (this.localRenderLayout == null && this.remoteRenderLayout == null) {
      return;
   }

   if (state == VideoViewState.NONE) {
      // when call starts both local and remote video views should be hidden
      localRender.setVisibility(View.INVISIBLE);
      remoteRender.setVisibility(View.INVISIBLE);
   }
   else if (state == VideoViewState.LOCAL_VIEW_RECEIVED) {
      // local video became available, which also means that local user has previously requested a video call,
      // hence we need to show local video view
      localRender.setVisibility(View.VISIBLE);

      localRenderLayout.setPosition(
            LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING);
      localRender.setScalingType(scalingType);
      localRender.setMirror(true);
      localRender.requestLayout();
   }
   else if (state == VideoViewState.REMOTE_VIEW_RECEIVED) {
      // remote video became available, which also means that remote user has requested a video call,
      // hence we need to show remote video view
      //remoteRender.setVisibility(View.VISIBLE);
   }
   else if (state == VideoViewState.ICE_CONNECTED) {
      if (remoteVideoReceived && localMediaType == ConnectionMediaType.AUDIO_VIDEO) {
         remoteRender.setVisibility(View.VISIBLE);

         remoteRenderLayout.setPosition(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIGHT);
         remoteRender.setScalingType(scalingType);
         remoteRender.setMirror(false);

         if (this.callParams.containsKey(ParameterKeys.CONNECTION_VIDEO_ENABLED) &&
               ((Boolean) this.callParams.get(ParameterKeys.CONNECTION_VIDEO_ENABLED)) &&
               localRender.getVisibility() != View.VISIBLE) {
            localRender.setVisibility(View.VISIBLE);
         }
         localRenderLayout.setPosition(
               LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED);
         localRender.setScalingType(ScalingType.SCALE_ASPECT_FIT);
         localRender.setMirror(true);

         localRender.requestLayout();
         remoteRender.requestLayout();
      }
   }
}
 
Example #5
Source File: CallFragment.java    From Yahala-Messenger with MIT License votes vote down vote up
public void onVideoScalingSwitch(ScalingType scalingType);