OSD stat message refresh

Discuss your Lua playlist, album art and interface scripts.
ali92i
New Cone
New Cone
Posts: 1
Joined: 04 Mar 2014 22:47

OSD stat message refresh

Postby ali92i » 14 Mar 2014 11:10

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 ?

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: OSD stat message refresh

Postby mederi » 14 Mar 2014 16:59

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.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 5 guests