summaryrefslogtreecommitdiffstats
path: root/player/javascript.c
Commit message (Collapse)AuthorAgeFilesLines
* js: use new hooks API (match f60826c3)Avi Halachmi (:avih)2018-04-071-0/+42
|
* lua+js: Implement utils.getpid()sfan52018-02-131-0/+8
| | | | | | | Usable for uniquely identifying mpv instances from subprocesses, controlling mpv with AppleScript, ... Adds a new mp_getpid() wrapper for cross-platform reasons.
* lua+js: implement utils.file_info()TSaaristo2017-12-131-0/+36
| | | | | | | | | | | | | | | This commit introduces mp.utils.file_info() for querying information on file paths, implemented for both Lua and Javascript. The function takes a file path as an argument and returns a Lua table / JS object upon success. The table/object will contain the values: mode, size, atime, mtime, ctime and the convenience booleans is_file, is_dir. On error, the Lua side will return `nil, error` and the Javascript side will return `undefined` (and mark the last error). This feature utilizes the already existing cross-platform `mp_stat()` function.
* js: fix broken mp.set_property_number, mp.set_property_nativeAvi Halachmi (:avih)2017-09-231-2/+2
| | | | | | Also implicitly fixes memory leak when mp.set_property_native was used, because the cleanup did not expect more allocations from the accidental use of mpv_get_property.
* js: utils.getenv(): fix crash on undefined varAvi Halachmi (:avih)2017-07-061-1/+6
|
* javascript: replace custom MIN macro with MPMINwm42017-06-171-5/+3
|
* js: add javascript scripting support using MuJSAvi Halachmi (:avih)2017-06-141-0/+1307
Implements JS with almost identical API to the Lua support. Key differences from Lua: - The global mp, mp.msg and mp.utils are always available. - Instead of returning x, error, return x and expose mp.last_error(). - Timers are JS standard set/clear Timeout/Interval. - Supports CommonJS modules/require. - Added at mp.utils: getenv, read_file, write_file and few more. - Global print and dump (expand objects) functions. - mp.options currently not supported. See DOCS/man/javascript.rst for more details.