How to refresh regularly (1 second in the example) the OSD message to regularly get stats for the streaming link (input_bitrate,...)
I'm very beginner in Lua scripting, I tryed this code but it display the message only one time and it doesn't refresh the data, i already read in the forum that the vlc.misc.mwait function don't work on VLC 2.x.x (2.1.3 in my case)
Code: Select all
function meta_changed()
-- related to capabilities={"meta-listener"} in descriptor()
-- triggered by available media input meta data?
local channel1 = vlc.osd.channel_register()
local channel = vlc.osd.channel_register()
while vlc.input.is_playing() do
local systemTime = os.date("%H:%M:%S")
vlc.osd.message(systemTime,channel1,"top-right",5000000)
vlc.osd.message(get_stat(),channel,"top-left",5000000)
sleep(1)
end
end
function get_stat()
local input_item = vlc.input.item()
local stat = input_item:stats()
return stat.input_bitrate
end
function sleep(sec)
local t = vlc.misc.mdate()
vlc.misc.mwait(t + sec*1000*1000)
end