mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
pause when unplugging headphones
This commit is contained in:
parent
147d2151a0
commit
d354c2b3cc
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user