Skip to content

Commit

Permalink
Feat: Improve perf & rework seekFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldb09 committed Jan 28, 2023
1 parent 12d886c commit 7d9df71
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class LavalinkPlayer(

override fun seekTo(position: Long) {
val track = audioPlayer.playingTrack ?: throw RuntimeException("Can't seek when not playing anything")
track.position = position
track.position = track.position + position
}

override fun setVolume(volume: Int) {
Expand All @@ -110,12 +110,7 @@ class LavalinkPlayer(
return
}

updateFuture = socket.playerUpdateService.scheduleAtFixedRate(
{ sendPlayerUpdate(socket, this) },
0,
serverConfig.playerUpdateInterval.toLong(),
TimeUnit.SECONDS
)

}

private inner class Provider(connection: MediaConnection?) : OpusAudioFrameProvider(connection) {
Expand Down

0 comments on commit 7d9df71

Please sign in to comment.