Skip to content

Commit 6d68231

Browse files
author
sentinelweb
committed
457 exception fixes
1 parent e397f28 commit 6d68231

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

hub/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ compose.desktop {
5353
mainClass = "uk.co.sentinelweb.cuer.hub.main.MainKt"
5454
nativeDistributions {
5555
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
56-
packageName = "Cuer Hub"
56+
packageName = "Cuer"
5757
packageVersion = "1.0.0"// fixme should use app_versionName but there are a lot of platform dependent rules
5858
}
5959
}

hub/src/main/kotlin/uk/co/sentinelweb/cuer/hub/ui/player/vlc/VlcPlayerSwingWindow.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,16 @@ class VlcPlayerSwingWindow(
310310
}
311311
seekBar.addMouseMotionListener(object : MouseAdapter() {
312312
override fun mouseMoved(e: MouseEvent) {
313-
val slider = e.source as JSlider
314-
val mouseX = e.x
315-
val value = slider.minimum + (slider.maximum - slider.minimum) * mouseX / slider.width
316-
val duration = mediaPlayerComponent.mediaPlayer().media().info().duration()
317-
val position = value.toDouble() / slider.maximum
318-
val timeInMillis = (duration * position).toLong()
319-
val timeFormatted = timeFormatter.formatTime(timeInMillis / 1000f)
320-
slider.toolTipText = timeFormatted
313+
if (mediaPlayerComponent.mediaPlayer().media().info() != null) {
314+
val slider = e.source as JSlider
315+
val mouseX = e.x
316+
val value = slider.minimum + (slider.maximum - slider.minimum) * mouseX / slider.width
317+
val duration = mediaPlayerComponent.mediaPlayer().media().info().duration()
318+
val position = value.toDouble() / slider.maximum
319+
val timeInMillis = (duration * position).toLong()
320+
val timeFormatted = timeFormatter.formatTime(timeInMillis / 1000f)
321+
slider.toolTipText = timeFormatted
322+
}
321323
}
322324
})
323325
posText = JLabel("00:00:00").apply {

shared/src/commonMain/kotlin/uk/co/sentinelweb/cuer/app/ui/cast/CastController.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ class CastController(
7373
fun switchToService() {
7474
if (cuerCastPlayerWatcher.isWatching()) {
7575
cuerCastPlayerWatcher.mainPlayerControls = null
76-
ytServiceManager.start()
76+
if (cuerCastPlayerWatcher.isCommunicating()) {
77+
// don't start service is player isn't running
78+
ytServiceManager.start()
79+
}
7780
chromeCastHolder.destroy() // kills any existing chromecast session
7881
} else if (chromeCastHolder.isCreated() && chromeCastHolder.isConnected()) {
7982
ytServiceManager.start()

shared/src/commonMain/kotlin/uk/co/sentinelweb/cuer/app/util/cuercast/CuerCastPlayerWatcher.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class CuerCastPlayerWatcher(
9999
fun isWatching(): Boolean = remoteNode != null
100100

101101
fun isPlaying(): Boolean = state.lastMessage?.playbackState == PlayerStateDomain.PLAYING
102+
fun isCommunicating(): Boolean = state.isCommunicating
102103

103104
fun attemptRestoreConnection(playerControls: PlayerContract.PlayerControls) {
104105
prefs.curecastRemoteNodeName

0 commit comments

Comments
 (0)