[Extension] Click screen to PAUSE / PLAY

Discuss your Lua playlist, album art and interface scripts.
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

[Extension] Click screen to PAUSE / PLAY

Postby mederi » 02 Feb 2013 15:29

Code: Select all

-- "click screen to pause.lua" -- VLC2.0.x Extension script function descriptor() return { title = "Click screen to PAUSE / PLAY" } end function activate() vlc.var.add_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end function deactivate() vlc.var.del_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end function mouse_press( var, old, new, data ) vlc.msg.info("[Click screen to PAUSE / PLAY] var: "..tostring(var).." / old: "..tostring(old).." / new: "..tostring(new)) if old==0 and new==1 then vlc.playlist.pause() end end
If you need some installation insctructions, then you can find them for example here: http://addons.videolan.org/content/show ... ent=156396

I think that it works quite well and with possible VLC ability of automatic start of extensions it would be just great. It is optional and easy to enable/disable it from VLC menu: View > Click screen to PAUSE / PLAY

mbaker72
New Cone
New Cone
Posts: 1
Joined: 03 Apr 2013 16:49

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby mbaker72 » 03 Apr 2013 16:53

Great Plugin! Thank you, just what I've been looking for!

Is there a way to activate the Plugin by default so that it is activated every time I launch VLC - instead of activating it via "View/Enable"?

Kind regards!

//MB

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: VLC Extension: Click screen to PAUSE / PLAY

Postby mederi » 03 Apr 2013 21:44

Auto-load of extensions is possible but not implemented yet.
Ticket #3883
Auto-load support for Lua extensions
http://trac.videolan.org/vlc/ticket/3883
This extension is not complete yet (if no vout object, if play another input), but it works and everybody can test behaviour and interaction with other features in VLC. Perhaps later this feature could be implemented in VLC by some willing developer.

snark.real
Blank Cone
Blank Cone
Posts: 11
Joined: 13 Mar 2013 13:07
VLC version: 2.0.5 Twoflower
Operating System: Arch Linux

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby snark.real » 08 Apr 2013 23:13

This is very nice idea! Grats!
I've fixed and extended this plugin a little bit.
Now you need to turn it on only once. And yes, autostarting of addons would be very handy.

Code: Select all

-- "clickpause.lua" -- VLC2.0.x Extension script DEBUG = false function descriptor() return { title = "Click screen to PAUSE / PLAY"; capabilities = { "input-listener" }; } end function d_log(...) local out = "" if not DEBUG then return end for i,v in ipairs(arg) do out = out .. " " .. v end vlc.msg.info(out) end function activate() if vlc.object.input() then vlc.var.add_callback( vlc.object.vout(), "mouse-button-down", mouse_press) no_input = false else no_input = true end end function deactivate() if vlc.object.input() then vlc.var.del_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end end function mouse_press( var, old, new, data ) d_log("[Click screen to PAUSE / PLAY] var: "..tostring(var).." / old: "..tostring(old).." / new: "..tostring(new)) if old==0 and new==1 then vlc.playlist.pause() end end function input_changed() no_input = not not vlc.object.input() d_log("input changed", "no_input " .. tostring(no_input)) end function meta_changed() d_log("meta changed " .. " no_input " .. tostring(no_input) .. " input " .. tostring(not not vlc.object.input())) if no_input and not not vlc.object.input() then vlc.var.add_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end no_input = false end

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: VLC Extension: Click screen to PAUSE / PLAY

Postby mederi » 09 Apr 2013 23:18

This way the extension pauses video only in every other playlist item for me.

snark.real
Blank Cone
Blank Cone
Posts: 11
Joined: 13 Mar 2013 13:07
VLC version: 2.0.5 Twoflower
Operating System: Arch Linux

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby snark.real » 10 Apr 2013 02:26

This way the extension pauses video only in every other playlist item for me.
Yeap, that was a bug. I haven't tested it with playlists, because I don't use them.
Fix is small, but I'll post it again, because I can not edit previous post

