【发布时间】:2017-07-22 18:59:34
【问题描述】:
我正在使用 ionic cordova 媒体插件来录制来自用户手机的音频。录制完成后,我可以播放文件,一切都很好。我只想获取文件的持续时间,当我播放录制的文件时,我想显示正在播放的文件的分钟::秒。我怎么做?
record_audio(){
this.file.startRecord();
this.recording = true;
/*
let record_opt: CaptureAudioOptions = { limit: 1 };
this.mediacapture.captureAudio(record_opt).then(
(data: MediaFile[]) => alert('audio recorded'),
(err: CaptureError)=> alert('cannot record')
);
*/
}
cancel_record(){
this.file.release();
this.show_record_div = false;
this.recordedfile_available = false;
}
stop_recording(){
this.file.stopRecord();
this.recording = false;
this.recordedfile_available = true;
//this.filelength = this.file.getDuration();
}
play_recorded(){
this.file.play();
}
stop_playing(){
this.file.stop();
}
【问题讨论】:
标签: audio ionic-framework media