From 7b336da20bbc5a2c8da94fce857c69d3b157260e Mon Sep 17 00:00:00 2001 From: parneet-guraya Date: Wed, 20 Dec 2023 20:02:53 +0530 Subject: [PATCH] handle audio focus and becoming noisy Signed-off-by: parneet-guraya --- .../main/java/com/nextcloud/client/media/NextcloudExoPlayer.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/nextcloud/client/media/NextcloudExoPlayer.kt b/app/src/main/java/com/nextcloud/client/media/NextcloudExoPlayer.kt index 31e89342fe56..fa2e80343cba 100644 --- a/app/src/main/java/com/nextcloud/client/media/NextcloudExoPlayer.kt +++ b/app/src/main/java/com/nextcloud/client/media/NextcloudExoPlayer.kt @@ -23,6 +23,7 @@ package com.nextcloud.client.media import android.content.Context import com.google.android.exoplayer2.ExoPlayer +import com.google.android.exoplayer2.audio.AudioAttributes import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource import com.google.android.exoplayer2.source.DefaultMediaSourceFactory import com.google.android.exoplayer2.upstream.DefaultDataSource @@ -50,6 +51,8 @@ object NextcloudExoPlayer { return ExoPlayer .Builder(context) .setMediaSourceFactory(mediaSourceFactory) + .setAudioAttributes(AudioAttributes.DEFAULT,true) + .setHandleAudioBecomingNoisy(true) .setSeekForwardIncrementMs(FIVE_SECONDS_IN_MILLIS) .build() }