Code: Select all

-- "clickpause.lua" -- VLC2.0.x Extension script DEBUG = false function descriptor() return { title = "Click screen to PAUSE / PLAY"; capabilities = { "input-listener" }; } end function d_log(...) local out = "" if not DEBUG then return end for i,v in ipairs(arg) do out = out .. " " .. v end vlc.msg.info(out) end function activate() if vlc.object.input() then vlc.var.add_callback( vlc.object.vout(), "mouse-button-down", mouse_press) no_input = false else no_input = true end end function deactivate() if vlc.object.input() then pcall(vlc.var.del_callback, vlc.object.vout(), "mouse-button-down", mouse_press) end end function mouse_press( var, old, new, data ) d_log("[Click screen to PAUSE / PLAY] var: "..tostring(var).." / old: "..tostring(old).." / new: "..tostring(new)) if old==0 and new==1 then vlc.playlist.pause() end end function input_changed() no_input = not not vlc.object.input() d_log("input changed", "no_input " .. tostring(no_input)) end function meta_changed() d_log("meta changed " .. " no_input " .. tostring(no_input) .. " input " .. tostring(not not vlc.object.input())) if no_input and not not vlc.object.input() then pcall(vlc.var.del_callback, vlc.object.vout(), "mouse-button-down", mouse_press) vlc.var.add_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end no_input = false end
BTW, meredi, do you care if I put this code somewhere, (under MIT license, for example) and mention you in credits?
Because forum is not a VCS :)

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: VLC Extension: Click screen to PAUSE / PLAY

Postby mederi » 10 Apr 2013 14:38

Thank you. Now the extension is ready for publishing on http://addons.videolan.org Please do it.

snark.real
Blank Cone
Blank Cone
Posts: 11
Joined: 13 Mar 2013 13:07
VLC version: 2.0.5 Twoflower
Operating System: Arch Linux

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby snark.real » 19 Apr 2013 14:02


One second
New Cone
New Cone
Posts: 1
Joined: 02 Oct 2013 16:42

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby One second » 02 Oct 2013 16:53

thanks
this plugin is very nice
by the way
i little changed code to not pause when i doubleclick
to become fullscreen.
goodbye:)

Code: Select all

function mouse_press( var, old, new, data ) if old==0 and new==1 then time1=os.clock() end if old==1 and new==0 then if os.clock()-time1 > 0.07 then vlc.playlist.pause() end --vlc.msg.info(os.clock()-time1) end end

mg2
New Cone
New Cone
Posts: 1
Joined: 09 Mar 2014 01:29

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby mg2 » 09 Mar 2014 01:32

