Giter Club home page Giter Club logo

musicdemo's Introduction

MusicDemo

主界面

音乐播放界面

简单记录路上的bug

1、当音乐进行切换的时候,如果音乐处于播放状态会崩

MediaPlayerHelp.java

public void setPath(String path){
        /**
         * 1、音乐正常播放,重置播放
         * 2、设置播放音乐路径
         * 3、准备播放
         */

        mPath = path;
        /**
         * (错误逻辑!)当音乐进行切换的时候,如果音乐处于播放状态,
         * 那么我们就去重置音乐的状态,而如果 音乐没有处于播放状态的话(暂停),那么就不去重置播放状态
         *
         */

        if (mMeidaPlayer.isPlaying()){
            mMeidaPlayer.reset();
        }
//        2、设置播放音乐路径
        try {
            mMeidaPlayer.setDataSource(mContext, Uri.parse(path));
        } catch (IOException e) {
            e.printStackTrace();
        }

//        3、准备播放
        mMeidaPlayer.prepareAsync();
        mMeidaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                if (onMediaPlayerHelperListener != null){
                    onMediaPlayerHelperListener.onPrepared(mediaPlayer);
                }
            }
        });
    }

2、如果手机 Realm数据库中存在旧数据,并且登陆时候显示的是旧数据,则需要退出账号再重试。理应进入的时候,直接更新

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.