View Source MpvJsonIpc.Mpv (mpv_json_ipc v0.1.0)
Main module to interract with an MPV instance.
Link to this section Summary
Functions
Registers a callback
to call when the event name
occurs.
Registers a callback
to call when the key name
is pressed.
Sends the command to the MPV instance.
Registers a callback
to call when the property name
changes.
Convenience to register a callback
for the event name
.
Convenience to register a callback
for the key name
.
Convenience to register a callback
for the property name
.
Deletes a property observer with given observer_id
.
Link to this section Functions
Registers a callback
to call when the event name
occurs.
examples
Examples
MpvJsonIpc.Mpv.bind_event(server, "seek", fn _ -> IO.inspect("seeking") end)
MpvJsonIpc.Mpv.bind_event(server, "end-file", fn data -> IO.inspect("end-file with reason #{data[:reason]}") end)
Registers a callback
to call when the key name
is pressed.
examples
Examples
MpvJsonIpc.Mpv.bind_key(server, "g", fn _ -> IO.inspect("key g is pressed") end)
Sends the command to the MPV instance.
Available commands are here.
examples
Examples
MpvJsonIpc.Mpv.command(server, "get_property", "playback-time")
MpvJsonIpc.Mpv.command(server, :get_property, :"playback-time")
MpvJsonIpc.Mpv.command(main, "expand-properties", ["print-text", "${playback-time}"])
MpvJsonIpc.Mpv.command(server, :set_property, [:pause, true])
MpvJsonIpc.Mpv.command(server, %{
name: "loadfile",
url:
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
options: %{
cache: "yes",
"demuxer-max-bytes": "100MiB",
"demuxer-max-back-bytes": "100MiB"
}
})
Registers a callback
to call when the property name
changes.
examples
Examples
MpvJsonIpc.Mpv.observe_property(server, "pause", fn pause -> IO.inspect("Property pause now has value #{pause}") end)
Convenience to register a callback
for the event name
.
examples
Examples
MpvJsonIpc.Mpv.on_event server, "seek" do
IO.inspect("seeking")
end
Convenience to register a callback
for the key name
.
examples
Examples
MpvJsonIpc.Mpv.on_keypress server, "g" do
IO.inspect("key g is pressed")
end
Convenience to register a callback
for the property name
.
examples
Examples
MpvJsonIpc.Mpv.property_observer server, "pause" do
if pause, do: IO.inspect("in pause"), else: IO.inspect("playing")
end
Deletes a property observer with given observer_id
.
examples
Examples
oid = MpvJsonIpc.Mpv.observe_property(server, "pause", fn pause -> IO.inspect("Property pause now has value #{pause}") end)
...
MpvJsonIpc.Mpv.unobserve_property(server, oid)