# uni.createMediaContainer()

Create an audio and video processing container, and finally combine the tracks in the container into a video and return a MediaContainer object

Platform Difference Description

App H5 微信小程序 支付宝小程序 百度小程序 抖音小程序、飞书小程序 QQ小程序 快手小程序 京东小程序
x x 2.9.0+ x x x x x x

# MediaContainer.addTrack(track)

Add an audio or video track to a container

Parameter Description

Parameters Description
track Audio or video track to add

# MediaContainer.destroy()

Destroy the container and release resources

# MediaContainer.export()

Merge the tracks inside the container and export the video file

# MediaContainer.extractDataSource(object)

Merge the tracks in the container and export the video file, returning a MediaTrack object

Parameter Description

Attribute Type Required Description
source String Yes Video source address, only supports local files

# MediaContainer.removeTrack(track)

Add an audio or video track to a container

Parameter Description

Parameters Description
track Audio or video track to remove

# MediaTrack

Returned by MediaContainer.extractDataSource.

MediaTrack audio or video track, you can perform some operations on the track

Parameter Description

property type description
kind String track type, read only ,audio:audio track;video:video track
duration Number Track length, read only
volume Number Volume, valid under audio track, writable