You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi thanks for the helpful package! I wonder whether it is possible to make native code super thin? Currently it is already not heavy, but bugs are still there (e.g. #1523) for the glue code.
Just a naive thought: Is it possible that, we move almost all logic from native side to Dart side. The native side only remains simplest primitive things.
In addition, this can make state duplication less frequently happen. As we know when doing state management, if we are having a state that is duplicated multiple times, then it has a chance that multi replicas are not synchronized. For example, I did observe that, sometimes I tapped "pause" button, and audioplayers says it is paused, but the audio is still playing.
By the way, even if Dart->Java call is async, we can still ensure commands are executed serially, by ensuring one command is finished before sending second command.
Cons:
Code latency will be larger. For example, originally the onCompletion will cause several operations on MediaPlayer by direct android code execution, but now it is implemented by back-and-forth between Dart and Android. This may or may not be a problem for low-latency scenarios. For example, if the critical path is not affected by this, then it is OK. We can also alleviate this by allowing one Dart-to-native call to execute multiple things.
Hi thanks for the helpful package! I wonder whether it is possible to make native code super thin? Currently it is already not heavy, but bugs are still there (e.g. #1523) for the glue code.
Just a naive thought: Is it possible that, we move almost all logic from native side to Dart side. The native side only remains simplest primitive things.
Direct bugs that it can eliminiate:
onCompletioncurrently has some code on native side, and causes both fix(android):onPlayerStateChangedis not called when audio has completed playing #1523 bugWrappedPlayerhas concurrency bugs, since it is called in multiple threads, has shared fields, but without synchronizations #1525 can also disappear automatically if we move all logic to Dart (since Dart is single-threaded and no need to worry about synchronization).By the way, even if Dart->Java call is async, we can still ensure commands are executed serially, by ensuring one command is finished before sending second command.
Cons:
onCompletionwill cause several operations on MediaPlayer by direct android code execution, but now it is implemented by back-and-forth between Dart and Android. This may or may not be a problem for low-latency scenarios. For example, if the critical path is not affected by this, then it is OK. We can also alleviate this by allowing one Dart-to-native call to execute multiple things.