BiddingStack Audio Player for iOS

BiddingStack Audio Player iOS Integration Guide

Play BiddingStack audio in your iOS app with full playback control, runtime configuration, player events, lock screen / Control Center integration, and an optional fullscreen player.

Requirements

ComponentMinimum Version
iOS Deployment Target14.0+
Swift5.7+

Installation

The SDK is distributed privately while in early access. Contact the BiddingStack team to get the BSAudioPlayer package (Swift Package, CocoaPods, or XCFramework).

Integration

1. Enable background audio

Add the audio background mode to your Info.plist:

<key>UIBackgroundModes</key>
<array>
  <string>audio</string>
</array>

You can omit this if you set mediaSessionEnabled = false on the player view.

2. Create a player view

import BSAudioPlayer

let player = PlayerView(frame: .zero)
player.delegate = self
view.addSubview(player)
PropertyDefaultDescription
delegatenilReceives player events, resize, and link callbacks
mediaSessionEnabledtrueLock screen / Control Center integration
verbosefalseVerbose logging
readyTimeoutSeconds20Seconds to wait for the player to become ready

3. Load audio

var config = PlayerSettings.PlayerConfig()
config.themeid = 1
config.autoPlay = false

let item = PlayerSettings.AudioItem(
  audioUrl: "https://example.com/audio.mp3",
  audioTitle: "Episode 1",
  poster: "https://example.com/cover.png"
)

player.load(PlayerSettings(playerConfig: config, audio: [item]))

PlayerConfig mirrors the web player configuration. mode is managed by the SDK and set to embed automatically.

4. Handle events

Only onEvent is required; didResize and shouldOpenExternalLink have default implementations:

extension ViewController: PlayerDelegate {
  func player(_ playerView: PlayerView, onEvent event: PlayerEvent) {
    print(event.type, event.currentTime ?? 0)
  }

  func player(_ playerView: PlayerView, didResize height: CGFloat) {
    // Adjust the view's height constraint
  }

  func player(_ playerView: PlayerView, shouldOpenExternalLink url: URL) -> Bool {
    return true
  }
}

5. Release the player

PlayerView is not released automatically. Call destroy() when you are done:

deinit {
  player.destroy()
}

Important: Do not place PlayerView in reusable cells (e.g. UITableViewCell).

Playback Control

MethodDescription
play() / pause()Start / pause playback
seek(_ seconds: Float)Seek to a position in seconds
next() / prev()Switch tracks in a playlist
setPlaybackRate(_ rate: Float)Set playback speed
setVolume(_ volume: Float)Set volume, 0.01.0
setMuted(_ muted: Bool)Mute / unmute
destroy()Tear down the player

Note: Commands issued before the player is ready are queued and flushed once it becomes ready. If the player does not become ready within readyTimeoutSeconds, a PlaybackErrored event with errorCode: "ready_timeout" is emitted.

Fullscreen Player

Present a fullscreen audio player as a modal view controller. Settings are passed at init; there is no load():

var config = PlayerSettings.PlayerConfig()
config.mode = "fullscreen"
config.themeid = 5

let controller = FullscreenPlayerViewController(
  settings: PlayerSettings(playerConfig: config, audio: items)
)
controller.onEvent = { event in
  print(event.type)
}
present(controller, animated: true)
  • Callbacks are closures (onEvent and shouldOpenExternalLink) instead of the delegate protocol.
  • The same playback control methods are available (play(), pause(), seek(_:), next(), prev(), setPlaybackRate(_:), setVolume(_:), setMuted(_:)).
  • The fullscreen player does not integrate with the media session.