Skip to content

Commit

Permalink
Fix bug causing player to unpause when injecting sounds while paused
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Feb 14, 2024
1 parent 21e095c commit 4b9389c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion music/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
subprojects {
version = "3.5.7-SNAPSHOT"
version = "3.5.8-SNAPSHOT"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
import kotlin.time.toDuration

internal data class SavedTrack(val track: QueuedTrack, val position: Duration, val filters: Filters, val volume: Int)
internal data class SavedTrack(
val track: QueuedTrack,
val position: Duration,
val filters: Filters,
val volume: Int,
val pause: Boolean,
)

class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by link, KordExKoinComponent {

Expand Down Expand Up @@ -225,7 +231,7 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li
if (currentTrack != null && !noReplace) {
val currentPosition = player.positionDuration

savedTrack = SavedTrack(currentTrack, currentPosition, player.filters, player.volume)
savedTrack = SavedTrack(currentTrack, currentPosition, player.filters, player.volume, player.paused)
}
link.player.searchAndPlayTrack(identifier, playOptionsBuilder)
}
Expand Down Expand Up @@ -265,6 +271,7 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li
position = track.position
filters = track.filters
volume = track.volume
pause = track.pause
}
return@onTrackEnd
}
Expand Down

0 comments on commit 4b9389c

Please sign in to comment.