Thumbnail previews

Thumbnails are used to show previews of the stream using the time slider/progress bar.

Supported formats

Presenting thumbnails to the user

Design/Layout (iPhone/iPad)

Your application's storyboard needs to accommodate the placement of a thumbnail image in the desired location. For example a UIView whose horizontal position can be adjusted to reflect the destination of the potential seek position.

The thumbnails example application has this already set up in the main.storyboard file.

Event Handling

iPhone/iPad

To react to touch related seeking events, the sliderTouchDown(), timeSliderDidChange() and sliderTouchUp() methods are implemented to react to the seeking start, changes and seeking stop respectively. These methods allow your application to be able to hide, show and update the position of the thumbnails as appropriate.

  // ViewController.swift
  @IBAction func timeSliderDidChange(_ sender: UISlider) {
    guard thumbnailsEnabled else {
      print("Thumbnails are disabled, not responding to slider change")
      return
    }

    alignThumbnail(sliderPosition: sender.value)
    updateThumbnail(toTime: sender.value)
  }

  @IBAction func sliderTouchDown(_ sender: UISlider) {
    seeking = true
    if thumbnailsEnabled {
      alignThumbnail(sliderPosition: sender.value)
      thumbnailView.isHidden = false
    }
  }

  @IBAction func sliderTouchUp(_ sender: UISlider) {
    seek(to: Double(sender.value))
    thumbnailView.isHidden = true
  }

Apple TV

On AppleTV the UI events will be different, generally using UITapGestureRecognizer and/or UILongPressGestureRecognizer to capture interaction with the remote. However, this is beyond the scope of this document.