Skip to main content
版本:v3+

create

API_LEVEL 3.0 开始支持,API 兼容性请参考 API_LEVEL

创建播放器或录制器。

类型

function create(controllerId: typeof id.PLAYER): Player
function create(controllerId: typeof id.RECORDER): Recorder

代码示例

import { codec, create, id } from '@zos/media'

const player = create(id.PLAYER)
player.setSource(player.source.FILE, { file: 'data://music.opus' })
player.prepare()

const recorder = create(id.RECORDER)
recorder.setFormat(codec.OPUS, { target_file: 'data://record.opus' })
recorder.start()
recorder.stop()