Spoiler Prevention

Nobody likes spoilers, and the StreamLayer SDK has got the spoiler-phobic users covered. When the feature is enabled, your users can have a spoiler-free Twitter Overlay. When enabled, all published tweets will be synced with the live video.

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

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

ExoPlayer Streams

If you are using the ExoPlayer feature in Android 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 the Twitter Overlay synched with your stream and your users spoiler free.

Enabling the Feature

To use spoiler prevention you have to provide SLRTimeCodeProvider for StreamLayer.createEventSession() call. If your stream doesn't support EXT-X-PROGRAM-DATE-TIME tag just set timecodeProvider as null.

val session = StreamLayer.createEventSession(eventId, timecodeProvider)

SLRTimecodeProvider Signature

interface SLRTimeCodeProvider {
 fun getEpochTimeCodeInMillis(): Long
}

Example Implementation

object : SLRTimeCodeProvider {
    override fun getEpochTimeCodeInMillis(): Long {
        val timeline = exoPlayer.currentTimeline
        return if (!timeline.isEmpty) timeline.getWindow(
                    exoPlayer.currentWindowIndex, Timeline.Window()
                ).windowStartTimeMs + exoPlayer.currentPosition
                else exoPlayer.currentPosition

Example of usages these api functions can be found here