From 1606265b4b1af0dffac6c1d725704c76a629244e Mon Sep 17 00:00:00 2001 From: tobias <thinkdifferent055@gmail.com> Date: Mon, 22 Nov 2021 10:03:46 +0100 Subject: [PATCH] #173 - Do not clear hold on media end when new media is played --- .../playpad/plugin/content/pad/ContentPlayerPadContent.scala | 4 ++-- .../playpad/plugin/content/player/ContentPlayerBinding.scala | 4 +--- .../plugin/content/player/ContentPlayerWindowController.scala | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala index 76089ee8..39d2762c 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/pad/ContentPlayerPadContent.scala @@ -64,6 +64,7 @@ class ContentPlayerPadContent(val pad: Pad, val `type`: String) extends PadConte } showingLastFrame = false isPause = false + stopMediaByOtherPlayer = false } override def pause(): Unit = { @@ -80,7 +81,7 @@ class ContentPlayerPadContent(val pad: Pad, val `type`: String) extends PadConte if (getCurrentPlayingMediaIndex != -1) { mediaPlayers(getCurrentPlayingMediaIndex).stop() - if (showingLastFrame) { + if (showingLastFrame && !stopMediaByOtherPlayer) { ContentPluginMain.playerViewController.clearHold(mediaPlayers(getCurrentPlayingMediaIndex)) } } @@ -96,7 +97,6 @@ class ContentPlayerPadContent(val pad: Pad, val `type`: String) extends PadConte // 3. There is no playlist if (!pad.getPadSettings.isLoop && getCurrentPlayingMediaIndex + 1 == mediaPlayers.length) { if (!shouldShowLastFrame()) { - Logger.debug(s"Clear last frame for pad ${pad.getPadIndex}") ContentPluginMain.playerViewController.clearHold(mediaPlayers(getCurrentPlayingMediaIndex)) } else { showingLastFrame = true diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala index 6b1b9c61..99b2e606 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerBinding.scala @@ -65,9 +65,7 @@ class ContentPlayerBinding(val player: ContentPlayer, val zone: Zone) { def stop(media: ContentPlayerMediaContainer): Unit = { // If media is stopped by a different pad, the current media should keep playing to have a smooth transition // to the new media. Otherwise the media will be stopped normally. - if (media.content.stopMediaByOtherPlayer) { - media.content.stopMediaByOtherPlayer = false - } else { + if (!media.content.stopMediaByOtherPlayer) { player.Stop() } } diff --git a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerWindowController.scala b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerWindowController.scala index 8172f528..2c333a5a 100644 --- a/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerWindowController.scala +++ b/PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/player/ContentPlayerWindowController.scala @@ -1,8 +1,9 @@ package de.tobias.playpad.plugin.content.player +import de.thecodelabs.logger.Logger import de.tobias.playpad.PlayPadPlugin import de.tobias.playpad.plugin.content.pad.ContentPlayerMediaContainer -import de.tobias.playpad.plugin.content.settings.{Zone, ContentPlayerPluginConfiguration, ContentPlayerSettingsViewController} +import de.tobias.playpad.plugin.content.settings.{ContentPlayerPluginConfiguration, ContentPlayerSettingsViewController, Zone} import nativecontentplayerwindows.{ContentPlayer, ContentPlayerWindow} import scala.collection.mutable.ListBuffer @@ -75,6 +76,7 @@ class ContentPlayerWindowController { } def clearHold(media: ContentPlayerMediaContainer): Unit = { + Logger.debug(s"Clear last frame for pad ${media.content.pad.getPadIndex}") getContentPlayerBindings(media.content.getSelectedZones).foreach(player => player.clearHold()) } -- GitLab