Video
Introduction
Video
widget in Supervisely is a custom player designed for displaying videos and annotations frame-by-frame. It allows to play, pause, rewind, and fast-forward videos, as well as move through them frame by frame. It is a powerful tool for visualizing and analyzing video data with annotations.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
|
|
|
| ID of the widget |
video_id
Determines Video
ID, used in Video
widget.
type: int
default value: None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Get |
| Get or set |
| Set video in |
| Set video player to given frame. |
| Get current video player frame. |
| Return number of frames in video. |
| Decodator function is handled when video start to play. |
| Decodator function is handled when video stopped. |
| Decodator function is handled when a frame index is being changed. |
| Decodator function is handled when there was no change in frame index for the last second. |
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/media/004_video/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Get Video ID from environment variables
Get VideoInfo
from server
VideoInfo
from serverInitialize Video
widget we will use in UI
Video
widget we will use in UIInitialize buttons to control widget
Create app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Handle button clicks
Use the decorator as shown below to handle button click. We have 6 buttons: to play video, to stop video, to change video frame, to stop change video frame, to set random frame, to download video.
Last updated