Page 1 of 1

OSD stat message refresh

Posted: 14 Mar 2014 11:10
by ali92i
Hello all,

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
What can I use in my case ?

Re: OSD stat message refresh

Posted: 14 Mar 2014 16:59
by mederi
vlc.misc.mwait() is available in interface scripts. It is available in extensions scripts in VLC-1.1.x.
VLC-2.0.x, while playing media:

Code: Select all

... vlc.var.add_callback(vlc.object.input(), "intf-event", input_events_handler, "Hello world!") ... function input_events_handler(var, old, new, data) ... end
Check Time (lite) extension.