Advertisement
Guest User

speedwatching.lua with toggle

a guest
Aug 9th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. local speedwatching = false
  2.  
  3. function onsub(name, text)
  4.   if text == null or text == "" then
  5.     mp.set_property_native("speed", 2.0)
  6.   else
  7.     mp.set_property_native("speed", 1.5)
  8.   end
  9. end
  10.  
  11. function toggle()
  12.   if speedwatching then
  13.     mp.unobserve_property(onsub)
  14.     mp.set_property_native("speed", 1)
  15.     speedwatching = false
  16.   else
  17.     mp.observe_property("sub-text", "string", onsub);
  18.     speedwatching = true
  19.   end
  20. end
  21.  
  22. mp.add_key_binding("H", "speedwatching", toggle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement