See https://github.com/caprica/vlcj/tree/vlcj-4.x#threading-model
# Threading Model
This section is very important.
With vlcj-4, every native event coming from LibVLC is processed on the
native callback thread. This should give some small performance gains
when compared with vlcj-3.
The critical issue is that it is generally not permitted to call back
into LibVLC from the event callback thread. Doing so may cause subtle
failures or outright hard JVM crashes.
A prime example of the sort of trap waiting for you is the very common
case of handling a media player "finished" event so that you can then
play the next item in a play-list:
```java
mediaPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
@Override
public void finished(MediaPlayer mediaPlayer) {
mediaPlayer.media().play(nextMrl); // <-- This is VERY BAD INDEED
}
});
```
In this example, the finished method is being invoked on a native
callback thread owned by LibVLC. The implementation of this method is
calling back into LibVLC when it invokes play. This is very likely to
cause a JVM crash and kill your application.
In cases such as this, you should make use of an asynchronous
task-executor queue conveniently provided by the MediaPlayer object
passed to the listener method:
```java
mediaPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
@Override
public void finished(final MediaPlayer mediaPlayer) {
mediaPlayer.submit(new Runnable() {
@Override
public void run() {
mediaPlayer.media().play(nextMrl);
}
});
}
});
```
* Refactor video player`isMacOS` function
* Refactor video player `mediaPayer` extension function
* Re-implement the experimental video player
* Use icons instead of labels and buttons for video player controls
* Center video player controls
* Add a TODO to video player to make the slider logarithmic
* Add `rememberVideoPlayerState` function for video player
To simplify state management for the client
* Extend a comment with more info
* Improve a KDoc
* Specify video player minimum size for the window
* Use `VideoPlayerState` instead of explicit parameters for video player
* Reorder a statement in video player
* Use the implicit `it` instead of named lambda parameter
* Use `roundToInt` instead of `toInt` for converting a `Float` to percentage
* Update some documentation
* Remove a redundant trailing comma
* Add more comments about video player fullscreen option
* Add some functions to VideoPlayerState
And use them in the code
* Add `ms` unit label to video player timestamp
* Remove a redundant import statement
* Simplify video player `produceProgress` function
* Extract video player URL as a constant
And add some docs about local files
* Add some comments
About placing controls on the video player which is NOT currently possible.
* Add video player minor code improvements
* Ensure video player volume icon and slider are aligned
* Make video player control icons smaller
* Add some comments for video player Progress class
* Improve video player speed input
* Extract a remember function call to an outer function
* Convert a lambda to method reference
* Update the video player component
* Convert video player progress from return value to state property
The code of `ScalableImage` is exactly the same as [here](https://github.com/JetBrains/compose-multiplatform-core/pull/459/files#diff-2df227d37a7fcdb885f4fd1a715c0efd94b8e206d446d553d69a456f83e284f6R19):
1. The initial size of an image is chosen by the area size (phone/windows size)
2. We can zoom using pinch-to-zoom (with taking centroid of touches into account)
3. We can zoom using mouse scroll (also, taking the mouse position into account). On touchpad/macOS it also works great.
4. The code of the old `ScalableState` and `ScalableImage` was complete rewritten.
5. The zoom is not limited by phone/window dimensions, we can zoom out
* Avoid scaling code duplication
* Move AndroidImageStorage into separate package
* Implement storing metadata on Android
* Move file extensions to separate class
* Design changes; move to material3
* Use animations to move between different images
* More design changes, rounded corners and animations
* Introduce square gallery view, start with granularizing state management
* Introduce square gallery view, start with granularizing state management
* Make PreviewImage not depend on the whole gallery state
* Move in initialization logic from composition into launched effect
* Highlight currently selected image
* Hoist state for FullscreenImage TopAppBar
Move from Custom Implementation to Material App Bar, use color scheme from main page
Extract hardcoded colors to ImageViewerColors
* Provide floating action buttons with nicer colors
* Provide keyboard events via SharedFlow (remove passing around MutableState in the composable hierarchy as it may potentially violate UDF)
Commonize IOScope initialization
* Provide German translation in shared R-strings
* Move from immutable data classes to Compose-aware State Holders.
* Fix gradlew formatting issue?
* Regenerate gradle wrapper after Android Studio autoformatting debacle
* Resolve rememberCoroutineScope issue
* Provide mock name for remaining picture in repo
* Restore TEAM_ID in project.pbxproj
* Use emptyFlow as default to simplify nullability handling for external events
* Remove extraneous newline and unnecessary print statement
* Provide German translation in XML format
Consistently rename title to "My Memories"
* Remove commented-out code, cleanup rendundant modifiers
Make Title Bar use callbacks instead of accessing ViewModel directly
Add toggle & icon for list and grid view