Reference Codebot.Render.Widgets.Video.pas
Part of the Codebot Render package
The Codebot.Render.Widgets.Video unit gives you TVideoWidget, which plays a video from a file or a URL using libmpv. Set FileName and call Play. The video is scaled to fit the widget and keeps its shape, with black bars where it doesn't fill it.
Pause holds the video where it is, Play continues it, and Stop unloads it so Play starts again from the beginning. Position is where the video is in seconds and can be set to seek, and Duration is how long it is. When the video ends OnPlayComplete is invoked, and if AutoRestart is True the video plays again from the start. Pictures and events are taken from the player when the widget is painted, so OnPlayComplete doesn't fire while the widget is hidden, though the sound keeps playing.
The sound is played by libmpv itself, not by Codebot.Hardware. Volume sets how loud it is from 0 to 1, Muted silences it, and HasAudio tells you whether the video has sound. Effect lets you change how the video looks with a GLSL fragment shader, written the way Shadertoy shaders are.
The unit is only included when videowidget is defined in render.inc, which it is by default except on macOS.
Items 23 items
| Name | Kind | Line |
|---|---|---|
| TVideoState | enum | 78 |
| videoStopped | enum value | 78 |
| videoPlaying | enum value | 78 |
| videoPaused | enum value | 78 |
| TVideoWidget | class | 82 |
| Create | constructor | 141 |
| Destroy | destructor | 142 |
| Paint | procedure | 139 |
| Pause | procedure | 146 |
| Play | procedure | 144 |
| Stop | procedure | 148 |
| AutoRestart | property | 159 |
| Available | property | 174 |
| Duration | property | 155 |
| Effect | property | 170 |
| EffectError | property | 172 |
| FileName | property | 151 |
| HasAudio | property | 162 |
| Muted | property | 167 |
| OnPlayComplete | property | 176 |
| Position | property | 153 |
| State | property | 157 |
| Volume | property | 165 |