MpvHookEvent class

Emitted by PlayerStream.hook when mpv fires a registered hook.

You must call Player.continueHook with id exactly once, even if processing fails — otherwise mpv will stall indefinitely.

Example:

player.registerHook(Hook.load);
player.stream.hook.listen((event) async {
  if (event.hook == Hook.load) {
    final url = await player.getRawProperty('stream-open-filename') ?? '';
    if (url.startsWith('my-scheme://')) {
      await player.setRawProperty(
        'stream-open-filename',
        await resolve(url),
      );
    }
  }
  player.continueHook(event.id); // always call, even on error
});

Constructors

MpvHookEvent(int id, Hook hook)
const

Properties

hashCode int
The hash code for this object.
no setterinherited
hook Hook
The lifecycle phase mpv is asking you to handle.
final
id int
Opaque identifier required by Player.continueHook.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited