I am a novice, but I have been attempting to write an LUA script which will get the current video's time, subtract .0416 (roughly 1/24 of a second to simulate backing up a frame), and move the playback to the new time. For a few days I have been working at this end with no success! I do not understand quite how to get the script to run. I have also decompiled hotkeys.luac and attempted to add the F12 hotkey to this function using the sample. I thank any of you for your time and efforts to help me. Here is my code:
Code: Select all
local common = require ("common")
bindings = {
["F12] = "Previous"
}
function prevframe() --Time altering function
local input = vlc.object.input()
vlc.playlist.pause()
var.get(input,"time")
skip_back ="time"-.0416
vlc.var.set(input, "time", skip_back)
end
--all below taken and modified from hotkeys.luac
function action(func, delta)
return {
func = func,
delta = delta or 0,
last = 0,
times = 0
}
end
actions = {
["Previous"] = action(prevframe)
}
action = nil
queue = {}
function action_trigger(action)
print("action_trigger:", tostring(action))
local a = actions[action]
if a then
do
local ok, msg = pcall(a.func)
if not ok then
vlc.msg.err("Error while executing action `")
end
end
else
vlc.msg.err("Key `" .. key .. "' points to unknown action ")
end
end
function key_press(var, old, key, data)
print("key_press:", tostring(key))
if bindings[key] then
action_trigger(bindings[key])
else
vlc.msg.err("Key `" .. key .. "' isn't bound to any action.")
end
end
vlc.var.add_callback(vlc.object.libvlc(), "key-pressed", key_press)
while true do
repeat
until not vlc.misc.lock_and_wait()
end
vlc.var.del_callback(vlc.object.libvlc(), "key-pressed", key_press)
Rob