add player end time lable
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			* update vlcj 4.4.0 -> 4.5.1
This commit is contained in:
		
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							| @ -45,7 +45,7 @@ | ||||
| 		<dependency> | ||||
| 			<groupId>uk.co.caprica</groupId> | ||||
| 			<artifactId>vlcj</artifactId> | ||||
| 			<version>4.4.0</version> | ||||
| 			<version>4.5.1</version> | ||||
| 		</dependency> | ||||
|  | ||||
| 		<dependency> | ||||
|  | ||||
| @ -25,6 +25,7 @@ package kellerkinder.HomeFlix.player; | ||||
| import java.nio.ByteBuffer; | ||||
| import java.util.Timer; | ||||
| import java.util.TimerTask; | ||||
| import java.util.concurrent.TimeUnit; | ||||
|  | ||||
| import com.jfoenix.controls.JFXButton; | ||||
| import com.jfoenix.controls.JFXSlider; | ||||
| @ -36,6 +37,7 @@ import javafx.event.ActionEvent; | ||||
| import javafx.event.EventHandler; | ||||
| import javafx.fxml.FXML; | ||||
| import javafx.scene.Cursor; | ||||
| import javafx.scene.control.Label; | ||||
| import javafx.scene.image.Image; | ||||
| import javafx.scene.image.ImageView; | ||||
| import javafx.scene.image.PixelBuffer; | ||||
| @ -45,11 +47,9 @@ import javafx.scene.input.MouseEvent; | ||||
| import javafx.scene.layout.HBox; | ||||
| import javafx.scene.layout.VBox; | ||||
| import javafx.scene.media.MediaView; | ||||
|  | ||||
| import kellerkinder.HomeFlix.controller.DBController; | ||||
| import kellerkinder.HomeFlix.controller.XMLController; | ||||
| import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; | ||||
|  | ||||
| import uk.co.caprica.vlcj.factory.MediaPlayerFactory; | ||||
| import uk.co.caprica.vlcj.player.base.MediaPlayer; | ||||
| import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer; | ||||
| @ -65,9 +65,10 @@ public class PlayerController { | ||||
| 	@FXML private MediaView mediaView; | ||||
| 	@FXML private ImageView videoImageView; | ||||
|  | ||||
| 	@FXML private VBox bottomVBox; | ||||
|  | ||||
| 	@FXML private HBox hBoxTop; | ||||
| 	@FXML private HBox controlsHBox; | ||||
| 	 | ||||
| 	@FXML private VBox bottomVBox; | ||||
|  | ||||
| 	@FXML private JFXSlider timeSlider; | ||||
|  | ||||
| @ -79,6 +80,9 @@ public class PlayerController { | ||||
| 	@FXML private ImageView stopIcon; | ||||
| 	@FXML private ImageView playIcon; | ||||
| 	@FXML private ImageView fullscreenIcon; | ||||
| 	 | ||||
| 	@FXML private Label lblTitle; | ||||
| 	@FXML private Label lblEndTime; | ||||
|  | ||||
| 	private Player player; | ||||
| 	private MediaPlayerFactory mediaPlayerFactory; | ||||
| @ -130,11 +134,53 @@ public class PlayerController { | ||||
| 		season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0; | ||||
| 		episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0; | ||||
| 		 | ||||
| 		lblTitle.setText(film.getTitle()); | ||||
| 		 | ||||
| 		initPlayerWindow(); | ||||
| 		initMediaPlayer(); | ||||
| 		initSlider(); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * initialize some PlayerWindow GUI-Elements actions | ||||
| 	 */ | ||||
| 	private void initPlayerWindow() { | ||||
|  | ||||
| 		player.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, new EventHandler<MouseEvent>() { | ||||
| 			 | ||||
| 			// hide controls timer initialization | ||||
| 			final Timer timer = new Timer(); | ||||
| 			TimerTask controlAnimationTask = null; // task to execute save operation | ||||
| 			final long delayTime = 3000; // hide the controls after 2 seconds | ||||
|  | ||||
| 			@Override | ||||
| 			public void handle(MouseEvent mouseEvent) { | ||||
|  | ||||
| 				// show controls | ||||
| 				if (!showControls) { | ||||
| 					player.getScene().setCursor(Cursor.DEFAULT); | ||||
| 					hBoxTop.setVisible(true); | ||||
| 					bottomVBox.setVisible(true); | ||||
| 				} | ||||
|  | ||||
| 				// hide controls | ||||
| 				if (controlAnimationTask != null) | ||||
| 					controlAnimationTask.cancel(); | ||||
|  | ||||
| 				controlAnimationTask = new TimerTask() { | ||||
| 					@Override | ||||
| 					public void run() { | ||||
| 						hBoxTop.setVisible(false); | ||||
| 						bottomVBox.setVisible(false); | ||||
| 						player.getScene().setCursor(Cursor.NONE); | ||||
| 						showControls = false; | ||||
| 					} | ||||
| 				}; | ||||
| 				timer.schedule(controlAnimationTask, delayTime); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| 	 | ||||
| 	private void initMediaPlayer() { | ||||
| 		embeddedMediaPlayer.events().addMediaPlayerEventListener( new HFMediaPlayerEventListener() { | ||||
|  | ||||
| @ -188,44 +234,6 @@ public class PlayerController { | ||||
| 		}); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * initialize some PlayerWindow GUI-Elements actions | ||||
| 	 */ | ||||
| 	private void initPlayerWindow() { | ||||
|  | ||||
| 		player.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, new EventHandler<MouseEvent>() { | ||||
| 			 | ||||
| 			// hide controls timer initialization | ||||
| 			final Timer timer = new Timer(); | ||||
| 			TimerTask controlAnimationTask = null; // task to execute save operation | ||||
| 			final long delayTime = 3000; // hide the controls after 2 seconds | ||||
|  | ||||
| 			@Override | ||||
| 			public void handle(MouseEvent mouseEvent) { | ||||
|  | ||||
| 				// show controls | ||||
| 				if (!showControls) { | ||||
| 					player.getScene().setCursor(Cursor.DEFAULT); | ||||
| 					bottomVBox.setVisible(true); | ||||
| 				} | ||||
|  | ||||
| 				// hide controls | ||||
| 				if (controlAnimationTask != null) | ||||
| 					controlAnimationTask.cancel(); | ||||
|  | ||||
| 				controlAnimationTask = new TimerTask() { | ||||
| 					@Override | ||||
| 					public void run() { | ||||
| 						bottomVBox.setVisible(false); | ||||
| 						player.getScene().setCursor(Cursor.NONE); | ||||
| 						showControls = false; | ||||
| 					} | ||||
| 				}; | ||||
| 				timer.schedule(controlAnimationTask, delayTime); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| 	 | ||||
| 	public void start() { | ||||
| 		embeddedMediaPlayer.media().play(film.getStreamUrl()); | ||||
| 		embeddedMediaPlayer.controls().skipTime((long) startTime); // skipt to the start time | ||||
| @ -247,9 +255,13 @@ public class PlayerController { | ||||
| 			timeSlider.setValue((currentTime / 1000) / 60); | ||||
| 		} | ||||
| 		 | ||||
| 		// TODO update endTime label | ||||
| 		// update endTime label | ||||
| 		lblEndTime.setText(String.format("%d:%02d:%02d",  | ||||
| 				TimeUnit.MILLISECONDS.toHours(endTime) % 24, | ||||
| 				TimeUnit.MILLISECONDS.toMinutes(endTime) % 60,  | ||||
| 				TimeUnit.MILLISECONDS.toSeconds(endTime) % 60)); | ||||
| 		 | ||||
| 		System.out.println(endTime / 1000); | ||||
|  | ||||
| 		// 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 | ||||
| @ -300,10 +312,10 @@ public class PlayerController { | ||||
| 	 | ||||
| 	@FXML | ||||
| 	void nextEpBtnAction(ActionEvent event) { | ||||
| 		autoPlayNewFilm(); // TODO | ||||
| 		playNextMedia(); // TODO | ||||
| 	} | ||||
| 	 | ||||
| 	private void autoPlayNewFilm() { | ||||
| 	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); | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| <?import com.jfoenix.controls.JFXButton?> | ||||
| <?import com.jfoenix.controls.JFXSlider?> | ||||
| <?import javafx.geometry.Insets?> | ||||
| <?import javafx.scene.control.Label?> | ||||
| <?import javafx.scene.image.Image?> | ||||
| <?import javafx.scene.image.ImageView?> | ||||
| <?import javafx.scene.layout.AnchorPane?> | ||||
| @ -19,13 +20,41 @@ | ||||
|             <ImageView fx:id="videoImageView" pickOnBounds="true" preserveRatio="true" /> | ||||
|          </children> | ||||
|       </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> | ||||
|                <graphic> | ||||
|                   <ImageView pickOnBounds="true" preserveRatio="true" /> | ||||
|                </graphic> | ||||
|             </JFXButton> | ||||
|             <Label fx:id="lblTitle" text="Title" textFill="WHITE"> | ||||
|                <font> | ||||
|                   <Font size="20.0" /> | ||||
|                </font> | ||||
|             </Label> | ||||
|          </children> | ||||
|          <padding> | ||||
|             <Insets left="5.0" right="5.0" top="5.0" /> | ||||
|          </padding> | ||||
|       </HBox> | ||||
|       <VBox fx:id="bottomVBox" alignment="CENTER" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"> | ||||
|          <children> | ||||
|             <JFXSlider fx:id="timeSlider"> | ||||
|             <HBox spacing="10.0"> | ||||
|                <children> | ||||
|                   <JFXSlider fx:id="timeSlider" HBox.hgrow="ALWAYS"> | ||||
|                      <padding> | ||||
|                         <Insets left="5.0" right="5.0" /> | ||||
|                      </padding> | ||||
|                   </JFXSlider> | ||||
|                   <Label fx:id="lblEndTime" text="0:00:00" textFill="WHITE" /> | ||||
|                </children> | ||||
|                <VBox.margin> | ||||
|                   <Insets /> | ||||
|                </VBox.margin> | ||||
|                <padding> | ||||
|                   <Insets left="5.0" right="5.0" /> | ||||
|                   <Insets left="10.0" right="10.0" /> | ||||
|                </padding> | ||||
|             </JFXSlider> | ||||
|             </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;"> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user