Introduction
BlendVision iOS Player SDK offers a rich set of APIs that enable you to control and customize the playback experience, designed to seamlessly integrate with the player into your native applications.
Getting Started
To begin your journey with iOS Player SDK APIs, follow this guide to install the SDK and initialize the player.
API Overview
Control the Player
The APIs allow you to control the behaviors of the player. Below are some examples:
- Start the playback:
player.play()
- Pause the playback:
player.pause()
- Seek to the 30th second of the media:
player.seek(time: 30)
Additionally, APIs with a set
prefix enable you to define parameters for player behaviors. Below are some examples:
- Set the playback volume to 50%:
player.volume = 0.5
- Set the playback speed to 1.25x:
player.playbackSpeed = 1.25
Get Information
The APIs with a get
prefix allow you to retrieve the media information and the playback status. Below are some examples:
- Get the total duration of the media:
var duration: TimeInterval { get }
- Get the current playback speed:
var playbackSpeed: Float { get }
Track Event
The APIs allow you to register listeners to track the event logs:
// Add listener
self.player.add(listener: self)
// Player event delegate
func player(_ player: UniPlayer, didReceiveOnEvent event: UniEvent) {
debugPrint("Received event=\(event.name)")
}
You can gain valuable insights into your content performance and perform customized actions when events are triggered.
Multiple Players Targeting
In situations where you have more than one player on single page of your native applications, it's essential to specify which player you would like to interact with.
var players = [UniPlayer]()
// Adding 4 players into players array
for _ in 0..<5 {
players.append(UniPlayerFactory.create())
}
// First player to play
players.first?.play()
// Last player to pause
players.last?.pause()