Skip to content
Snippets Groups Projects
Commit 350a16ac authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

#173 - Set current play position for content player

parent e59a3341
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 20 deletions
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -4,12 +4,12 @@ if not exist target\classes mkdir target\classes
echo compile classes
javac -nowarn -d target\classes -sourcepath jvm -cp "c:\users\tobias\ideaprojects\playwalldesktop\playwallplugins\playwallplugincontentplayer\j4n\jni4net.j-0.8.8.0.jar"; "jvm\nativecontentplayerwindows\ContentPlayerStopListener.java" "jvm\nativecontentplayerwindows\ContentPlayerStopListener_.java" "jvm\nativecontentplayerwindows\Zone.java" "jvm\nativecontentplayerwindows\ContentPlayer.java" "jvm\nativecontentplayerwindows\ContentPlayerWindow.java"
javac -nowarn -d target\classes -sourcepath jvm -cp "c:\users\tobias\ideaprojects\playwalldesktop\playwallplugins\playwallplugincontentplayer\j4n\jni4net.j-0.8.8.0.jar"; "jvm\nativecontentplayerwindows\ContentPlayerStopListener.java" "jvm\nativecontentplayerwindows\ContentPlayerStopListener_.java" "jvm\nativecontentplayerwindows\ContentPlayerPositionListener.java" "jvm\nativecontentplayerwindows\ContentPlayerPositionListener_.java" "jvm\nativecontentplayerwindows\Zone.java" "jvm\nativecontentplayerwindows\ContentPlayer.java" "jvm\nativecontentplayerwindows\ContentPlayerWindow.java"
IF %ERRORLEVEL% NEQ 0 goto end
echo NativeContentPlayerWindows.j4n.jar
jar cvf NativeContentPlayerWindows.j4n.jar -C target\classes "nativecontentplayerwindows\ContentPlayerStopListener.class" -C target\classes "nativecontentplayerwindows\ContentPlayerStopListener_.class" -C target\classes "nativecontentplayerwindows\__ContentPlayerStopListener.class" -C target\classes "nativecontentplayerwindows\Zone.class" -C target\classes "nativecontentplayerwindows\ContentPlayer.class" -C target\classes "nativecontentplayerwindows\ContentPlayerWindow.class" > nul
jar cvf NativeContentPlayerWindows.j4n.jar -C target\classes "nativecontentplayerwindows\ContentPlayerStopListener.class" -C target\classes "nativecontentplayerwindows\ContentPlayerStopListener_.class" -C target\classes "nativecontentplayerwindows\__ContentPlayerStopListener.class" -C target\classes "nativecontentplayerwindows\ContentPlayerPositionListener.class" -C target\classes "nativecontentplayerwindows\ContentPlayerPositionListener_.class" -C target\classes "nativecontentplayerwindows\__ContentPlayerPositionListener.class" -C target\classes "nativecontentplayerwindows\Zone.class" -C target\classes "nativecontentplayerwindows\ContentPlayer.class" -C target\classes "nativecontentplayerwindows\ContentPlayerWindow.class" > nul
IF %ERRORLEVEL% NEQ 0 goto end
......
No preview for this file type
......@@ -14,10 +14,6 @@ class ContentPlayerMediaContainer(val content: ContentPlayerPadContent, val medi
def getTotalDuration: Duration = totalDurationProperty.get()
def play(): Unit = {
// TODO
// content._durationProperty.bind(mediaPlayer.totalDurationProperty())
// content._positionProperty.bind(mediaPlayer.currentTimeProperty())
ContentPluginMain.playerViewController.play(this)
content.getPad.setEof(false)
......
......@@ -25,8 +25,8 @@ class ContentPlayerPadContent(val pad: Pad, val `type`: String) extends PadConte
private val mediaPlayers: ObservableList[ContentPlayerMediaContainer] = FXCollections.observableArrayList()
private val currentRunningIndexProperty: IntegerProperty = new SimpleIntegerProperty(-1)
private[pad] val _durationProperty = new SimpleObjectProperty[Duration]
private[pad] val _positionProperty = new SimpleObjectProperty[Duration]
private[content] val _durationProperty = new SimpleObjectProperty[Duration]
private[content] val _positionProperty = new SimpleObjectProperty[Duration]
private var showingLastFrame: Boolean = false
private var isPause: Boolean = false
......
......@@ -2,29 +2,52 @@ package de.tobias.playpad.plugin.content.player
import de.tobias.playpad.plugin.content.pad.ContentPlayerMediaContainer
import de.tobias.playpad.plugin.content.settings.Zone
import javafx.beans.property.{ReadOnlyDoubleProperty, SimpleDoubleProperty}
import javafx.application.Platform
import javafx.beans.property.{ObjectProperty, SimpleObjectProperty}
import javafx.util.Duration
import nativecontentplayerwindows.ContentPlayer
class ContentPlayerBinding(val player: ContentPlayer, val zone: Zone) {
val durationProperty: ReadOnlyDoubleProperty = new SimpleDoubleProperty()
player.setContentPlayerStopListener((endOfFile)=>{
if (endOfFile && currentMedia != null) {
currentMedia.content.pad.setEof(true)
currentMedia.content.onEof()
private val positionProperty: ObjectProperty[Duration] = new SimpleObjectProperty[Duration]()
private val durationProperty: ObjectProperty[Duration] = new SimpleObjectProperty[Duration]()
private val currentMedia: ObjectProperty[ContentPlayerMediaContainer] = new SimpleObjectProperty[ContentPlayerMediaContainer]()
player.setContentPlayerStopListener(endOfFile => {
if (endOfFile && currentMedia.get() != null) {
currentMedia.get().content.pad.setEof(true)
currentMedia.get().content.onEof()
}
})
player.setContentPlayerPositionListener((position, total) => {
Platform.runLater(() => {
val totalDuration = Duration.seconds(total)
if (totalDuration != durationProperty.get()) {
durationProperty.setValue(totalDuration)
println("Set")
}
positionProperty.setValue(Duration.seconds(position))
})
})
currentMedia.addListener((_, oldValue, newValue) => {
if (oldValue != null) {
oldValue.content._positionProperty.unbind()
oldValue.content._durationProperty.unbind()
}
if (newValue != null) {
newValue.content._positionProperty.bind(positionProperty)
newValue.content._durationProperty.bind(durationProperty)
}
})
private var currentMedia: ContentPlayerMediaContainer = _
def play(media: ContentPlayerMediaContainer): Unit = {
player.Play(media.mediaPath.getPath.toAbsolutePath.toString)
currentMedia = media
currentMedia.set(media)
}
def resume(media: ContentPlayerMediaContainer): Unit = {
player.Resume()
currentMedia = media
currentMedia.set(media)
}
def pause(media: ContentPlayerMediaContainer): Unit = {
......@@ -33,10 +56,9 @@ class ContentPlayerBinding(val player: ContentPlayer, val zone: Zone) {
def stop(media: ContentPlayerMediaContainer): Unit = {
player.Stop()
currentMedia = null
}
def highlight(on: Boolean): Unit = {
// TODO: Implement
// TODO: Implements
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment