Page 1 of 1

How can I get events when the media is played or paused?

Posted: 03 Apr 2013 19:12
by mridang
I'd like a like to write a simple VLC extension that sends the filename to my website when a video/song is played in VLC. It's very similar to a scrobbling plugin.

It's very simple extension but I'd like to get events in my Lua script when the current media is "played", when it is "paused", when it is "stopped" or when it is "skipped". Can i hook my Lua script into these events? I've never written an extension for VLC before and I've never worked with Lua but I have a fair bit of programming experience and with the write nudge, I think I'll manage this quite well but I'm very, very lost right now. Any help? Thanks everyone.

Re: How can I get events when the media is played or paused?

Posted: 03 Apr 2013 21:28
by mederi
Please check the template of extension script right here: viewtopic.php?f=29&t=98644#p343091

Code: Select all

function descriptor() return { ... capabilities = {"input-listener", "playing-listener"} } end ... function input_changed() -- related to capabilities={"input-listener"} in descriptor() -- triggered by Start/Stop media input event end function playing_changed() -- related to capabilities={"playing-listener"} in descriptor() -- triggered by Pause/Play madia input event end ...
You can use/test it this way: viewtopic.php?f=29&t=109367#p370676 There you can also evaluate "var, old, new" variables in function input_events_handler(var, old, new, data). Then you can play yourself with vlc.playlist.status() like I did in function Pause_playback() in Previous frame.