GithubHelp home page GithubHelp logo

recorder's Introduction

音频录制和播放插件

安装

eeui plugin install https://github.com/mrz9/recorder

卸载

eeui plugin uninstall https://github.com/mrz9/recorder

引用

const audio = app.requireModule("aochuangRecorder");

start(options, callback) 开始录音

参数

  1. options (Object)

    • channel (String) (stereomono, default: stereo)

    • quality (String) (low [8000Hz, 8bit] | standard [22050Hz, 16bit] | high [44100Hz, 16bit], default: standard)

  2. [callback] (Function)

示例

recorder.start({
    channel: `mono`
}, () => {
    console.log('started')
})

stop(callback) 暂停录音

参数

  1. [callback] (Function)

示例

recorder.stop()
recorder.stop(() => {
    console.log('stop')
})

finish(callback) 结束录音

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • path (String) 录音文件地址
    • duraction (Number) 录音时长秒数

示例

recorder.finish((ret) => {
    console.log(ret.path)
})

format: 返回amr格式文件


播放音频

/**
 * @param url    音频地址
 * @param mode   声音播放源 0: 外放 1: 听筒
 * @param ret    [`callback`] (Function)
 */
audio.play(url, mode, ret=> {

})

返回

  1. ret (Object)
    • messaage (String) 播放状态 start, completion
    • code (Number) 状态码

stopPlay(callback) 停止播放

audio.stopPlay()

audio.stopPlay(()=>{
    
})

recorder's People

Contributors

dayao2525 avatar

Watchers

James Cloos avatar 张小俊 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.