Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound disappears after 5 minutes while screen is in sleep mode #8

Open
a-bytecode opened this issue Feb 7, 2023 · 0 comments
Open

Comments

@a-bytecode
Copy link
Owner

Sound disappears after 5 minutes while screen is in sleep mode

Hi everyone, if someone know how to fix this problem I would be really thankful for that.
Ive tried to solve this problem with wakelock & wifilock at the mediaPlayer but both are not working still the same problem.

powerManager = requireActivity().getSystemService(POWER_SERVICE) as PowerManager
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"radiosharp:wakelockv1")
wifiManager = requireActivity().getSystemService(Context.WIFI_SERVICE) as WifiManager
wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "radiosharp:wifilockv1")

binding.playImageDetail.setOnClickListener {
wifiLock.acquire()
Log.d("WIFILOCK","WIFILOCK ${wifiLock.isHeld}")
wakeLock.acquire(30601000L /30 minutes/)
Log.d("WAKELOCK","WAKELOCK: ${wakeLock.isHeld}")
mediaPlayer!!.start()
mediaPlayer!!.setScreenOnWhilePlaying(true)
binding.playImageDetail.visibility = View.GONE
binding.stopImageDetail.visibility = View.VISIBLE
}

this issue happens after a few minutes if mobile phone screen turns into sleep mode loosing the connection, I guess cause the WIFI goes into sleep mode aswell... I've tried to use wifilock to give him full & high preferences to work. But its not working im running out out ideas now.

I would preciate any help. Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant