GithubHelp home page GithubHelp logo

voicemanager's Introduction

VoiceManager

1.实现录音功能,提供暂停、继续切换,并且监听音量大小以波浪线呈现出现

2.实现播放功能,播放实现帧动画

用法:  

    1.录音  

  VoiceManage mVoiceManage  =VoiceManager.getInstance(mContext);
  
  mVoiceManage.pauseOrStartVoiceRecord();//暂停或继续
 
  mVoiceManage.stopVoiceRecord();//完成录音
  
  mVoiceManage.setVoiceRecordListener(new VoiceManager.VoiceRecordCallBack() {
        @Override
        public void recDoing(long time, String strTime) {
            mRecordHintTv.setText(strTime);
        }

        @Override
        public void recVoiceGrade(int grade) {
            voicLine.setVolume(grade);
        }

        @Override
        public void recStart(boolean init) {
            mIvPauseContinue.setImageResource(R.drawable.icon_pause);
            voicLine.setContinue();
        }

        @Override
        public void recPause(String str) {
            mIvPauseContinue.setImageResource(R.drawable.icon_continue);
            voicLine.setPause();
        }


        @Override
        public void recFinish(long length, String strLength, String path) {
            if (enRecordVoiceListener != null) {
                enRecordVoiceListener.onFinishRecord(length, strLength, path);
            }
        }
    });

2.播放
VoiceManage mVoiceManage  =VoiceManager.getInstance(mContext);
mVoiceManage.setVoicePlayListener(new VoiceManager.VoicePlayCallBack() {
                    @Override
                    public void voiceTotalLength(long time, String strTime) {

                    }

                    @Override
                    public void playDoing(long time, String strTime) {


                    }

                    @Override
                    public void playPause() {

                    }

                    @Override
                    public void playStart() {

                    }

                    @Override
                    public void playFinish() {
                        if (voiceAnimation != null) {
                            voiceAnimation.stop();
                            voiceAnimation.selectDrawable(0);
                        }
                    }
                });
    mVoiceManage.startPlay(voice.getFilePath());

     

License

The MIT License (MIT)

Copyright (c) 2017 jaydenxiao2016

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

voicemanager's People

Contributors

jaydenxiao2016 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

voicemanager's Issues

录音后无法保存成功,看不到录音列表

12-04 11:09:17.974 25305-25305/com.jaydenxiao.voicemanager V/AudioManager: playSoundEffect effectType: 0
12-04 11:09:17.974 25305-25305/com.jaydenxiao.voicemanager V/AudioManager: querySoundEffectsEnabled...
12-04 11:09:17.974 25305-25305/com.jaydenxiao.voicemanager I/MediaRecorder: stop
12-04 11:09:17.974 25305-25305/com.jaydenxiao.voicemanager E/MediaRecorder: stop called in an invalid state: 0
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: java.io.FileNotFoundException: /storage/emulated/0/VoiceManager/audio/20171204-110913.amr (No such file or directory)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at java.io.FileInputStream.open(Native Method)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at java.io.FileInputStream.(FileInputStream.java:146)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.jaydenxiao.voicemanager.VoiceManager.getOutputVoiceFile(VoiceManager.java:319)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.jaydenxiao.voicemanager.VoiceManager.stopVoiceRecord(VoiceManager.java:200)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.jaydenxiao.voicemanager.RecordVoiceButton$2.onClick(RecordVoiceButton.java:86)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.view.View.performClick(View.java:5646)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.view.View$PerformClick.run(View.java:22459)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.os.Handler.handleCallback(Handler.java:761)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.os.Looper.loop(Looper.java:156)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6523)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at java.lang.reflect.Method.invoke(Native Method)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
12-04 11:09:17.976 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileOutputStream.close()' on a null object reference
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.jaydenxiao.voicemanager.VoiceManager.getOutputVoiceFile(VoiceManager.java:343)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.jaydenxiao.voicemanager.VoiceManager.stopVoiceRecord(VoiceManager.java:200)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.jaydenxiao.voicemanager.RecordVoiceButton$2.onClick(RecordVoiceButton.java:86)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.view.View.performClick(View.java:5646)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.view.View$PerformClick.run(View.java:22459)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.os.Handler.handleCallback(Handler.java:761)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.os.Looper.loop(Looper.java:156)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6523)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at java.lang.reflect.Method.invoke(Native Method)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
12-04 11:09:17.978 25305-25305/com.jaydenxiao.voicemanager W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

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.