Video Player
Plays the video files that are scored by Glitter.
- class glitter2.player.GlitterPlayer(app, **kwargs)
Bases:
kivy._event.EventDispatcher
Player that reads the video file and sends frames as they need to be displayed.
- app = None
The Glitter app.
- callback_opening()
Handles the player callback (
_frame_trigger
) when the player is in “opening” mode.
- callback_playing()
Handles the player callback (
_frame_trigger
) when the player is in “playing” mode.
- callback_seeking(state)
Handles the player callback (
_frame_trigger
) when the player is in “seeking_paused” mode.
- close_file()
Closes and stops playing the current file, if any.
- duration: float
The duration of of the video, set once the file is open. Read only.
- ff_player: Optional[ffpyplayer.player.player.MediaPlayer] = None
The video player, once file is opened.
- filename
Full path to the video file. Read only.
- classmethod get_file_data(filename: str, metadata_only: bool = False) Tuple[List[float], dict]
Returns the timestamps and metadata of the video file.
- get_play_rate_text(rate: float) str
Converts the given play rate to a string, forcing the value between 0.1 and 10.
- get_slider_log_play_rate(rate: float) float
Converts the given rate to 10 base log, forcing the value between -1 and 1.
- gui_play_button_press()
Plays or pauses the video in response to the user pressing the play button in the GUI.
- last_frame_pts: float
The timestamp (pts) in video time of the last shown frame.
- open_file(filename)
Opens and starts playing the given file.
- Parameters
filename – The full path to the video file.
- paused
Whether we are currently paused. Read only.
- play_rate
The playing rate with which we play the video.
- player_on_key_down(window, keycode, text, modifiers)
Handles any key down presses from the GUI that controls the player.
- player_on_key_up(window, keycode)
Handles any key up presses from the GUI that controls the player.
- player_state: str
The current state of the player.
Can be one of opening, seeking_paused, seeking, none, playing, finished, paused.
- reached_end
True when the video file has finished playing the file and reached the end.
- reopen_file()
Closes and re-opens the video file.
- seek(t, relative=False)
Seeks the video to given timestamp.
- Parameters
t – The timestamp in video time.
relative – The timestamp in video time.
- seek_duration = 10
How many seconds to seek from a right/left arrow button.
- set_log_play_rate(val: float)
Sets the
play_rate
fromval
when it is given in 10 base log. Theval
is forced between -1 to 1 first.
- set_pause(pause)
Sets the video player to pause/unpause.
- Parameters
pause – Whether to pause/unpause.
- video_size: Optional[Tuple[int, int]] = None
The size of the video frames, set once the file is open. Read only.