MediaContainer
Create an audio/video processing container, which can eventually be used to combine the tracks in the container into a single video.
Methods
addTrack
Adding an audio or video track to a container.
(track: MediaTrack) => void
| Property | Type | Description |
|---|---|---|
| track | MediaTrack | Audio or video track to be added |
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| MediaContainer.addTrack | ✔️ |
destroy
Destroy the container and release the resources
() => void
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| MediaContainer.destroy | ✔️ |
export
Merge the tracks in the container and export the video file
() => void
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| MediaContainer.export | ✔️ |
extractDataSource
Separates tracks from the incoming video source. Does not automatically add tracks to the container to be composited.
(option: ExtractDataSourceOption) => void
| Property | Type |
|---|---|
| option | ExtractDataSourceOption |
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| MediaContainer.extractDataSource | ✔️ |
removeTrack
Remove the audio or video track from the container.
(track: MediaTrack) => void
| Property | Type | Description |
|---|---|---|
| track | MediaTrack | Audio or video track to be removed |
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| MediaContainer.removeTrack | ✔️ |
Parameters
ExtractDataSourceOption
| Property | Type | Description |
|---|---|---|
| source | string | Video source address, local file support only |
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| MediaContainer.addTrack | ✔️ | ||
| MediaContainer.destroy | ✔️ | ||
| MediaContainer.export | ✔️ | ||
| MediaContainer.extractDataSource | ✔️ | ||
| MediaContainer.removeTrack | ✔️ |