Expand description
Video: the Video widget, a local video file played in place, and the
VideoBackend it plays through.
Experimental: may change in any release
(docs/stability.md).
use egui_pop_views::video::{Controls, Fit, Video};
fn ui(ui: &mut egui::Ui) {
// A tutorial, with every control.
Video::new("/usr/share/app/tour.webm").id("tour").show(ui);
// A preview: no controls, playing at once, again and again, silent.
Video::new("/usr/share/app/gesture.webm")
.controls(Controls::None)
.autoplay(true)
.looping(true)
.muted(true)
.fit(Fit::Cover)
.size(egui::vec2(240.0, 135.0))
.show(ui);
}- Players: each widget has its own (one pipeline per video), opened
when it is first drawn and paused on its first picture, unless it plays
at once (
Video::autoplay). The backend is GStreamer with thevideofeature, none without it or on the web: the widget then draws a placeholder saying so, with Open outside.Video::backendgives another (a host’s own player, a test’s pretend one). - Off the interface’s thread: the player decodes on its own threads and keeps the last frame; each pass takes that one and uploads it, whatever the player decoded in between.
- Repaints: the player asks for one when a frame or an event arrives, the widget for one a few times a second while playing, for the time. Paused, ended or loading, nothing keeps the application awake.
- Out of view: a widget no longer drawn (a page left, a panel closed, a
tab behind another) has its player stopped after a few passes; drawn
again, it opens the file at the same place, paused (playing, with
Video::autoplay). - Controls (
Controls):Full(the position on a row of its own; Play or Pause, the time and the volume under it),Compact(Play or Pause, the position and the time on one row),None(the picture only). A click on the picture plays or pauses, except without controls. - Keys, while the picture has the focus (it is a Tab stop with
controls): Space plays or pauses, Left and Right move by
SEEK_STEP, Up and Down change the volume byVOLUME_STEP. A key an application binds on the picture’s surface (Video::surface) runs its command instead, as the viewer’s do. - Loops (
Video::looping): the player loops by itself when it can (VideoPlayer::set_looping; GStreamer’s does, without a gap), else the widget seeks back to the start at the end. - Agents: a widget given an
idis listed by thevideoscollector and driven by thevideo.*commands (VideoPlugin); its accessible node is a video named after the file (orVideo::label).
Structs§
- Video
- A local video file played in place. Its state (the player, the position,
the volume) lives in the context, by
id, from one pass to the next. - Video
Frame - A picture to show.
- Video
Output - What a video did this pass.
- Video
Plugin - Declares the
video.*commands and thevideoscollector. Connect it when an application’s videos should be read and driven by agents; the widgets play without it. - Video
Request - What a backend is asked to open.
- Video
Status - What a player says of itself.
- Videos
- The videos drawn in a context, by id: what the
video.*commands and thevideoscollector reach, and the viewer’s video page.
Enums§
- Controls
- Which controls a video draws under its picture.
- Fit
- How the picture fills the widget.
- Video
State - Where a player is.
Constants§
- CMD_
MUTE - CMD_
PAUSE - CMD_
PLAY - CMD_
SEEK - CMD_
TOGGLE - CMD_
VOLUME - PLUGIN
- The plugin’s id.
- SEEK_
STEP - What Left and Right move the position by.
- SURFACE
- The surface a video’s picture opens by default, for key bindings
(
videoFocus). - VOLUME_
STEP - What Up and Down change the volume by.
Traits§
- Video
Backend - What opens videos (
Video::backend, and the viewer’s). - Video
Player - A video being played. A failure’s text is shown in place of the picture (the viewer’s error page, for the viewer’s video).
Functions§
- clock
- A time as a clock:
0:05,12:30,1:02:03. - default_
backend - The backend of this build: GStreamer with the
videofeature (not on the web), none otherwise. - rgba_
image - An RGBA picture from rows
stridebytes apart, for a backend:Nonewhen the bytes do not hold it.