@@ -50,7 +50,7 @@ open class OnlinePlayerService : AbstractPlayerService() {
5050 // PlaylistId/ChannelId for autoplay
5151 private var playlistId: String? = null
5252 private var channelId: String? = null
53- private var startTimestamp : Long? = null
53+ private var startTimestampSeconds : Long? = null
5454
5555 /* *
5656 * The response that gets when called the Api.
@@ -105,7 +105,7 @@ open class OnlinePlayerService : AbstractPlayerService() {
105105 setVideoId(playerData.videoId)
106106 playlistId = playerData.playlistId
107107 channelId = playerData.channelId
108- startTimestamp = playerData.timestamp
108+ startTimestampSeconds = playerData.timestamp
109109
110110 if (! playerData.keepQueue) PlayingQueue .clear()
111111
@@ -115,8 +115,8 @@ open class OnlinePlayerService : AbstractPlayerService() {
115115 override suspend fun startPlayback () {
116116 super .startPlayback()
117117
118- val timestamp = startTimestamp ? : 0L
119- startTimestamp = null
118+ val timestampMs = startTimestampSeconds?.times( 1000 ) ? : 0L
119+ startTimestampSeconds = null
120120
121121 streams = withContext(Dispatchers .IO ) {
122122 try {
@@ -152,16 +152,16 @@ open class OnlinePlayerService : AbstractPlayerService() {
152152 }
153153
154154 withContext(Dispatchers .Main ) {
155- playAudio(timestamp )
155+ playAudio(timestampMs )
156156 }
157157 }
158158
159- private fun playAudio (seekToPosition : Long ) {
159+ private fun playAudio (seekToPositionMs : Long ) {
160160 setStreamSource()
161161
162162 // seek to the previous position if available
163- if (seekToPosition != 0L ) {
164- exoPlayer?.seekTo(seekToPosition )
163+ if (seekToPositionMs != 0L ) {
164+ exoPlayer?.seekTo(seekToPositionMs )
165165 } else if (watchPositionsEnabled) {
166166 DatabaseHelper .getWatchPositionBlocking(videoId)?.let {
167167 if (! DatabaseHelper .isVideoWatched(it, streams?.duration)) exoPlayer?.seekTo(it)
0 commit comments