Developing with MaestroKit
In this guide, we will explore the process of developing with the MaestroKit SDK and instantiate the base class to start integrating Maestro into your iOS application.
Instantiating the Base Class
The MaestroKit SDK provides a base class Maestro
that serves as the entry point for interacting with the SDK functionalities.
import MaestroKit
import SwiftUI
struct ContentView: View {
@EnvironmentObject var maestroSDK: Maestro
let channelId: String
let siteId: String
let userJwt: String
var body: some View {
maestroSDK.clientVideoPlayer(
channelId: channelId,
siteId: siteId,
userJwt: userJwt
)
}
}
struct ContentView_Previews: PreviewProvider {
@EnvironmentObject static var maestroSDK: Maestro
static var previews: some View {
ContentView(
channelId: "YOUR_CHANNEL_ID",
siteId: "YOUR_SITE_ID",
userJwt: "YOUR_USER_JWT"
)
.environmentObject(maestroSDK)
}
}
Using UIKit ?
Our SDK is a SwiftUI project, so if your App is built in UIKit you'll need to use the UIHostingController to render our SwiftUI views in your view controllers
import UIKit
import SwiftUI
import MaestroKit
class ViewController: UIViewController {
var sdk = Maestro()
override func viewDidLoad() {
super.viewDidLoad()
let clientVideoPlayer = sdk.clientVideoPlayer(channelId: "YOUR_CHANNEL_ID").environmentObject(sdk)
let hostingController = UIHostingController(rootView: clientVideoPlayer)
addChild(hostingController)
view.addSubview(hostingController.view)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
hostingController.didMove(toParent: self)
}
}
Next Steps
Now that you have set up the Maestro environment object, you can explore the available features, methods, and properties provided by the MaestroKit SDK. Consult the rest of the documentation to learn more about implementing interactive video experiences, personalizing user interactions, and monetizing your content effectively.
Refer to the specific feature guides and API reference for detailed information on utilizing the MaestroKit SDK in your application.
Happy coding with MaestroKit SDK!