|
|
|
@ -9,6 +9,7 @@ import android.graphics.BitmapFactory |
|
|
|
|
import android.media.AudioFocusRequest |
|
|
|
|
import android.media.AudioManager |
|
|
|
|
import android.media.MediaPlayer |
|
|
|
|
import android.os.Build |
|
|
|
|
import android.os.Handler |
|
|
|
|
import android.support.v4.media.session.MediaSessionCompat |
|
|
|
|
import android.support.v4.media.session.PlaybackStateCompat |
|
|
|
@ -159,6 +160,17 @@ class AudioPlayService : BaseService(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun changeplayerSpeed(speed: Float) { |
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
|
if (mediaPlayer.isPlaying) { |
|
|
|
|
mediaPlayer.playbackParams = mediaPlayer.playbackParams.setSpeed(speed) |
|
|
|
|
} else { |
|
|
|
|
mediaPlayer.playbackParams = mediaPlayer.playbackParams.setSpeed(speed) |
|
|
|
|
mediaPlayer.pause() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 加载完成 |
|
|
|
|
*/ |
|
|
|
|