Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-cameras-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@theoplayer/react-native-analytics-adobe': patch
---

Fixed an issue on Android where the playhead for Live events would exceed the maximum value.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import kotlin.collections.orEmpty
import kotlin.collections.plus
import kotlin.collections.toMutableMap
import kotlinx.serialization.json.*
import java.util.Calendar

typealias AddTextTrackEvent = com.theoplayer.android.api.event.track.texttrack.list.AddTrackEvent
typealias RemoveTextTrackEvent = com.theoplayer.android.api.event.track.texttrack.list.RemoveTrackEvent
Expand Down Expand Up @@ -371,8 +372,14 @@ class AdobeConnector(
}

private fun getCurrentTime(): Int {
return when (player.currentTime) {
Double.POSITIVE_INFINITY -> (System.currentTimeMillis() / 1000) % 86400
return when (player.duration) {
Double.POSITIVE_INFINITY -> {
// Return seconds since start of day for live streams
val calendar = Calendar.getInstance()
calendar.get(Calendar.SECOND) +
60 * (calendar.get(Calendar.MINUTE) +
60 * calendar.get(Calendar.HOUR_OF_DAY))
}
else -> player.currentTime
}.toInt()
}
Expand Down
Loading