casting: update propertiees when updates are received

This commit is contained in:
Marcus Hanestad 2025-09-04 09:05:33 +02:00
commit 42d886ba44

View file

@ -148,7 +148,10 @@ class ExpCastingDevice(val device: RsCastingDevice) : CastingDevice() {
} catch (_: Throwable) {
}
override fun changeVolume(timeSeconds: Double) = device.changeVolume(timeSeconds)
override fun changeVolume(newVolume: Double) {
device.changeVolume(newVolume)
volume = newVolume
}
override fun changeSpeed(speed: Double) = device.changeSpeed(speed)
@ -274,6 +277,11 @@ class ExpCastingDevice(val device: RsCastingDevice) : CastingDevice() {
}
}
}
eventHandler.onPlayChanged.subscribe { isPlaying = it }
eventHandler.onTimeChanged.subscribe { time = it }
eventHandler.onDurationChanged.subscribe { duration = it }
eventHandler.onVolumeChanged.subscribe { volume = it }
eventHandler.onSpeedChanged.subscribe { speed = it }
}
override fun ensureThreadStarted() {}