Add skip controls

Learn how to add OTT-style skip controls (Skip Intro, Skip Song, Skip Credits) to the FastPix iOS Player.

The FastPix iOS Player SDK supports time-based skip segments that let users skip intros, songs, and credits during playback. The SDK manages skip logic and timing—you’re responsible for rendering the skip UI.

Key behaviors

  • Skip segments can be configured per playlist item.
  • The SDK automatically validates and applies skip ranges during playback.
  • Skip button visibility is managed based on the current playback time.
  • Skip state resets automatically during playlist transitions.
  • Fully compatible with custom player UIs.

Configure skip segments

Define skip segments when creating a playlist item:

1let item = FastPixPlaylistItem(
2 playbackId: "<PLAYBACK_ID>",
3 title: "Episode 1",
4 skipSegments: [
5 // Skip Intro from 10s to 90s
6 SkipSegment(startTime: 10, endTime: 90, type: .intro),
7
8 // Skip Song section from 6:00 to 8:00
9 SkipSegment(startTime: 360, endTime: 480, type: .song),
10
11 // Skip Credits from 9:00 to 9:56
12 SkipSegment(startTime: 540, endTime: 596, type: .credits)
13 ]
14)

Initialize the skip manager

Initialize the skip manager after the player is ready. This is recommended inside viewDidAppear:

1override func viewDidAppear(_ animated: Bool) {
2 super.viewDidAppear(animated)
3
4 DispatchQueue.main.async {
5 // Make sure the AVPlayer instance is initialized
6 guard self.playerViewController.player != nil else { return }
7
8 // Attach the skip manager and set the delegate
9 self.playerViewController.setupSkipManager(delegate: self)
10
11 // Set up your custom skip button UI
12 self.setupSkipButton()
13 }
14}

Handle skip button visibility

The SDK calls this delegate method when playback enters or exits a skip segment:

1func onSkipVisibilityChanged(isVisible: Bool) {
2 // Show skip button when a skip segment is active
3 // Hide it when playback is outside skip ranges
4 skipButton.isHidden = !isVisible
5}

Note: The SDK manages skip logic and timing. You’re responsible for rendering the skip button UI.