BBNativePlayer
struct BBNativePlayer: View
A SwiftUI wrapper for BBNativePlayerView.
Embeds the Blue Billywig native video player in a SwiftUI layout.
Observe the player's reactive state via BBPlayerState and control it with its methods.
Minimal usage (fire-and-forget, auto-cleanup)
BBNativePlayer(jsonUrl: "https://demo.bbvms.com/p/default/c/4256635.json")
.aspectRatio(16/9, contentMode: .fit)
Full control
struct VideoScreen: View {
@State private var playerState = BBPlayerState()
var body: some View {
BBNativePlayer(
jsonUrl: "https://demo.bbvms.com/p/default/c/4256635.json",
state: playerState
)
.aspectRatio(16/9, contentMode: .fit)
.onDisappear { playerState.destroy() }
}
}
Important: The
jsonUrlis only read when the view first appears. To switch content after the player is initialized, use the load methods onBBPlayerState(e.g.BBPlayerState/loadClip(id:autoPlay:seekTo:context:)).
Important: When using the
init(jsonUrl:options:state:)initializer, callBBPlayerState/destroy()from.onDisappearto ensure timely cleanup. The convenienceinit(jsonUrl:options:)handles this automatically.