Not working on 2.1.3 :( Any suggestions?

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: VLC Extension: Click screen to PAUSE / PLAY

Postby mederi » 14 Mar 2014 16:30

It works with VLC-2.0.x
Here is the related ticket for somebody able/willing to restore the function:
Ticket #8097: Lua Extensions, VLC2.1: var.add_callback( ), var.del_callback( ) do not work

zzzk
New Cone
New Cone
Posts: 6
Joined: 02 Jun 2011 20:43

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby zzzk » 31 Mar 2014 07:18

PLEASE add this function back! To me, this function should be default! Also resume option for videos should be default! Or at least allow add-ons to do this function. I can't find one for the 2.1 version. Thank you. :( :( :( :(

talismancer
New Cone
New Cone
Posts: 1
Joined: 18 Jun 2014 09:15

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby talismancer » 18 Jun 2014 09:30

bump...this should be VLC's default behaviour (along with auto-loading extensions)

vstar
New Cone
New Cone
Posts: 7
Joined: 24 Jul 2014 05:43

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby vstar » 31 Jul 2014 07:24

This function should be default or included in the settings with vlc player. I am looking for this function too.

snark.real
Blank Cone
Blank Cone
Posts: 11
Joined: 13 Mar 2013 13:07
VLC version: 2.0.5 Twoflower
Operating System: Arch Linux

Re: VLC Extension: Click screen to PAUSE / PLAY

Postby snark.real » 08 Sep 2014 13:08

I know, guys, that you like this extension. So do I. But things changed.
The problem with extension is that callbacks were removed because they were supposedly causing unstable behavior of VLC.
I don't feel like I can judge Jean-Baptist for removing callbacks from lua api from VLC2.0.1, because he is leading this project successfully for too long, he know it's ins and outs a lot better than I do. But I were him, I wouldn't break API before "proper implementation" will arise.
What are our options now?
* Find a c++ developer wiling to fix Ticket #8097 and raise donations for paying for his work. This could be a long-term investment and improve extension API a lot once and forever. (Lua API needs proper support for threads, timers and other multi-tasking stuff).
* Try to convince Jean-Baptist to add callbacks back with little to no success and continue whining on.
* Try to do something yourself.
There is a great quote by mederi:
If you find this forum and this thread, you have enough information here to start writing your own scripts. All you need is "README.txt", Lua manual and some programming skills. Then you have described structure of extension and playlist scripts here, example scripts all around, ideas and problems discussed on the forum here. All useful links are provided. How would you like to start without reading and learning?

However, there are still some secrets waiting to be discovered. The problem is that the original VLC Lua hobbyist developer left the project a few years ago and never "finished" the Lua support. So all we can do is to support each other and VLC developers working on this open source project in their free time.
So if you really feel for this feature, raise your voice, and together we can change VLC for the better!

VLmurphy
Blank Cone
Blank Cone
Posts: 13
Joined: 06 Jul 2012 02:43

Re: [Extension] Click screen to PAUSE / PLAY

Postby VLmurphy » 10 Sep 2016 20:22

From what I read above, is it correct to say that you don't even have to bother trying out the extensions posted here, because they won't work anymore with current VLC versions anyway?

I originally followed the discussion in this (9-year-old) thread and took it further there.

jgt1942
Blank Cone
Blank Cone
Posts: 21
Joined: 03 Jan 2014 08:50
Operating System: Windows

Re: [Extension] Click screen to PAUSE / PLAY

Postby jgt1942 » 18 Oct 2016 09:18

Code: Select all

-- "click screen to pause.lua" -- VLC2.0.x Extension script function descriptor() return { title = "Click screen to PAUSE / PLAY" } end function activate() vlc.var.add_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end function deactivate() vlc.var.del_callback( vlc.object.vout(), "mouse-button-down", mouse_press) end function mouse_press( var, old, new, data ) vlc.msg.info("[Click screen to PAUSE / PLAY] var: "..tostring(var).." / old: "..tostring(old).." / new: "..tostring(new)) if old==0 and new==1 then vlc.playlist.pause() end end
If you need some installation insctructions, then you can find them for example here: http://addons.videolan.org/content/show ... ent=156396

I think that it works quite well and with possible VLC ability of automatic start of extensions it would be just great. It is optional and easy to enable/disable it from VLC menu: View > Click screen to PAUSE / PLAY
OK I'm totally lost regarding the installation. I clicked on the suggest link and the page that opens is about "Jump to time (Previous frame) v2.1". In this thread I see the option to copy the code to the clipboard and this I can do but then I'm lost.
JGT
Desktop-S4 (Win10 Pro x64, 16GB RAM, 15TB (6-3TB Drives), Boot Drive 500GB Samsung 840EVO SSD , Dual Monitors, GeForce GTX470, Motherboard Asrock 990 Extreme 9, AMD Phenom™ II 1090T 6 core), Power Supply Corsair AX1200. Tower Cooler Master HAF 942)
Laptop Lenovo W700 (Win8 Pro x64, 4GB RAM, 1-240GB SSD Boot drive 1-500GB data drive)

jgt1942
Blank Cone
Blank Cone
Posts: 21
Joined: 03 Jan 2014 08:50
Operating System: Windows

Re: [Extension] Click screen to PAUSE / PLAY

