使用范围:UI2
Contents
class Voice ($UI/system/api/native/voice)
音频接口
var voice = require('$UI/system/api/native/voice'); voice.startRecord({ cancel : function() { alert('用户拒绝授权录音'); }, }); voice.stopRecord({ success : function(res) { voices.localId = res.localId; }, fail : function(res) { alert(JSON.stringify(res)); } });
Constructor Top
Voice () |
Static Methods Top
void | downloadVoice (Object options) | |
void | onVoicePlayEnd (Object options) | |
void | onVoiceRecordEnd (Object options) | |
void | pauseVoice (Object options) | |
void | playVoice (Object options) | |
void | startRecord (Object options) | |
void | stopRecord (Object options) | |
void | stopVoice (Object options) | |
void | uploadVoice (Object options) |
Constructor details
Top
public
Voice
()
音频接口
var voice = require('$UI/system/api/native/voice');
voice.startRecord({
cancel : function() {
alert('用户拒绝授权录音');
},
});
voice.stopRecord({
success : function(res) {
voices.localId = res.localId;
},
fail : function(res) {
alert(JSON.stringify(res));
}
});
public
Voice
()
音频接口
var voice = require('$UI/system/api/native/voice'); voice.startRecord({ cancel : function() { alert('用户拒绝授权录音'); }, }); voice.stopRecord({ success : function(res) { voices.localId = res.localId; }, fail : function(res) { alert(JSON.stringify(res)); } });
Static Methods Detail Top
static
public
void
downloadVoice
(Object options)
下载到本地
static
public
void
onVoicePlayEnd
(Object options)
播放结束监听
static
public
void
onVoiceRecordEnd
(Object options)
录制自动停止监听
static
public
void
pauseVoice
(Object options)
暂停播放
static
public
void
playVoice
(Object options)
播放录音
static
public
void
startRecord
(Object options)
开始录音
static
public
void
stopRecord
(Object options)
结束录音
static
public
void
stopVoice
(Object options)
停止播放音频
static
public
void
uploadVoice
(Object options)
上传音频到服务器(默认使用baas服务)