Browse Source

autoplay fixes

pull/24/head
Jannik 4 years ago
parent
commit
2c3e9fd5e7
  1. 3
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  2. 2
      src/main/java/kellerkinder/HomeFlix/controller/DBController.java
  3. 12
      src/main/java/kellerkinder/HomeFlix/player/PlayerController.java

3
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -717,6 +717,7 @@ public class MainWindowController {
// check if there is a series node to add the item
for (int i = 0; i < filmRoot.getChildren().size(); i++) {
if (filmRoot.getChildren().get(i).getValue().getTitle().equals(element.getTitle())) {
// if a root node exists, add element as child
// System.out.println("Found a root node to add child");
// System.out.println("Adding: " + element.getStreamUrl());
TreeItem<FilmTabelDataType> episodeNode = new TreeItem<>(new FilmTabelDataType(element.getStreamUrl(),
@ -724,8 +725,10 @@ public class MainWindowController {
element.getCached(), element.getImage()));
filmRoot.getChildren().get(i).getChildren().add(episodeNode);
} else if (i == filmRoot.getChildren().size() - 1) {
// if no root node exists, create one and add element as child
// System.out.println("Create a root node to add child");
// System.out.println("Adding: " + element.getStreamUrl());
// TODO get the last watched episode, the first one with currentTime != 0
TreeItem<FilmTabelDataType> seriesRootNode = new TreeItem<>(new FilmTabelDataType(element.getStreamUrl(),
element.getTitle(), "", "", element.getFavorite(), element.getCached(), element.getImage()));
filmRoot.getChildren().add(seriesRootNode);

2
src/main/java/kellerkinder/HomeFlix/controller/DBController.java

@ -236,7 +236,7 @@ public class DBController {
}
/**
* refresh data in mainWindowController localFilms and streamingFilms
* refresh data in mainWindowController for one element
* @param streamUrl of the film
* @param index of the film in LocalFilms list
*/

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

@ -144,13 +144,15 @@ public class PlayerController {
dbController.setCurrentTime(film.getStreamUrl(), 0); // reset old video start time
//start the new film
System.out.println("next episode is: " + dbController.getNextEpisode(film.getTitle(), episode + 1));
mediaPlayer.stop();
player.playNewFilm(dbController.getNextEpisode(film.getTitle(), episode + 1));
FilmTabelDataType nextFilm = dbController.getNextEpisode(film.getTitle(), episode + 1);
if (nextFilm != null) {
// System.out.println("next episode is: " + nextFilm.getStreamUrl());
mediaPlayer.stop();
player.playNewFilm(nextFilm);
autoplay = true;
}
} else if ((duration - currentTime) < 100) {
dbController.setCurrentTime(film.getStreamUrl(), 0);
mediaPlayer.stop();
player.getStage().close();
}
if (!mousePressed) {

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