Slark is a cross-platform video player that supports iOS and Android platforms. Built from the ground up with modern C++23, it provides a streamlined media playback solution with minimal dependencies (only OpenSSL for HTTPS support).
- Minimum Version: iOS 16.5+
- Architecture: arm64
- Integration: CocoaPods
- Minimum Version: API Level 29 (Android 10.0)+
- Architecture: arm64-v8a
- Integration: Gradle/CMake
Add to your Podfile:
pod 'slark', '~> 0.0.1'Then run:
pod installAdd dependency to your build.gradle:
dependencies {
implementation 'com.slark:sdk:0.0.1'
}#import <SlarkPlayer.h>
// Create player
SlarkPlayer *player = [[SlarkPlayer alloc] init:@"path/to/video.mp4"];
player.delegate = self; // Set observer
self.playerController = [[SlarkViewController alloc] initWithPlayer:self.view.bounds player:player];
[self addChildViewController:self.playerController]; //add ViewController
//To add the player view to your view
[self.view addSubview:self.playerController.view];
//
// Set observer
player.delegate = self;
// Playback controls
[player prepare];
[player play];
[player pause];
[player stop];
// Playback controls
[player seek:30.0]; // Seek to 30 seconds
[player setVolume:80.0f]; // Set volume
[player setLoop:YES]; // Enable loop playback
// Implement observer protocol
- (void)notifyTime:(NSString*)playerId time:(double)time {
// Playback progress callback
}
- (void)notifyState:(NSString*)playerId state:(SlarkPlayerState)state {
// Playback state change
}
- (void)notifyEvent:(NSString*)playerId event:(SlarkPlayerEvent)event value:(NSString*)value {
// Playback event callback
}import com.slark.api.*
// Initialize SDK
SlarkSdk.init(application)
// Create player configuration
val config = SlarkPlayerConfig("path/to/video.mp4")
val player = SlarkPlayerFactory.createPlayer(config)
//Setting the render target
player?.setRenderTarget(SlarkRenderTarget.FromTextureView(textureView))
// Playback controls
player?.prepare()
player?.play()
player?.pause()
player?.stop()
// Set observer
player?.setObserver(object : SlarkPlayerObserver {
override fun onTimeUpdate(playerId: String, time: Double) {
// Playback progress callback
}
override fun onStateChanged(playerId: String, state: SlarkPlayerState) {
// Playback state change
}
override fun onEvent(playerId: String, event: SlarkPlayerEvent, value: String) {
// Playback event callback
}
})
// Playback controls
player?.seek(30.0) // Seek to 30 seconds
player?.volume = 80 // Set volume
player?.isLoop = true // Enable loop playback- macOS: Xcode 14.0+
- CMake: 3.20+
- C++: C++23 support
- iOS: iOS 16.5+ SDK
- Android: NDK r21+, API Level 29+
- Clone Repository:
git clone https://github.com/Nevermore1994/slark.git
cd slark- iOS Build:
cd script
python build.py -p iOS- Android Build:
cd script
python build.py -p AndroidThe project includes complete example code:
- iOS Demo:
demo/iOS/demo/- Demonstrates audio and video playback - Android Demo:
demo/Android/- Demonstrates local and network playback
Run demos:
# iOS
cd script && python build.py -p iOS --demo
# Android
cd script && python build.py -p Android --demoFor detailed API documentation, please refer to:
- Startup time optimization
- Performance optimization
- Support FLV & DASH
- Support H265 & AV1
- HDR content support
- Variable playback speed (0.5x - 2.0x)
- Support live streaming
This project is licensed under the MIT License - see the LICENSE file for details.
- Nevermore - [email protected]
⭐ If this project helps you, please give it a Star!