package com.tencent.liteav.demo.superplayer.util

object HistoryUtil {
    interface Listener {
        fun onHistory(start: Long, end: Long, sectionId: String)
    }

    private val listeners: MutableList<Listener> = mutableListOf()

    public fun addListener(listener: Listener) {
        listeners.add(listener)
    }

    public fun removeListener(listener: Listener) {
        listeners.remove(listener)
    }

    public fun sendHistory(start: Long, end: Long, sectionId: String) {
        if (end <= start) return
        for (listener in listeners) {
            listener.onHistory(start, end, sectionId)
        }
    }
}