Timeline
Introduction
Timeline
widget is used to display video timeline. It can be used to get current frame and display information about the frame or it's annotation.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Timeline frames count |
|
| Frame intervals |
|
| Intervals colors in |
|
| Timeline height in |
|
| Color of the pointer |
|
| Content of the tooltip |
|
| ID of the widget |
frames_count
Timeline (video) frames count.
type: int
intervals
Set frame intervals. Each interval is a list of two integers: [start_frame, end_frame]
. Intervals and color lists must be the same length.
type: List[List[int]]
colors
Set interval colors in hex
color codes. Intervals and color lists must be the same length.
type: List[str]
height
Set widget height in px
.
type: str
default value: 30px
pointer_color
Color of the pointer. Set hex color code or None
to use the default color.
type: str
default value: None
tooltip_content
Content of Tooltip.
type: Widget
default value: None
widget_id
ID of the widget.
type: str
default value: None
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/controls/008_timeline/src/main.py
Import libraries
Write a function for dividing the total number of frames by ranges
Write function generating random hex colors for each range
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize Video ID
we will use
Video ID
we will useGet video info from server and prepare VideoThumbnail widget
Get video intervals and colors from video frame count
Initialize Timeline widget
Create InputNumber widget for setting current frame
Create Timeline container
Create app layout
Create app using layout
Create an app object with layout parameter.
Add callbacks for changing the current frame
Last updated