mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 14:50: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() {
|
private fun initializePlayer() {
|
||||||
player = ExoPlayer.Builder(this)
|
player = ExoPlayer.Builder(this)
|
||||||
|
.setHandleAudioBecomingNoisy(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
playerView = binding.player
|
playerView = binding.player
|
||||||
|
@ -1315,6 +1315,7 @@ class PlayerFragment : BaseFragment() {
|
|||||||
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
|
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
|
||||||
.setLoadControl(loadControl)
|
.setLoadControl(loadControl)
|
||||||
.setTrackSelector(trackSelector)
|
.setTrackSelector(trackSelector)
|
||||||
|
.setHandleAudioBecomingNoisy(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
exoPlayer.setAudioAttributes(audioAttributes, true)
|
exoPlayer.setAudioAttributes(audioAttributes, true)
|
||||||
|
@ -190,9 +190,10 @@ class BackgroundMode : Service() {
|
|||||||
|
|
||||||
audioAttributes = AudioAttributes.Builder()
|
audioAttributes = AudioAttributes.Builder()
|
||||||
.setUsage(C.USAGE_MEDIA)
|
.setUsage(C.USAGE_MEDIA)
|
||||||
.setContentType(C.CONTENT_TYPE_MUSIC)
|
.setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
|
||||||
.build()
|
.build()
|
||||||
player = ExoPlayer.Builder(this)
|
player = ExoPlayer.Builder(this)
|
||||||
|
.setHandleAudioBecomingNoisy(true)
|
||||||
.setAudioAttributes(audioAttributes, true)
|
.setAudioAttributes(audioAttributes, true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user