Re:Mpv – A free, open source, and cross-platform media player
by ksdnjweusdnkl21 on Monday July 18, 2022 @12:13PM
(#32139959)
Writing scripts for mpv is really fun. I would recommend it for anyone especially for people who are learning programming. There is a lot of room for innovation and creativity. The development feedback loop is quick, interactive and visual.
Re:Mpv – A free, open source, and cross-platform media player
by disk0 on Monday July 18, 2022 @02:08PM
(#32141400)
For anyone already acquainted with emmylua/vscode-lua I'd recommend using my type declarations for mpv—need to push some commits for recent changes but it's completely functional
Re:Mpv – A free, open source, and cross-platform media player
by pltnr on Monday July 18, 2022 @02:43PM
(#32141822)
Just curious why Lua is frequently used as plugin script? I would like to use an already familiar one like Python instead of to learn a new one.
Re:Mpv – A free, open source, and cross-platform media player
by grumbel on Monday July 18, 2022 @03:59PM
(#32142895)
LUA is essentially build as a plugin language. It's simple and well behaved, very easy to spawn when you need it and throw it away when you are done with it. It can also be isolated, if you don't want to give people access to file-io functions for example, you just don't load them into the interpreter and everything works as expected.
Most other language are not like that, they rely on global state and want to take full control your program. The interpreter also tends to be full of functions you can't get rid of, so they are impossible to secure. Even simple things like spawning two independent interpreters are often not supported. A language like Python really wants you to extend Python with modules, not extend your program with Python.
Long story short, writing a Lua interpreter is just a couple of lines of code: https://www.lua.org/pil/24.1.html
Re:Mpv – A free, open source, and cross-platform media player
by jamhan on Tuesday July 19, 2022 @01:28AM
(#32147864)
As an example, the MMORPG "Elder Scrolls Online" [1], uses Lua as the interface and plugin ("addons") language. This allows feature-rich, very useful UI modifications such as "Bandits User Interface" [2]
[1] https://www.elderscrollsonline.com/
[2] https://www.esoui.com/downloads/info1643-BanditsUserInterfac...
Re:Mpv – A free, open source, and cross-platform media player
by nmz on Tuesday July 19, 2022 @12:53PM
(#32154547)
Python is familiar because you already know it. Lua is much easier to learn than python.
Also, you can look for a python transpiler to lua, or any that you like. Take your pick.
Re:Mpv – A free, open source, and cross-platform media player
by capableweb on Monday July 18, 2022 @03:21PM
(#32142333)
Lua is so similar to Python that you could learn the basics in one afternoon since you already know Python. The official book is a great start: https://www.lua.org/pil/1.html
Re:Mpv – A free, open source, and cross-platform media player
by pimeys on Monday July 18, 2022 @02:57PM
(#32142054)
It is very easy to embed to C/C++ codebase, much faster than almost any other scripting languages (luajit) and adds a minimal amount to the binary size.
Re:Mpv – A free, open source, and cross-platform media player
by nmz on Tuesday July 19, 2022 @12:49PM
(#32154476)
Much faster than C in some cases.
Re:Mpv – A free, open source, and cross-platform media player
by ranger_danger on Monday July 18, 2022 @11:22AM
(#32139410)
Still no crossfade support though, unfortunately.
You can write Lua/Javascript and bind it to a hotkey and run your own scripts, pass in current video, playback position, download subtitles etc.
[0]: I use mpv.net on Windows, too, but PotPlayer has better UX.