Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Small Program API Video Decoder VideoDecoder instance


May 19, 2021 WeChat Mini Program Development Document


Table of contents


VideoDecoder

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

It can be created via wx.createVideoDecode r.

VideoDecoder video decoder, you can do video decoding related operations, frame by frame to obtain decoding data



Method:

Object VideoDecoder.getFrameData()

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Gets the decoding data for the next frame

Returns a value

Object

Video frame data, if not taken, returns null. Data may not be paused when the buffer is empty.

Property Type Description
width number Frame data width
height number Frame data height
data ArrayBuffer Frame data
pkPts number Frame original pts
pkDts number Frame original dts


VideoDecoder.off(string eventName, function callback)

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Cancel listening for recording events. When the corresponding event is triggered, the callback function is no longer executed

Parameters

string eventName

The name of the event

function callback

The callback function that is executed when the event is triggered


VideoDecoder.on(string eventName, function callback)

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Register the callback function that listens for recording events. When the corresponding event is triggered, the callback function is executed

Parameters

string eventName

The name of the event

The legal value of eventName

Value Description The lowest version
start Start the event. Back to s width, height
stop End the event.
seek Seek completes the event.
bufferchange Buffer change event.
ended Decode the end event.

function callback

The callback function that is executed when the event is triggered


VideoDecoder.remove()

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Remove the decoder


VideoDecoder.seek(number position)

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Jump to a point in time to decode

Parameters

number position

The decoding position of the jump, in ms


VideoDecoder.start(Object object)

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Start decoding

Parameters

Object object

Property Type The default Required Description
source string Is Video source files that need to be decoded only support local paths
mode number 1 Whether Decoding mode. 0: Decode by pts;1: Decode as fast as possible


VideoDecoder.stop()

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Stop decoding