Postby jgt1942 » 18 Oct 2016 09:27

OK I think I got it installed but it is not working. What the heck?????

Forgot to mention I'm running VCL 2.2.4 on Win10 x64
JGT
Desktop-S4 (Win10 Pro x64, 16GB RAM, 15TB (6-3TB Drives), Boot Drive 500GB Samsung 840EVO SSD , Dual Monitors, GeForce GTX470, Motherboard Asrock 990 Extreme 9, AMD Phenom™ II 1090T 6 core), Power Supply Corsair AX1200. Tower Cooler Master HAF 942)
Laptop Lenovo W700 (Win8 Pro x64, 4GB RAM, 1-240GB SSD Boot drive 1-500GB data drive)

VLmurphy
Blank Cone
Blank Cone
Posts: 13
Joined: 06 Jul 2012 02:43

Re: [Extension] Click screen to PAUSE / PLAY

Postby VLmurphy » 18 Oct 2016 19:04

How about reading my post DIRECTLY above yours? -_-

jgt1942
Blank Cone
Blank Cone
Posts: 21
Joined: 03 Jan 2014 08:50
Operating System: Windows

Re: [Extension] Click screen to PAUSE / PLAY

Postby jgt1942 » 28 Oct 2016 06:02

How about reading my post DIRECTLY above yours? -_-
Ops, for whatever reason I did not previously see it. Now that I see it, I agree with you. It would be nice if the developers added this support. But I guess that userfriendly is not a key thought process.
JGT
Desktop-S4 (Win10 Pro x64, 16GB RAM, 15TB (6-3TB Drives), Boot Drive 500GB Samsung 840EVO SSD , Dual Monitors, GeForce GTX470, Motherboard Asrock 990 Extreme 9, AMD Phenom™ II 1090T 6 core), Power Supply Corsair AX1200. Tower Cooler Master HAF 942)
Laptop Lenovo W700 (Win8 Pro x64, 4GB RAM, 1-240GB SSD Boot drive 1-500GB data drive)

VLmurphy
Blank Cone
Blank Cone
Posts: 13
Joined: 06 Jul 2012 02:43

Re: [Extension] Click screen to PAUSE / PLAY

Postby VLmurphy » 28 Oct 2016 06:10

Now that I see it, I agree with you. It would be nice if the developers added this support. But I guess that userfriendly is not a key thought process.
You nailed it ;) This has been a continuous struggle for years, then there were the plugins, then they didn't work anymore because of general restrictions, and then ... nothing. To pretend it never happened seems to be the current strategy.

There have always been "reasons", but no one actually ever understood why it really can't be implemented, despite frequent requests :)

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: [Extension] Click screen to PAUSE / PLAY

Postby Rémi Denis-Courmont » 30 Oct 2016 16:46

How about reading my post DIRECTLY above yours? -_-
Ops, for whatever reason I did not previously see it. Now that I see it, I agree with you. It would be nice if the developers added this support. But I guess that userfriendly is not a key thought process.
I must say that I do not see the link between the Lua add_callback and del_callback functions and user friendliness. Writing, or even just installing external Lua scripts is anything but what I would consider user firendly, regardless of the callback functions.

And indeed, unfortunately, user friendliness is not exactly the top priority, nor is UI development in general. On the one hand, you have paid developers; for the most part, they care either about VLC as a headless streaming toolkit, as an embbedable playback software library, or as a mobile application. On the other hand, you have the hobbyist (me included) who have way too little free time to improve the user interface, and typically are interested in multimedia technology, not user experience.

The desktop UI has tens of millions of users, but nobody really caring for it to the extent that they'd be willing and able to dedicate enough time or money to it.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

VLmurphy
Blank Cone
Blank Cone
Posts: 13
Joined: 06 Jul 2012 02:43

Re: [Extension] Click screen to PAUSE / PLAY

Postby VLmurphy » 30 Oct 2016 20:33

Thanks for your enlightening clarifications, also in the other thread. Very much appreciated.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 6 guests