perf: compact [propId, value] wire format for property events

This commit is contained in:
edde746
2026-02-16 15:40:52 +01:00
parent c3b10d6c45
commit a61fca0588
15 changed files with 193 additions and 91 deletions
+10 -14
View File
@@ -42,26 +42,22 @@ class PlayerNative extends PlayerBase {
await _configureSubtitleFonts();
// Subscribe to MPV properties
await _observeProperty('time-pos', 'double');
await _observeProperty('duration', 'double');
await _observeProperty('pause', 'flag');
await _observeProperty('paused-for-cache', 'flag');
await _observeProperty('track-list', (Platform.isAndroid || Platform.isWindows) ? 'string' : 'node');
await _observeProperty('eof-reached', 'flag');
await _observeProperty('volume', 'double');
await _observeProperty('speed', 'double');
await _observeProperty('aid', 'string');
await _observeProperty('sid', 'string');
await observeProperty('time-pos', 'double');
await observeProperty('duration', 'double');
await observeProperty('pause', 'flag');
await observeProperty('paused-for-cache', 'flag');
await observeProperty('track-list', (Platform.isAndroid || Platform.isWindows) ? 'string' : 'node');
await observeProperty('eof-reached', 'flag');
await observeProperty('volume', 'double');
await observeProperty('speed', 'double');
await observeProperty('aid', 'string');
await observeProperty('sid', 'string');
} catch (e) {
errorController.add('Initialization failed: $e');
rethrow;
}
}
Future<void> _observeProperty(String name, String format) async {
await methodChannel.invokeMethod('observeProperty', {'name': name, 'format': format});
}
/// Configures subtitle fonts for libass support.
/// Provides a comprehensive Unicode font (Go Noto) with CJK coverage to ensure
/// proper rendering of non-Latin characters in subtitles.