mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-06-03 15:07:16 +00:00
android: set audiofocus none in popup video views (#611)
fixed popups interrupting media playback
This commit is contained in:
@@ -33,6 +33,7 @@ import android.content.IntentFilter
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.PixelFormat
|
import android.graphics.PixelFormat
|
||||||
import android.graphics.drawable.GradientDrawable
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.media.AudioManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
@@ -374,6 +375,7 @@ class IslandWindow(private val context: Context) {
|
|||||||
|
|
||||||
val videoView = islandView.findViewById<VideoView>(R.id.island_video_view)
|
val videoView = islandView.findViewById<VideoView>(R.id.island_video_view)
|
||||||
val videoUri = "android.resource://me.kavishdevar.librepods/${R.raw.island}".toUri()
|
val videoUri = "android.resource://me.kavishdevar.librepods/${R.raw.island}".toUri()
|
||||||
|
videoView.setAudioFocusRequest(AudioManager.AUDIOFOCUS_NONE)
|
||||||
videoView.setVideoURI(videoUri)
|
videoView.setVideoURI(videoUri)
|
||||||
videoView.setOnPreparedListener { mediaPlayer ->
|
videoView.setOnPreparedListener { mediaPlayer ->
|
||||||
mediaPlayer.isLooping = true
|
mediaPlayer.isLooping = true
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.graphics.PixelFormat
|
import android.graphics.PixelFormat
|
||||||
|
import android.media.AudioManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
@@ -137,6 +138,7 @@ class PopupWindow(
|
|||||||
updateBatteryStatus(batteryNotification)
|
updateBatteryStatus(batteryNotification)
|
||||||
|
|
||||||
val vid = mView.findViewById<VideoView>(R.id.video)
|
val vid = mView.findViewById<VideoView>(R.id.video)
|
||||||
|
vid.setAudioFocusRequest(AudioManager.AUDIOFOCUS_NONE)
|
||||||
vid.setVideoPath("android.resource://me.kavishdevar.librepods/" + R.raw.connected)
|
vid.setVideoPath("android.resource://me.kavishdevar.librepods/" + R.raw.connected)
|
||||||
vid.resolveAdjustedSize(vid.width, vid.height)
|
vid.resolveAdjustedSize(vid.width, vid.height)
|
||||||
vid.start()
|
vid.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user