// Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
//     public static final String MUSIC_TYPE = "MUSIC_TYPE";
//     public static final int TYPE_SINGLE = 0;
//     public static final int TYPE_SINGER = 1;
//     public static final int TYPE_ALBUM = 2;
//     public static final int TYPE_FOLDER = 3;
// 
//     public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
//     public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
// 
//     public static final int DEFAULT_PLAYLIST_POSITION = 0;
//     public static final int TEMP_PLAYLIST_ID = -1;
// 
//     public static final int IMAGE_LOADED = 1;
//     public static final int IMAGE_REQUEST_LOADING = 2;
//     public static final int PLAYLIST_FAVORITE = 0;
// 
//     public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
//     public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
//     public static final int SP_MUSIC_ORDER_DEFAULT = 0;
//     public static final int MUSIC_ORDER_LIST = 0;
//     public static final int MUSIC_ORDER_SINGLE = 2;
//     public static final int MUSIC_ORDER_RANDOM = 1;
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
//     void onTrack(int position);
// 
//     void onNext(MusicBean bean);
// 
//     void onPlayStateChange(boolean isPlay);
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
//     private final String mSinger;
//     private final String mAlbum;
//     private String mPath;
//     private String mName;
//     private long mDuration;
// 
//     protected MusicBean(Parcel in) {
//         mSinger = in.readString();
//         mAlbum = in.readString();
//         mPath = in.readString();
//         mName = in.readString();
//         mDuration = in.readLong();
//     }
// 
//     public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
//         @Override
//         public MusicBean createFromParcel(Parcel in) {
//             return new MusicBean(in);
//         }
// 
//         @Override
//         public MusicBean[] newArray(int size) {
//             return new MusicBean[size];
//         }
//     };
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel parcel, int i) {
// 
//         parcel.writeString(mSinger);
//         parcel.writeString(mAlbum);
//         parcel.writeString(mPath);
//         parcel.writeString(mName);
//         parcel.writeLong(mDuration);
//     }
// 
//     @Override
//     public int hashCode() {
//         return mPath==null?0:mPath.hashCode();
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
//     }
// 
//     public MusicBean(String name, String singer, String album, long duration, String path) {
//         mPath = path;
//         mName = name;
//         mSinger = singer;
//         mAlbum = album;
//         mDuration = duration;
//     }
// 
//     public String getSinger() {
//         return mSinger;
//     }
// 
//     public String getAlbum() {
//         return mAlbum;
//     }
// 
//     public String getPath() {
//         return mPath;
//     }
// 
//     public void setPath(String mPath) {
//         this.mPath = mPath;
//     }
// 
//     public String getName() {
//         return mName;
//     }
// 
//     public void setName(String mName) {
//         this.mName = mName;
//     }
// 
//     public long getDuration() {
//         return mDuration;
//     }
// 
//     public void setDuration(long mDuration) {
//         this.mDuration = mDuration;
//     }
// }


import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
package com.zsorg.neteasecloudmusic.models;





/**
 * Project:NeteaseCloudMusic
 *
 * @Author: piyel_000
 * Created on 2017/1/24.
 * E-mail:piyell@qq.com
 */

public class PlayerManager implements MediaPlayer.OnCompletionListener {

    private static PlayerManager ourInstance;
    private static MediaPlayer mPlayer;
    private final ConfigModel mConfigModel;

// Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
//     public static final String MUSIC_TYPE = "MUSIC_TYPE";
//     public static final int TYPE_SINGLE = 0;
//     public static final int TYPE_SINGER = 1;
//     public static final int TYPE_ALBUM = 2;
//     public static final int TYPE_FOLDER = 3;
// 
//     public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
//     public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
// 
//     public static final int DEFAULT_PLAYLIST_POSITION = 0;
//     public static final int TEMP_PLAYLIST_ID = -1;
// 
//     public static final int IMAGE_LOADED = 1;
//     public static final int IMAGE_REQUEST_LOADING = 2;
//     public static final int PLAYLIST_FAVORITE = 0;
// 
//     public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
//     public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
//     public static final int SP_MUSIC_ORDER_DEFAULT = 0;
//     public static final int MUSIC_ORDER_LIST = 0;
//     public static final int MUSIC_ORDER_SINGLE = 2;
//     public static final int MUSIC_ORDER_RANDOM = 1;
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
//     void onTrack(int position);
// 
//     void onNext(MusicBean bean);
// 
//     void onPlayStateChange(boolean isPlay);
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
//     private final String mSinger;
//     private final String mAlbum;
//     private String mPath;
//     private String mName;
//     private long mDuration;
// 
//     protected MusicBean(Parcel in) {
//         mSinger = in.readString();
//         mAlbum = in.readString();
//         mPath = in.readString();
//         mName = in.readString();
//         mDuration = in.readLong();
//     }
// 
//     public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
//         @Override
//         public MusicBean createFromParcel(Parcel in) {
//             return new MusicBean(in);
//         }
// 
//         @Override
//         public MusicBean[] newArray(int size) {
//             return new MusicBean[size];
//         }
//     };
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel parcel, int i) {
// 
//         parcel.writeString(mSinger);
//         parcel.writeString(mAlbum);
//         parcel.writeString(mPath);
//         parcel.writeString(mName);
//         parcel.writeLong(mDuration);
//     }
// 
//     @Override
//     public int hashCode() {
//         return mPath==null?0:mPath.hashCode();
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
//     }
// 
//     public MusicBean(String name, String singer, String album, long duration, String path) {
//         mPath = path;
//         mName = name;
//         mSinger = singer;
//         mAlbum = album;
//         mDuration = duration;
//     }
// 
//     public String getSinger() {
//         return mSinger;
//     }
// 
//     public String getAlbum() {
//         return mAlbum;
//     }
// 
//     public String getPath() {
//         return mPath;
//     }
// 
//     public void setPath(String mPath) {
//         this.mPath = mPath;
//     }
// 
//     public String getName() {
//         return mName;
//     }
// 
//     public void setName(String mName) {
//         this.mName = mName;
//     }
// 
//     public long getDuration() {
//         return mDuration;
//     }
// 
//     public void setDuration(long mDuration) {
//         this.mDuration = mDuration;
//     }
// }


// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java
import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

package com.zsorg.neteasecloudmusic.models;





/**
 * Project:NeteaseCloudMusic
 *
 * @Author: piyel_000
 * Created on 2017/1/24.
 * E-mail:piyell@qq.com
 */

public class PlayerManager implements MediaPlayer.OnCompletionListener {

    private static PlayerManager ourInstance;
    private static MediaPlayer mPlayer;
    private final ConfigModel mConfigModel;

    private List<MusicBean> mCurrentPlaylist;