1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-06-24 21:25:23 +00:00

Implemented WebSocket for electron version.

This commit is contained in:
Koen 2023-12-06 11:50:26 +01:00
parent ad8f3985a3
commit 85530ca218
10 changed files with 310 additions and 66 deletions

View file

@ -64,12 +64,14 @@ class NetworkService : Service() {
val player = PlayerActivity.instance
val updateMessage = if (player != null) {
PlaybackUpdateMessage(
System.currentTimeMillis(),
player.currentPosition / 1000.0,
player.duration / 1000.0,
if (player.isPlaying) 1 else 2
)
} else {
PlaybackUpdateMessage(
System.currentTimeMillis(),
0.0,
0.0,
0

View file

@ -17,6 +17,7 @@ data class SeekMessage(
@Serializable
data class PlaybackUpdateMessage(
val generationTime: Long,
val time: Double,
val duration: Double,
val state: Int
@ -24,6 +25,7 @@ data class PlaybackUpdateMessage(
@Serializable
data class VolumeUpdateMessage(
val generationTime: Long,
val volume: Double
)