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

Discuss your Lua playlist, album art and interface scripts.
mridang
New Cone
New Cone
Posts: 1
Joined: 03 Apr 2013 19:06

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

Postby mridang » 03 Apr 2013 19:12

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.

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: How can I get events when the media is played or paused?

Postby mederi » 03 Apr 2013 21:28

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.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 16 guests