onMediaStatus method

void onMediaStatus(
  1. bool callback(
    1. MediaStatus oldValue,
    2. MediaStatus newValue
    )?, {
  2. bool reply = false,
})

Implementation

// reply: true to let native code wait for dart callback result, may result in dead lock because when native waiting main isolate reply, main isolate may execute another task(e.g. frequent seekTo) which also acquire the same lock in native
// only the last callback reply parameter works
void onMediaStatus(
    bool Function(MediaStatus oldValue, MediaStatus newValue)? callback,
    {bool reply = false}) {
  if (callback == null) {
    _statusCb.clear();
    Libfvp.unregisterType(nativeHandle, 2);
  } else {
    _statusCb.add(callback);
    Libfvp.registerType(nativeHandle, 2, reply);
  }
}