Spoiler Prevention

If a client has timestamped video, the StreamLayer SDK is able to enable spoiler prevention. When the feature is enabled, users can have a spoiler-free Ads and Games experience. All published content will be synced with the live video.

Note We do not currently support Video On Demand (VOD) with this feature.

To enable Spoiler Prevention, you need to provide a value that represents the date / time of your media player's current playback position..

AVPlayer Streams

If you are using the AVPlayer feature in iOS for your streams, you will need to support the EXT-X-PROGRAM-DATE-TIME tag. Note If you are using a different player or need to calculate the reference time using a different strategy, your team will need to return your custom epoch time to keep Ads and Game activation synched with your stream and your users spoiler free.

Enabling the Feature

To use Spoiler Prevention you have to provide SLRTimecodeProvider for createSession during SDK initialization.

StreamLayer.createSession(for: eventId, timecodeProvider: self)

TimecodeProvider signature

public protocol SLRTimecodeProvider {
 func getEpochTimeCodeInMillis() -> TimeInterval
}

Simple implementation for AVPlayer

extension ViewController: SLRTimecodeProvider {
 public func getEpochTimeCodeInMillis() -> TimeInterval {
    guard let date = player?.currentItem?.currentDate() else {
      return 0.0
    }
    return date.timeIntervalSince1970
 }
}