This document is deprecated, please go to Tuya Developer Documentation Center to view the latest version: Tuya Smart Doc - Android SDK

1.1. Timeline View

When the timeline component uses video playback or cloud storage video playback, it linearly displays the video recording time points that can be played. You can slide the timeline to accurately locate the time point and segment to start playing.

Timeline View

1.1.1. Integrate

dependencies {
    implementation ''

Class and Interface

Class(Interface) Description
TuyaTimelineView Timeline view
OnBarMoveListener Timeline drag listener
OnSelectedTimeListener Timeline select listener

1.2. Introduction

1.2.1. TuyaTimelineView


Name Description
topTextMargin Margin top of text
bottomTextMargin Margin bottom of text
smallRulerHeight Height of short tick mark
timeScaleColor Color of time text string
linesColor Color of tick mark
bubbleColor Background color of bubble
bubbleTextColor Color of bubble text
landscapeBgColor Background color in landscape
portraitBgColor Background color in portrait


Set the colors of the data rendering in the timeline

void setContentShader(Shader contentShader)


Set time zone

void setTimeZone(TimeZone zone)


There will be a bubble text showing the current time When dragging

Set whether to display bubble text

void setShowBubbleWhenDrag(boolean show)


Set the width of a time unit in px, two long tick marks represent a time unit

void setSpacePerUnit(int spacePerUnit)


Time unit mode, currently there are three, one time unit is 60 seconds, 600 seconds, 3600 seconds

void setUnitMode(TimelineUnitMode mode)


Enum Description
TimelineUnitMode.Mode_60 one time unit is 60 seconds
TimelineUnitMode.Mode_600 one time unit is 600 seconds
TimelineUnitMode.Mode_3600 one time unit is 3600 seconds


Set whether to display time text

void setShowTimeText(boolean showTimeText)


Set whether to show short tick marks

void setShowShortMark(boolean showShortMark)


Selection mode switch

void showSelectTimeArea(boolean open)


Set the length of time that the selection box can be selected

void setSelectTimeAreaRange(long min, long max)
Parameter Description
min The minimum length of time
max The maximum length of time


Set the background color of the timeline selection box

void setSelectionBoxColor(int color)


Set the color of the vertical line of the timeline selection box

void setSelectCenterColor(int selectCenterColor)


Is in selection mode

boolean isSelectionEnabled()


timeline Config,

void setCurrentTimeConfig(long currentTimeInMillisecond)


Set the current time of the timeline in ms

void setCurrentTimeInMillisecond(long currentTimeInMillisecond)


Set am/pm string of bubble text in 12-hour format

void setTimeAmPmString(String timeAmString, String timePmString)


Set the timeline source data array

void setRecordDataExistTimeClipsList(List<TimeBean> source)


Turn on automatically find the next segment to play

public void setCanQueryData()


Set whether to allow searching for the next segment

public synchronized void setQueryNewVideoData(boolean var1)

1.2.2. OnBarMoveListener


Callback when dragging starts

void onBarActionDown()


Callback when dragging

void onBarMove(long screenLeftTime, long screenRightTime, long currentTime)


Parameter Description
screenLeftTime The time represented on the far left of the screen
screenRightTime The time represented on the far right of the screen
currentTime Current time


Callback when the timeline drag is over, when the drag is over, it will automatically find the segment data that can be played

void onBarMoveFinish(long startTime, long endTime, long currentTime)


Parameter Description
startTime The start time of the fragment data, if there is no fragment data, it will return -1
endTime The end time of the fragment data, if there is no fragment data, it will return -1
currentTime Time when dragging stopped, if there is no fragment data, it will return -1

1.2.3. OnSelectedTimeListener


Callback when dragging in selection mode

void onDragging(long selectStartTime, long selectEndTime)


Parameter Description
selectStartTime Selected start time
selectEndTime Selected end time

results matching ""

    No results matching ""