mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #1245 from Bnyro/master
Pause when unplugging headphones
This commit is contained in:
commit
1420a8e56f
@ -46,6 +46,7 @@ class OfflinePlayerActivity : BaseActivity() {
|
||||
|
||||
private fun initializePlayer() {
|
||||
player = ExoPlayer.Builder(this)
|
||||
.setHandleAudioBecomingNoisy(true)
|
||||
.build()
|
||||
|
||||
playerView = binding.player
|
||||
|
@ -1315,6 +1315,7 @@ class PlayerFragment : BaseFragment() {
|
||||
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
|
||||
.setLoadControl(loadControl)
|
||||
.setTrackSelector(trackSelector)
|
||||
.setHandleAudioBecomingNoisy(true)
|
||||
.build()
|
||||
|
||||
exoPlayer.setAudioAttributes(audioAttributes, true)
|
||||
|
@ -190,9 +190,10 @@ class BackgroundMode : Service() {
|
||||
|
||||
audioAttributes = AudioAttributes.Builder()
|
||||
.setUsage(C.USAGE_MEDIA)
|
||||
.setContentType(C.CONTENT_TYPE_MUSIC)
|
||||
.setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
|
||||
.build()
|
||||
player = ExoPlayer.Builder(this)
|
||||
.setHandleAudioBecomingNoisy(true)
|
||||
.setAudioAttributes(audioAttributes, true)
|
||||
.build()
|
||||
|
||||
|
@ -227,7 +227,7 @@ internal class CustomExoPlayerView(
|
||||
player?.seekTo((player?.currentPosition ?: 0L) - seekIncrement)
|
||||
|
||||
// show the rewind button
|
||||
doubleTapOverlayBinding?.rewindBTN.run {
|
||||
doubleTapOverlayBinding?.rewindBTN.apply {
|
||||
this!!.visibility = View.VISIBLE
|
||||
// clear previous animation
|
||||
this.animate().rotation(0F).setDuration(0).start()
|
||||
@ -252,9 +252,9 @@ internal class CustomExoPlayerView(
|
||||
|
||||
// show the forward button
|
||||
doubleTapOverlayBinding?.forwardBTN.apply {
|
||||
visibility = View.VISIBLE
|
||||
this!!.visibility = View.VISIBLE
|
||||
// clear previous animation
|
||||
this!!.animate().rotation(0F).setDuration(0).start()
|
||||
this.animate().rotation(0F).setDuration(0).start()
|
||||
// start new animation
|
||||
this.animate()
|
||||
.rotation(30F)
|
||||
|
Loading…
Reference in New Issue
Block a user