diplomat.wx_gui.video_player.VideoPlayer¶
- class diplomat.wx_gui.video_player.VideoPlayer(*args: Any, **kwargs: Any)[source]¶
Bases:
ControlA video player for wx Widgets, Using cv2 for solid cross-platform video support. Can play video, but no audio.
- __init__(parent, w_id=wx.ID_ANY, video_hdl: VideoCapture = None, crop_box: Tuple[int, int, int, int] | None = None, zoom_config: ZoomConfig | None = None, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.BORDER_DEFAULT, validator=wx.DefaultValidator, name='VideoPlayer')[source]¶
Create a new VideoPlayer
- Parameters:
parent – The wx Control Parent.
w_id – The wx ID.
video_hdl – The cv2 VideoCapture to play video from. One should avoid never manipulate the video capture once passed to this constructor, as the handle will be passed to another thread for fast video loading.
crop_box – Tuple of ints, x, y, width, height, being the area of the video to show instead of the entire video. if set to None, just shows the entire video…
pos – The position of the widget.
size – The size of the widget.
style – The style of the widget.
validator – The widgets validator.
name – The name of the widget.
Methods
__init__(parent[, w_id, video_hdl, ...])Create a new VideoPlayer
freeze()Freeze the video player, immediately pausing the video and making it unresponsive to play/pause/stop commands, and also frame changing methods.
Get the current frame index we are at in the video.
Get the total number of frames in this video.
Check whether this video is frozen.
Returns whether or not the video is currently playing.
move_back([amount])Move backward a given amount of frames.
move_forward([amount])Move forward a given amount of frames.
on_draw(dc)Draws the widget.
on_paint(event)Run on a paint event, redraws the widget.
pause()Pause the video.
play()Play the video.
set_offset_frames(value)Set the current frame offset location into the video.
stop()Stop the video.
unfreeze()Unfreeze the video, allowing controls to work again.
Attributes
BACK_LOAD_AMTEVT_FRAME_CHANGEEVT_PLAY_STATE_CHANGEFrameChangeEventMAX_FAST_FORWARD_MODEPlayStateChangeEventvideo_transform- _on_timer(event, trigger_run=True)[source]¶
PRIVATE: Executed whenever a timer event occurs, which triggers a video frame update if the video is playing.
- freeze()[source]¶
Freeze the video player, immediately pausing the video and making it unresponsive to play/pause/stop commands, and also frame changing methods.
- get_offset_count()[source]¶
Get the current frame index we are at in the video.
- Returns:
An integer, the frame offset.
- get_total_frames()[source]¶
Get the total number of frames in this video.
- Returns:
An integer being the total frame count of the video.
- is_frozen() bool[source]¶
Check whether this video is frozen.
- Returns:
True is this video is frozen and therefore will not respond to any play/pause/stop commands, or False otherwise.
- move_back(amount: int = 1)[source]¶
Move backward a given amount of frames.
- Parameters:
amount – A non-negative integer. Being how many frames to move backward. Defaults to 1. Can be 0, does nothing if so.
- move_forward(amount: int = 1)[source]¶
Move forward a given amount of frames.
- Parameters:
amount – A non-negative integer. Being how many frames to move forward. Defaults to 1. Can be 0, does nothing if so.