Updated on 2024-07-30 GMT+08:00

Pushing Video Streams Using a Third Party

API Description

In the custom video stream collection scenario, after data streams are collected, you can call this API to push streams using a third party.

Precautions

Call this API during a meeting or call.

Method Definition

1
2
3
4
5
6
    /**
     * Pushes streams collected by a third party.
     * @param videoFrameParam Indicates the videoFrameParam object.
     * @param callback Indicates the result callback.
     */
    void pushExternalVideoFrame(VideoFrameParam videoFrameParam, HwmCallback<Void> callback);

Parameter Description

Table 1 Parameters

Parameter

Mandatory

Type

Description

videoFrameParam

No

VideoFrameParam

videoFrameParam object.

callback

No

HwmCallback

Result callback.

Return Values

None

Parameter Extension

Table 2 VideoFrameParam parameters

Parameter

Mandatory

Type

Description

frameDate

Yes

byte[]

Video data.

frameWidth

Yes

int

Image width. When it is used as an input parameter, the value must be an integral multiple of 4, ranging from 90 to 1920.

frameHeight

Yes

int

Image height. When it is used as an input parameter, the value must be an integral multiple of 2, ranging from 90 to 1200.

videoFrameFormat

Yes

VideoFrameFormat

Image format. The format used by the current demo is VIDEO_FRAME_FORMAT_NV21. After conversion, the image format must be set to 105.

VIDEO_FRAME_FORMAT_I420(100, "I420")

VIDEO_FRAME_FORMAT_YV12(101, "YV12")

VIDEO_FRAME_FORMAT_NV21(105, "NV21")

VIDEO_FRAME_FORMAT_UNKNOWN(999, "UNKNOWN")

displayRotation

Yes

DisplayRotation

Video display angle.

ROTATION_0(0, "0 degree clockwise rotation")

ROTATION_90(1,"90 degree clockwise rotation")

ROTATION_180(2, "180 degree clockwise rotation")

ROTATION_270(3, "270 degree clockwise rotation")

Sample Code
ExternalVideoFrameParam videoFrameParam = new ExternalVideoFrameParam();
videoFrameParam.setFrameDate(mData);
videoFrameParam.setFrameWidth(1920);
videoFrameParam.setFrameHeight(1080);
videoFrameParam.setDisplayRotation(DisplayRotation.ROTATION_0);
videoFrameParam.setVideoFrameFormat(VideoFrameFormat.VIDEO_FRAME_FORMAT_NV21);
HWMBizSdk.getBizOpenApi().pushExternalVideoFrame(videoFrameParam, new HwmCallback<Void>() {
    @Override
    public void onSuccess(Void aVoid) {

    }

    @Override
    public void onFailed(int retCode, String desc) {
        Log.i(TAG, "code: " + retCode);
    }
});