MovaCallbackVolume class

A IMovaVolume adapter that forwards writes to a plain callback, so a host can control volume without implementing the full interface.

Pass createMova(volume: MovaCallbackVolume((percent) => ...)) to take over volume entirely: the video keeps full player volume while your callback applies percent (e.g. to the OS media volume). Supply onGet if you can report the current level back; otherwise the gesture baseline starts from 100.

把写入转发给一个普通回调的 IMovaVolume 适配器,宿主无需实现整个接口即可 接管音量。

传 createMova(volume: MovaCallbackVolume((percent) => ...)) 即可完全 接管:视频保持播放器满音量,你的回调负责应用 percent(例如写系统媒体 音量)。若能回报当前音量,传入 onGet;否则手势基线从 100 起算。

Example / 示例:

final mova = createMova(
  options: options,
  volume: MovaCallbackVolume((percent) => MyAudio.setSystemVolume(percent)),
);
Implemented types

Constructors

MovaCallbackVolume(void onSet(double percent), {Future<double> onGet()?})
Creates a callback-backed volume port.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
onGet → Future<double> Function()?
Optional reader for the current volume; defaults to reporting 100.
final
onSet → void Function(double percent)
The sink applied on every volume change, in [0, 100].
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

get() → Future<double>
Reads the current volume as a percentage in [0, 100].
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(double percent) → Future<void>
Sets the volume to percent, a value in [0, 100].
override
toString() → String
A string representation of this object.
inherited

Operators

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