Code Cleanup
This commit is contained in:
parent
4b4aadcc5b
commit
2791ac49c5
2 changed files with 2 additions and 20 deletions
|
@ -14,14 +14,12 @@
|
||||||
package code.name.monkey.retromusic.service
|
package code.name.monkey.retromusic.service
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||||
import android.media.AudioAttributes
|
import android.media.AudioAttributes
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.media.MediaPlayer.OnCompletionListener
|
import android.media.MediaPlayer.OnCompletionListener
|
||||||
import android.media.PlaybackParams
|
import android.media.PlaybackParams
|
||||||
import android.media.audiofx.AudioEffect
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
@ -55,7 +53,7 @@ class MultiPlayer internal constructor(private val context: Context) : Playback,
|
||||||
private set
|
private set
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path The path of the file, or the http/rtsp URL of the stream you want to play
|
* @param song The song object you want to play
|
||||||
* @return True if the `player` has been prepared and is ready to play, false otherwise
|
* @return True if the `player` has been prepared and is ready to play, false otherwise
|
||||||
*/
|
*/
|
||||||
override fun setDataSource(
|
override fun setDataSource(
|
||||||
|
@ -110,22 +108,6 @@ class MultiPlayer internal constructor(private val context: Context) : Playback,
|
||||||
player.setOnErrorListener(this)
|
player.setOnErrorListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openEqualizerSession() {
|
|
||||||
val intent = Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION)
|
|
||||||
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSessionId)
|
|
||||||
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.packageName)
|
|
||||||
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC)
|
|
||||||
context.sendBroadcast(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun closeEqualizerSession() {
|
|
||||||
val intent = Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION)
|
|
||||||
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSessionId)
|
|
||||||
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.packageName)
|
|
||||||
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC)
|
|
||||||
context.sendBroadcast(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the MediaPlayer to start when this MediaPlayer finishes playback.
|
* Set the MediaPlayer to start when this MediaPlayer finishes playback.
|
||||||
*
|
*
|
||||||
|
|
|
@ -118,7 +118,7 @@ class PlaybackManager(val context: Context) {
|
||||||
closeAudioEffectSession()
|
closeAudioEffectSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openAudioEffectSession() {
|
private fun openAudioEffectSession() {
|
||||||
val intent = Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION)
|
val intent = Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION)
|
||||||
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSessionId)
|
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSessionId)
|
||||||
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.packageName)
|
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.packageName)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue