SwiftUI video player
New Features and Enhancements:
-
Volume Control:
- Introduced the
volume(Float)
command to adjust the video playback volume. The volume parameter is aFloat
value ranging from 0.0 (mute) to 1.0 (full volume). If the value is outside this range, it will be clamped to the nearest valid value, ensuring consistent audio levels.
- Introduced the
-
Subtitles Support:
- Added the
subtitles(String?)
command, allowing users to set subtitles to a specified language or turn them off. Pass a language code (e.g., "en" for English) to activate subtitles, ornil
to disable them, enhancing the accessibility of video playback.
- Added the
-
Playback Speed Adjustment:
- Implemented the
playbackSpeed(Float)
command to control the speed of video playback. The speed parameter can range from 0.5 (half speed) to 2.0 (double speed). Negative values are clamped to 0.0, ensuring smooth playback control.
- Implemented the
-
Looping Control:
- Introduced the
loop
command to enable looping of the video playback. Looping is enabled by default, so this command will have no effect if looping is already active. - Added the
unloop
command to disable looping of the video playback. This command will only take effect if the video is currently being looped, providing precise control over playback behavior.
- Introduced the
Performance Improvements and Bug Fixes:
- Enhanced Performance: Refactored the internal logic to optimize the handling of playback commands, improving overall responsiveness and reducing unnecessary operations.
- Command Handling: Improved command processing by checking whether commands have changed before applying them, ensuring more efficient updates and minimizing redundant state changes.
- Bug Fixes: Addressed several minor bugs to enhance the stability.