Skip to content

window_rect

Su, Jia edited this page Dec 12, 2017 · 4 revisions

连麦窗口大小设置

默认模式

两人视频连麦时,demo默认为大小窗口的形式展示画面。
其中,大窗口为GLSurfaceView的大小。

  1. 小窗口的位置和大小可以通过以下方法设置
   /**
   * the sub screen position
   * must be set before registerRTC
   *
   * @param width  width for frame from this pin to show, should be 0~1, default value 0.35f
   * @param height height for frame from this pin to show, should be 0~1, default value 0.3f
   * @param left   left position for left top of frame from this pin, should be 0~1, default value 0.65f
   * @param top    top position for left top of frame from this pin, should be 0~1, defualt value 0.f
   * @param mode   scaling mode
   */
  public void setRTCSubScreenRect(float left, float top, float width, float height, int mode)
  1. camera窗口的尺寸和位置可以通过以下方法设置
  /**
   * set camera screen rect when rtc connected
   * @param left left position for left top of frame from this pin, should be 0~1, default value 0.f
   * @param top top position for left top of frame from this pin, should be 0~1, default value 0.f
   * @param width width for frame from this pin to show, should be 0~1, default value 1.f
   * @param height height for frame from this pin to show, should be 0~1, default value 1.f
   * @param mode scaling mode
   */
  public void setRTCMainScreenRect(float left, float top, float width, float height, int mode)
  1. 通过以下方法可以设置大窗口显示的图像内容
  //大窗口为camera图像
  public static final int RTC_MAIN_SCREEN_CAMERA = 1;
  //大窗口为连麦图像
  public static final int RTC_MAIN_SCREEN_REMOTE = 2;

    /**
   * set rtc main Screen
   *
   * @param mainScreenType
   */
  public void setRTCMainScreen(int mainScreenType)

demo中连麦窗口融合方法说明

  1. 图像融合方法
    连麦时本地和remote图像使用金山推流SDK的ImgTexMixer进行融合,显示(预览)在一个GLSurfaceView内。

    ImgTexMixer在使用时需要注意的是:

    • The mixer operation occurred while the frame with main index number arrived
    • Has maximum getSinkPinNum() input pins
    • the lower sink pin index number means the lower frame z order, that is, the higher sink pin index frame shown in top of lower ones
  2. 修改camera窗口的位置及大小

    //mImgTexMixer融合后数据送去编码
    mImgTexMixer.setRenderRect(mIdxCamera, top, left, width, height, 1.0f);
    //mImgTexPreviewMixer融合后数据用于预览
    mImgTexPreviewMixer.setRenderRect(mIdxCamera, top, left, width, height, 1.0f);
3. 修改连麦窗口的位置及大小  
      ```java
      //mImgTexMixer融合后数据送去编码
      mImgTexMixer.setRenderRect(mIdxVideoSub, top, left, width, height, 1.0f);
      //mImgTexPreviewMixer融合后数据用于预览
      mImgTexPreviewMixer.setRenderRect(mIdxVideoSub, top, left, width, height, 1.0f);
  ```