replace stop button with back button, show media title
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
* show next episode 30 sec before end * translate next episode btn
This commit is contained in:
parent
c6b2d1a9d8
commit
965c081d05
|
@ -72,7 +72,7 @@ public class PlayerController {
|
||||||
|
|
||||||
@FXML private JFXSlider timeSlider;
|
@FXML private JFXSlider timeSlider;
|
||||||
|
|
||||||
@FXML private JFXButton stopBtn;
|
@FXML private JFXButton btnBack;
|
||||||
@FXML private JFXButton playBtn;
|
@FXML private JFXButton playBtn;
|
||||||
@FXML private JFXButton fullscreenBtn;
|
@FXML private JFXButton fullscreenBtn;
|
||||||
@FXML private JFXButton nextEpBtn;
|
@FXML private JFXButton nextEpBtn;
|
||||||
|
@ -90,7 +90,7 @@ public class PlayerController {
|
||||||
private WritableImage videoImage;
|
private WritableImage videoImage;
|
||||||
private PixelBuffer<ByteBuffer> videoPixelBuffer;
|
private PixelBuffer<ByteBuffer> videoPixelBuffer;
|
||||||
|
|
||||||
private FilmTabelDataType film;
|
private FilmTabelDataType media;
|
||||||
private long startTime = 0;
|
private long startTime = 0;
|
||||||
private long currentTime = 0;
|
private long currentTime = 0;
|
||||||
private long endTime = 0;
|
private long endTime = 0;
|
||||||
|
@ -115,7 +115,7 @@ public class PlayerController {
|
||||||
*/
|
*/
|
||||||
public PlayerController(Player player, String mediaURL) {
|
public PlayerController(Player player, String mediaURL) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.film = DBController.getInstance().getStream(mediaURL);
|
this.media = DBController.getInstance().getStream(mediaURL);
|
||||||
|
|
||||||
mediaPlayerFactory = new MediaPlayerFactory();
|
mediaPlayerFactory = new MediaPlayerFactory();
|
||||||
embeddedMediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer();
|
embeddedMediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer();
|
||||||
|
@ -129,12 +129,12 @@ public class PlayerController {
|
||||||
videoImageView.fitHeightProperty().bind(player.getStage().heightProperty());
|
videoImageView.fitHeightProperty().bind(player.getStage().heightProperty());
|
||||||
|
|
||||||
// set needed variables
|
// set needed variables
|
||||||
startTime = (long) DBController.getInstance().getCurrentTime(film.getStreamUrl());
|
startTime = (long) DBController.getInstance().getCurrentTime(media.getStreamUrl());
|
||||||
autoplay = XMLController.isAutoplay();
|
autoplay = XMLController.isAutoplay();
|
||||||
season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0;
|
season = !media.getSeason().isEmpty() ? Integer.parseInt(media.getSeason()) : 0;
|
||||||
episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;
|
episode = !media.getEpisode().isEmpty() ? Integer.parseInt(media.getEpisode()) : 0;
|
||||||
|
|
||||||
lblTitle.setText(film.getTitle());
|
lblTitle.setText(media.getTitle());
|
||||||
|
|
||||||
initPlayerWindow();
|
initPlayerWindow();
|
||||||
initMediaPlayer();
|
initMediaPlayer();
|
||||||
|
@ -235,12 +235,12 @@ public class PlayerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
embeddedMediaPlayer.media().play(film.getStreamUrl());
|
embeddedMediaPlayer.media().play(media.getStreamUrl());
|
||||||
embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time
|
embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
DBController.getInstance().setCurrentTime(film.getStreamUrl(), embeddedMediaPlayer.status().time());
|
DBController.getInstance().setCurrentTime(media.getStreamUrl(), embeddedMediaPlayer.status().time());
|
||||||
embeddedMediaPlayer.controls().stop();
|
embeddedMediaPlayer.controls().stop();
|
||||||
embeddedMediaPlayer.release();
|
embeddedMediaPlayer.release();
|
||||||
mediaPlayerFactory.release();
|
mediaPlayerFactory.release();
|
||||||
|
@ -262,16 +262,17 @@ public class PlayerController {
|
||||||
TimeUnit.MILLISECONDS.toSeconds(endTime) % 60));
|
TimeUnit.MILLISECONDS.toSeconds(endTime) % 60));
|
||||||
|
|
||||||
|
|
||||||
// show the next episode button 20 seconds before the end of a episode
|
// show the next episode button 30 seconds before the end of a episode
|
||||||
if (endTime < 21000 && episode != 0 && autoplay) {
|
if (endTime < 31000 && episode != 0 && autoplay) {
|
||||||
int countdown = (int) ((endTime / 1000) - 10); // a 10 seconds countdown
|
int countdown = (int) ((endTime / 1000) - 20); // a 10 seconds countdown
|
||||||
|
|
||||||
if (!nextEpBtn.isVisible()) {
|
if (!nextEpBtn.isVisible()) {
|
||||||
nextEpBtn.setVisible(true);
|
nextEpBtn.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > 10000) {
|
if (endTime > 20000) {
|
||||||
nextEpBtn.setText("next episode in " + countdown + " seconds"); // TODO translate
|
nextEpBtn.setText(XMLController.getLocalBundle().getString("nextEpisode")
|
||||||
|
+ countdown + XMLController.getLocalBundle().getString("seconds"));
|
||||||
bottomVBox.setVisible(true);
|
bottomVBox.setVisible(true);
|
||||||
System.out.println("next episode in " + countdown + " seconds");
|
System.out.println("next episode in " + countdown + " seconds");
|
||||||
} else {
|
} else {
|
||||||
|
@ -283,7 +284,7 @@ public class PlayerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void stopBtnAction(ActionEvent event) {
|
void btnBackAction(ActionEvent event) {
|
||||||
stop();
|
stop();
|
||||||
player.getStage().close();
|
player.getStage().close();
|
||||||
}
|
}
|
||||||
|
@ -317,11 +318,11 @@ public class PlayerController {
|
||||||
|
|
||||||
private void playNextMedia() {
|
private void playNextMedia() {
|
||||||
autoplay = false;
|
autoplay = false;
|
||||||
DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
|
DBController.getInstance().setCurrentTime(media.getStreamUrl(), 0); // reset old video start time
|
||||||
FilmTabelDataType nextFilm = DBController.getInstance().getNextEpisode(film.getTitle(), episode, season);
|
FilmTabelDataType nextMedia = DBController.getInstance().getNextEpisode(media.getTitle(), episode, season);
|
||||||
if (nextFilm != null) {
|
if (nextMedia != null) {
|
||||||
//mediaPlayer2.stop();
|
//mediaPlayer2.stop();
|
||||||
film = nextFilm;
|
media = nextMedia;
|
||||||
autoplay = true;
|
autoplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,12 @@
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox fx:id="hBoxTop" alignment="CENTER_LEFT" spacing="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<HBox fx:id="hBoxTop" alignment="CENTER_LEFT" spacing="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton>
|
<JFXButton fx:id="btnBack" contentDisplay="GRAPHIC_ONLY" onAction="#btnBackAction" style="-fx-background-color: transparent;">
|
||||||
<graphic>
|
<graphic>
|
||||||
<ImageView pickOnBounds="true" preserveRatio="true" />
|
<ImageView fitHeight="24.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<image>
|
||||||
|
<Image url="@../icons/baseline_keyboard_backspace_white_48dp.png" />
|
||||||
|
</image></ImageView>
|
||||||
</graphic>
|
</graphic>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<Label fx:id="lblTitle" text="Title" textFill="WHITE">
|
<Label fx:id="lblTitle" text="Title" textFill="WHITE">
|
||||||
|
@ -57,14 +60,6 @@
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox fx:id="controlsHBox" alignment="CENTER" spacing="10.0">
|
<HBox fx:id="controlsHBox" alignment="CENTER" spacing="10.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="stopBtn" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" onAction="#stopBtnAction" prefHeight="39.0" style="-fx-background-color: white;">
|
|
||||||
<graphic>
|
|
||||||
<ImageView fx:id="stopIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@../icons/baseline_stop_black_48dp.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</graphic></JFXButton>
|
|
||||||
<JFXButton fx:id="playBtn" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" onAction="#playBtnAction" prefHeight="39.0" style="-fx-background-color: white;">
|
<JFXButton fx:id="playBtn" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" onAction="#playBtnAction" prefHeight="39.0" style="-fx-background-color: white;">
|
||||||
<graphic>
|
<graphic>
|
||||||
<ImageView fx:id="playIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true">
|
<ImageView fx:id="playIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 159 B |
Binary file not shown.
Before Width: | Height: | Size: 107 B |
|
@ -1,3 +1,22 @@
|
||||||
|
# Project-HomeFlix
|
||||||
|
#
|
||||||
|
# Copyright 2016-2020 <seil0@mosad.xyz>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
# MA 02110-1301, USA.
|
||||||
|
#
|
||||||
# HomeFlix-Local_de_DE.properties German Local
|
# HomeFlix-Local_de_DE.properties German Local
|
||||||
|
|
||||||
# main window translations
|
# main window translations
|
||||||
|
@ -65,3 +84,7 @@ cancelBtnText = Abbrechen
|
||||||
# DetailView
|
# DetailView
|
||||||
crew = Haupt-Crew
|
crew = Haupt-Crew
|
||||||
score = Benutzerbewertung
|
score = Benutzerbewertung
|
||||||
|
|
||||||
|
# player
|
||||||
|
nextEpisode = Nächste Folge in\u0020
|
||||||
|
seconds = \u0020Sekunden
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
# Project-HomeFlix
|
||||||
|
#
|
||||||
|
# Copyright 2016-2020 <seil0@mosad.xyz>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
# MA 02110-1301, USA.
|
||||||
|
#
|
||||||
# HomeFlix-Local_en_US.properties US-English Local and default
|
# HomeFlix-Local_en_US.properties US-English Local and default
|
||||||
|
|
||||||
# main window translations
|
# main window translations
|
||||||
|
@ -57,7 +76,7 @@ type = Type
|
||||||
boxOffice = BoxOffice
|
boxOffice = BoxOffice
|
||||||
website = Website
|
website = Website
|
||||||
|
|
||||||
#first start
|
# first startnext episode in
|
||||||
addSourceHeader = add a new source
|
addSourceHeader = add a new source
|
||||||
addSourceBody = HomeFlix was not able to load a source. \nAdd a new local directory oa a streaming file as new source.
|
addSourceBody = HomeFlix was not able to load a source. \nAdd a new local directory oa a streaming file as new source.
|
||||||
cancelBtnText = cancel
|
cancelBtnText = cancel
|
||||||
|
@ -65,3 +84,7 @@ cancelBtnText = cancel
|
||||||
# DetailView
|
# DetailView
|
||||||
crew = Featured Crew
|
crew = Featured Crew
|
||||||
score = User Score
|
score = User Score
|
||||||
|
|
||||||
|
# player
|
||||||
|
nextEpisode = next episode in\u0020
|
||||||
|
seconds = \u0020seconds
|
||||||
|
|
Loading…
Reference in New Issue