Class ZegoVideoCaptureClient

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()  
      android.graphics.SurfaceTexture getSurfaceTexture()  
      void onByteBufferFrameCaptured​(byte[] data, int size, ZegoVideoCaptureDevice.VideoCaptureFormat frame_format, long reference_time, int reference_time_scale)  
      void onByteBufferFrameCaptured​(java.nio.ByteBuffer data, int size, ZegoVideoCaptureDevice.VideoCaptureFormat frame_format, long reference_time, int reference_time_scale)  
      void onEncodedFrameCaptured​(java.nio.ByteBuffer data, int size, ZegoVideoCaptureDevice.VideoCodecConfig config, boolean is_key_frame, double reference_time_ms)
      通知SDK采集到编码数据,SDK会切换到内部线程进行发送。
      void onTakeSnapshot​(android.graphics.Bitmap image)  
      void onTextureCaptured​(int texture_id, int width, int height, double reference_time_ms)  
      void resetTextureContext()
      当纹理相关的上下文 (例如 EglContext) 发生变化时,可以调用此函数来清除 SDK 缓存的上下文状态 注意必须和 onTextureCaptured 在同一个线程调用,不保证线程安全
      void setFillMode​(int mode)
      设置填充模式
      void setFlipMode​(int mode)
      设置翻转模式 supportBufferType为PIXEL_BUFFER_TYPE_GL_TEXTURE_2D 时才有效 默认值 ZegoVideoFlipMode.Vertical,如果不需要,设置为None
      void setRotation​(int rotation)
      设置旋转角度, 用于修正图像的角度; supportBufferType 为 PIXEL_BUFFER_TYPE_GL_TEXTURE_2D 或 PIXEL_BUFFER_TYPE_GL_TEXTURE_EXTERNAL_OES 时才有效。
      void setStatusReason​(boolean is_closed, int reason)
      通知SDK设备状态信息。 DeviceErrorReason.Disabled/DeviceErrorReason.Mute是不能设置的,Disabled通过enableCamera触发的,Mute通过muteVideoPublish触发 初始化外部采集后默认设备状态是好的,用户需要在外部采集通知StartCapture后补一个初始状态,如果前后原因都是属于设备关闭,那么引擎只会通知第一个原因
      void setTextureResolution​(int width, int height)
      同步纹理的宽高
      void setTransformMatrix​(float[] matrix)
      设置变换矩阵; supportBufferType 为 PIXEL_BUFFER_TYPE_GL_TEXTURE_2D 或 PIXEL_BUFFER_TYPE_GL_TEXTURE_EXTERNAL_OES 时才有效。
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZegoVideoCaptureClient

        public ZegoVideoCaptureClient()
    • Method Detail

      • onEncodedFrameCaptured

        public void onEncodedFrameCaptured​(java.nio.ByteBuffer data,
                                           int size,
                                           ZegoVideoCaptureDevice.VideoCodecConfig config,
                                           boolean is_key_frame,
                                           double reference_time_ms)
        Description copied from interface: ZegoVideoCaptureDevice.Client
        通知SDK采集到编码数据,SDK会切换到内部线程进行发送。

        注意:推荐每 2S 一个 gop,每个 I 帧必须携带 sps 和 pps,且放在最前面。仅接受 I 帧 和 P 帧,不接受 B 帧

        Specified by:
        onEncodedFrameCaptured in interface ZegoVideoCaptureDevice.Client
        Parameters:
        data - 码流数据,目前只支持 H.264 码流
        size - 码流长度
        config - 码流的信息,参考 ZegoVideoCaptureDevice.VideoCodecConfig
        is_key_frame - 是否为关键帧,建议关键帧间隔在 2S 左右
        reference_time_ms - 采集到该帧的时间戳,单位毫秒,不能超过2^52, 用于音画同步,如果采集实现是摄像头,最好使用系统采集回调的原始时间戳,如果不是,最好是生成该帧的UTC时间戳
      • setStatusReason

        public void setStatusReason​(boolean is_closed,
                                    int reason)
        Description copied from interface: ZegoVideoCaptureDevice.Client
        通知SDK设备状态信息。 DeviceErrorReason.Disabled/DeviceErrorReason.Mute是不能设置的,Disabled通过enableCamera触发的,Mute通过muteVideoPublish触发 初始化外部采集后默认设备状态是好的,用户需要在外部采集通知StartCapture后补一个初始状态,如果前后原因都是属于设备关闭,那么引擎只会通知第一个原因
        Specified by:
        setStatusReason in interface ZegoVideoCaptureDevice.Client
        Parameters:
        is_closed - 当前设备是否处于关闭状态
        reason - 错误原因,参考 com.zego.zegoavkit2.ZegoConstants.DeviceErrorReason
      • setTransformMatrix

        public void setTransformMatrix​(float[] matrix)
        Description copied from interface: ZegoVideoCaptureDevice.Client
        设置变换矩阵; supportBufferType 为 PIXEL_BUFFER_TYPE_GL_TEXTURE_2D 或 PIXEL_BUFFER_TYPE_GL_TEXTURE_EXTERNAL_OES 时才有效。
        Specified by:
        setTransformMatrix in interface ZegoVideoCaptureDevice.Client
        Parameters:
        matrix - 4x4的变换矩阵。可以包含旋转/翻转/缩放,SDK 会先执行变换,再执行其他操作
      • setRotation

        public void setRotation​(int rotation)
        Description copied from interface: ZegoVideoCaptureDevice.Client
        设置旋转角度, 用于修正图像的角度; supportBufferType 为 PIXEL_BUFFER_TYPE_GL_TEXTURE_2D 或 PIXEL_BUFFER_TYPE_GL_TEXTURE_EXTERNAL_OES 时才有效。
        Specified by:
        setRotation in interface ZegoVideoCaptureDevice.Client
        Parameters:
        rotation - 顺时针旋转角度, 角度旋转在矩阵变换后执行,注意不要重复计算 rotation
      • resetTextureContext

        public void resetTextureContext()
        Description copied from interface: ZegoVideoCaptureDevice.Client
        当纹理相关的上下文 (例如 EglContext) 发生变化时,可以调用此函数来清除 SDK 缓存的上下文状态 注意必须和 onTextureCaptured 在同一个线程调用,不保证线程安全
        Specified by:
        resetTextureContext in interface ZegoVideoCaptureDevice.Client
      • setTextureResolution

        public void setTextureResolution​(int width,
                                         int height)
        Description copied from interface: ZegoVideoCaptureDevice.Client
        同步纹理的宽高
        Specified by:
        setTextureResolution in interface ZegoVideoCaptureDevice.Client
        Parameters:
        width - 纹理宽度
        height - 纹理高度 注意该方法为同步接口,为避免造成卡顿,仅当纹理分辨率和编码分辨率不一致时才调用