# 媒体

# Api域:

const native = kreator.native;

# native.requestMicroPhone(options)

获取麦克风权限。

参数名 类型 描述
options NativeApiBaseRequest 入参类型

# 返回值

Boolean 是否有使用麦克风权限

native.requestMicroPhone().then(res=>{
    console.warn(res)
});

# native.startRecorder(options)

调用麦克风与声卡开始录音。

参数名 类型 描述
options NativeApiBaseRequest 入参类型

# 返回值

native.startRecorder().then((res) => {
    console.log(res);
    alert(res);
});                    

# native.stopRecorder(options)

停止录音并返回录音文件路径。

参数名 类型 描述
options NativeApiBaseRequest 入参类型

# 返回值

string 录音文件路径


native.stopRecorder().then((res) => {
    console.log(res);
    alert(res);
    const recordFilePath = res;
});