Browse Source

replace stop button with back button, show media title

* show next episode 30 sec before end
* translate next episode btn
dev
Jannik 2 years ago
parent
commit
965c081d05
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 41
      src/main/java/kellerkinder/HomeFlix/player/PlayerController.java
  2. 15
      src/main/resources/fxml/PlayerWindow.fxml
  3. BIN
      src/main/resources/icons/baseline_keyboard_backspace_white_48dp.png
  4. BIN
      src/main/resources/icons/baseline_stop_black_48dp.png
  5. 39
      src/main/resources/locals/HomeFlix-Local_de_DE.properties
  6. 39
      src/main/resources/locals/HomeFlix-Local_en_US.properties

41
src/main/java/kellerkinder/HomeFlix/player/PlayerController.java

@ -72,7 +72,7 @@ public class PlayerController {
@FXML private JFXSlider timeSlider;
@FXML private JFXButton stopBtn;
@FXML private JFXButton btnBack;
@FXML private JFXButton playBtn;
@FXML private JFXButton fullscreenBtn;
@FXML private JFXButton nextEpBtn;
@ -90,7 +90,7 @@ public class PlayerController {
private WritableImage videoImage;
private PixelBuffer<ByteBuffer> videoPixelBuffer;
private FilmTabelDataType film;
private FilmTabelDataType media;
private long startTime = 0;
private long currentTime = 0;
private long endTime = 0;
@ -115,7 +115,7 @@ public class PlayerController {
*/
public PlayerController(Player player, String mediaURL) {
this.player = player;
this.film = DBController.getInstance().getStream(mediaURL);
this.media = DBController.getInstance().getStream(mediaURL);
mediaPlayerFactory = new MediaPlayerFactory();
embeddedMediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer();
@ -129,12 +129,12 @@ public class PlayerController {
videoImageView.fitHeightProperty().bind(player.getStage().heightProperty());
// set needed variables
startTime = (long) DBController.getInstance().getCurrentTime(film.getStreamUrl());
startTime = (long) DBController.getInstance().getCurrentTime(media.getStreamUrl());
autoplay = XMLController.isAutoplay();
season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0;
episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;
season = !media.getSeason().isEmpty() ? Integer.parseInt(media.getSeason()) : 0;
episode = !media.getEpisode().isEmpty() ? Integer.parseInt(media.getEpisode()) : 0;
lblTitle.setText(film.getTitle());
lblTitle.setText(media.getTitle());
initPlayerWindow();
initMediaPlayer();
@ -235,12 +235,12 @@ public class PlayerController {
}
public void start() {
embeddedMediaPlayer.media().play(film.getStreamUrl());
embeddedMediaPlayer.media().play(media.getStreamUrl());
embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time
}
public void stop() {
DBController.getInstance().setCurrentTime(film.getStreamUrl(), embeddedMediaPlayer.status().time());
DBController.getInstance().setCurrentTime(media.getStreamUrl(), embeddedMediaPlayer.status().time());
embeddedMediaPlayer.controls().stop();
embeddedMediaPlayer.release();
mediaPlayerFactory.release();
@ -262,16 +262,17 @@ public class PlayerController {
TimeUnit.MILLISECONDS.toSeconds(endTime) % 60));
// show the next episode button 20 seconds before the end of a episode
if (endTime < 21000 && episode != 0 && autoplay) {
int countdown = (int) ((endTime / 1000) - 10); // a 10 seconds countdown
// show the next episode button 30 seconds before the end of a episode
if (endTime < 31000 && episode != 0 && autoplay) {
int countdown = (int) ((endTime / 1000) - 20); // a 10 seconds countdown
if (!nextEpBtn.isVisible()) {
nextEpBtn.setVisible(true);
}
if (endTime > 10000) {
nextEpBtn.setText("next episode in " + countdown + " seconds"); // TODO translate
if (endTime > 20000) {
nextEpBtn.setText(XMLController.getLocalBundle().getString("nextEpisode")
+ countdown + XMLController.getLocalBundle().getString("seconds"));
bottomVBox.setVisible(true);
System.out.println("next episode in " + countdown + " seconds");
} else {
@ -281,9 +282,9 @@ public class PlayerController {
}
}
}
@FXML
void stopBtnAction(ActionEvent event) {
void btnBackAction(ActionEvent event) {
stop();
player.getStage().close();
}
@ -317,11 +318,11 @@ public class PlayerController {
private void playNextMedia() {
autoplay = false;
DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
FilmTabelDataType nextFilm = DBController.getInstance().getNextEpisode(film.getTitle(), episode, season);
if (nextFilm != null) {
DBController.getInstance().setCurrentTime(media.getStreamUrl(), 0); // reset old video start time
FilmTabelDataType nextMedia = DBController.getInstance().getNextEpisode(media.getTitle(), episode, season);
if (nextMedia != null) {
//mediaPlayer2.stop();
film = nextFilm;
media = nextMedia;
autoplay = true;
}
}

15
src/main/resources/fxml/PlayerWindow.fxml

@ -22,9 +22,12 @@
</HBox>
<HBox fx:id="hBoxTop" alignment="CENTER_LEFT" spacing="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<JFXButton>
<JFXButton fx:id="btnBack" contentDisplay="GRAPHIC_ONLY" onAction="#btnBackAction" style="-fx-background-color: transparent;">
<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>
</JFXButton>
<Label fx:id="lblTitle" text="Title" textFill="WHITE">
@ -57,14 +60,6 @@
</HBox>
<HBox fx:id="controlsHBox" alignment="CENTER" spacing="10.0">
<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;">
<graphic>
<ImageView fx:id="playIcon" fitHeight="29.0" pickOnBounds="true" preserveRatio="true">

BIN
src/main/resources/icons/baseline_keyboard_backspace_white_48dp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

BIN
src/main/resources/icons/baseline_stop_black_48dp.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

39
src/main/resources/locals/HomeFlix-Local_de_DE.properties

@ -1,13 +1,32 @@
#HomeFlix-Local_de_DE.properties German Local
# 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
#main window translations
# main window translations
info = Info
settings = Einstellungen
streamingSettings = Stream Einst.
tfSearch = Suche...
openFolder = Ordner \u00F6ffnen
#settings translations
# settings translations
homeflixSettingsLbl = HomeFlix Einstellungen
filmDirTextField = Pfad...
addDirectory = Ordner hinzuf\u00FCgen
@ -24,18 +43,18 @@ autoplay = autoplay
branchLbl = Updatezweig
sourcesLbl = Quellen
#column translations
# column translations
columnStreamUrl = Datei Name
columnName = Name
columnSeason = Staffel
columnEpisode = Episode
columnFavorite = Favorit
#error translations
# error translations
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
infoText = \nAutoren: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2019 mosad www.mosad.xyz
#textFlow translations
# textFlow translations
title = Titel
year = Jahr
rated = Einstufung
@ -57,11 +76,15 @@ type = Type
boxOffice = BoxOffice
website = Webseite
#first start
# first start
addSourceHeader = Neue Quelle hinzuf\u00FCgen
addSourceBody = HomeFlix konnte keine Quelle finden. \nFüge eine loakels Verzeichniss oder eine Sreaming Datei als neue Quelle hinzu.
cancelBtnText = Abbrechen
#DetailView
# DetailView
crew = Haupt-Crew
score = Benutzerbewertung
# player
nextEpisode = Nächste Folge in\u0020
seconds = \u0020Sekunden

39
src/main/resources/locals/HomeFlix-Local_en_US.properties

@ -1,13 +1,32 @@
#HomeFlix-Local_en_US.properties US-English Local and default
# 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
#main window translations
# main window translations
info = Info
settings = Settings
streamingSettings = Stream Settings
tfSearch = Search...
openFolder = open Folder
#settings translations
# settings translations
homeflixSettingsLbl = HomeFlix Settings
filmDirTextField = Path...
addDirectory = add directory
@ -24,18 +43,18 @@ autoplay = autoplay
branchLbl = Branch
sourcesLbl = Quellen
#column translations
# column translations
columnStreamUrl = File Name
columnName = Name
columnSeason = Season
columnEpisode = Episode
columnFavorite = Favorite
#error translations
# error translations
vlcNotInstalled = VLC Media Player is required to play a movie!
infoText = \nMaintainers: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2019 mosad www.mosad.xyz
#textFlow translations
# textFlow translations
title = Title
year = Year
rated = Rating
@ -57,11 +76,15 @@ type = Type
boxOffice = BoxOffice
website = Website
#first start
# first startnext episode in
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.
cancelBtnText = cancel
#DetailView
# DetailView
crew = Featured Crew
score = User Score
# player
nextEpisode = next episode in\u0020
seconds = \u0020seconds

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close