small fixes

This commit is contained in:
Bnyro 2022-06-01 12:03:00 +02:00
parent 1aa02db53f
commit 37160bcd74
2 changed files with 14 additions and 8 deletions

View File

@ -66,8 +66,11 @@ class BackgroundMode {
* Initializes the [playerNotification] attached to the [player] and shows it. * Initializes the [playerNotification] attached to the [player] and shows it.
*/ */
private fun initializePlayerNotification(c: Context) { private fun initializePlayerNotification(c: Context) {
playerNotification = PlayerNotificationManager.Builder(c, 1, "background_mode").build() playerNotification = PlayerNotificationManager
.Builder(c, 1, "background_mode").build()
playerNotification.setPlayer(player) playerNotification.setPlayer(player)
playerNotification.setUsePreviousAction(false)
playerNotification.setUseNextAction(false)
playerNotification.setMediaSessionToken(mediaSession.sessionToken) playerNotification.setMediaSessionToken(mediaSession.sessionToken)
} }

View File

@ -409,13 +409,13 @@ class PlayerFragment : Fragment() {
private fun initializePlayerView(view: View, response: Streams) { private fun initializePlayerView(view: View, response: Streams) {
isLoading = false isLoading = false
runOnUiThread {
var videosNameArray: Array<CharSequence> = arrayOf() var videosNameArray: Array<CharSequence> = arrayOf()
videosNameArray += "HLS" videosNameArray += "HLS"
for (vid in response.videoStreams!!) { for (vid in response.videoStreams!!) {
val name = vid.quality + " " + vid.format val name = vid.quality + " " + vid.format
videosNameArray += name videosNameArray += name
} }
runOnUiThread {
var subtitle = mutableListOf<SubtitleConfiguration>() var subtitle = mutableListOf<SubtitleConfiguration>()
if (response.subtitles!!.isNotEmpty()) { if (response.subtitles!!.isNotEmpty()) {
subtitle.add( subtitle.add(
@ -871,9 +871,12 @@ class PlayerFragment : Fragment() {
} }
private fun initializePlayerNotification(c: Context) { private fun initializePlayerNotification(c: Context) {
playerNotification = PlayerNotificationManager.Builder(c, notificationId, "background_mode") playerNotification = PlayerNotificationManager
.Builder(c, notificationId, "background_mode")
.build() .build()
playerNotification.setPlayer(exoPlayer) playerNotification.setPlayer(exoPlayer)
playerNotification.setUseNextAction(false)
playerNotification.setUsePreviousAction(false)
playerNotification.setMediaSessionToken(mediaSession.sessionToken) playerNotification.setMediaSessionToken(mediaSession.sessionToken)
} }