|
|
@ -112,13 +112,17 @@ return function(opts) |
|
|
|
} |
|
|
|
} |
|
|
|
playlist:Object({ w = 3, h = 1 }) -- spacer |
|
|
|
playlist:Object({ w = 3, h = 1 }) -- spacer |
|
|
|
|
|
|
|
|
|
|
|
local scrubber = screen.root:Bar { |
|
|
|
local scrubber = screen.root:Slider { |
|
|
|
w = lvgl.PCT(100), |
|
|
|
w = lvgl.PCT(100), |
|
|
|
h = 5, |
|
|
|
h = 5, |
|
|
|
range = { min = 0, max = 100 }, |
|
|
|
range = { min = 0, max = 100 }, |
|
|
|
value = 0, |
|
|
|
value = 0, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scrubber:onevent(lvgl.EVENT.RELEASED, function() |
|
|
|
|
|
|
|
playback.position:set(scrubber:value()) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
local controls = screen.root:Object { |
|
|
|
local controls = screen.root:Object { |
|
|
|
flex = { |
|
|
|
flex = { |
|
|
|
flex_direction = "row", |
|
|
|
flex_direction = "row", |
|
|
@ -147,8 +151,7 @@ return function(opts) |
|
|
|
|
|
|
|
|
|
|
|
local play_pause_btn = controls:Button {} |
|
|
|
local play_pause_btn = controls:Button {} |
|
|
|
play_pause_btn:onClicked(function() |
|
|
|
play_pause_btn:onClicked(function() |
|
|
|
--playback.playing:set(not playback.playing:get()) |
|
|
|
playback.playing:set(not playback.playing:get()) |
|
|
|
playback.position:set(playback.position:get() + 5) |
|
|
|
|
|
|
|
end) |
|
|
|
end) |
|
|
|
play_pause_btn:focus() |
|
|
|
play_pause_btn:focus() |
|
|
|
local play_pause_img = play_pause_btn:Image { src = img.pause } |
|
|
|
local play_pause_img = play_pause_btn:Image { src = img.pause } |
|
|
@ -183,7 +186,9 @@ return function(opts) |
|
|
|
cur_time:set { |
|
|
|
cur_time:set { |
|
|
|
text = format_time(pos) |
|
|
|
text = format_time(pos) |
|
|
|
} |
|
|
|
} |
|
|
|
scrubber:set { value = pos } |
|
|
|
if not scrubber:is_dragged() then |
|
|
|
|
|
|
|
scrubber:set { value = pos } |
|
|
|
|
|
|
|
end |
|
|
|
end), |
|
|
|
end), |
|
|
|
playback.track:bind(function(track) |
|
|
|
playback.track:bind(function(track) |
|
|
|
if not track then return end |
|
|
|
if not track then return end |
|
|
|