MediaKit lets you create amazing streaming media apps in Swift and SwiftUI.
MediaKit has a VideoPlayer and lets you add a video splash screen to present when your app launches. It has views, sample data, Chromecast support, and much more.
MediaKit requires a license to be used. It's free to start using, and affordable to scale. You can sign up for a commercial or free license from the MediaKit website.
MediaKit can be installed with the Swift Package Manager:
https://github.com/Kankoda/MediaKit.git
Important
For remote video playback to work in macOS Catalyst, you must enable "Outgoing Connections (Client)" under "Signing & Capabilities > App Sandbox" and enable "App Transport Security Settings > Allow Arbitrary Loads" (for more security, specify allowed domains) under the app's "Info" configuration.
MediaKit supports iOS 15, macOS Catalyst 12, tvOS 15, watchOS 8, and visionOS 1.
MediaKit supports a bunch of video-related features:
- 🎬 Video Player - A custom video player view.
- ✨ Video Splash Screen - A video-based splash screen that plays when your app launches.
- 🖼️ Views - A bunch of video-related views and modifiers.
- 🗞️ Pagination - Built-in pagination support.
- 🍬 Sample Data - Free samples to use while developing.
MediaKit also includes Chromecast support:
- 📽️ Chromecast SDK - Google Cast dependency.
See the documentation for more information.
To add video content to your app, just add a VideoPlayer with a URL to the content you want to play:
struct ContentView: View {
@State var videoTime = TimeInterval.zero
var body: some View {
VideoPlayer(
videoURL: VideoPlayer.sampleVideoURL,
time: $videoTime,
configuration: .init(autoPlay: false),
controllerConfiguration: { controller in
controller.showsPlaybackControls = false
},
didPlayToEndAction: { print("The end") }
)
.aspectRatio(16/9, contentMode: .fit)
}
}You can inject a time binding which lets you persist the player time and resume playback, inject custom player and controller configurations, and a didPlayToEndAction to trigger when playback ends.
To add video splash screen, just apply a .videoSplashScreen(videoURL:configuration:) to your root view:
struct ContentView: View {
var body: some View {
Text("Hello, world")
.videoSplashScreen(
videoURL: VideoPlayer.sampleVideoURL,
configuration: .init(
dismissAnimation: .linear(duration: 2),
maxDisplayDuration: 2
),
videoPlayerView: { videoPlayer in
Color.red
videoPlayer.aspectRatio(contentMode: .fit)
}
)
}
}You can pass in a configuration to customize the splash screen, and customize the videoPlayerView.
See the getting-started guide for more information.
The online documentation has more information, articles, code examples, etc.
The Demo folder has a demo app that lets you explore the library.
MediaKit is property of Kankoda:
Reach out if you have any questions, want to sign up for a license, or need help in any way.
MediaKit is closed source. See the LICENSE file for more info.
