Closed defagos closed 2 months ago
/**
* Playback stats metrics
* Role
* - Gather playback metrics, likes stalls, total play times.
* - Request metrics anytime.
* - Metrics are reset when current item is changed.
*/
class PlaybackStatsMetrics : PillarboxAnalyticsListener {
private var stalls = 0
override fun onStallChanged(eventTime: AnalyticsListener.EventTime, isStalls: Boolean) {
stalls++
}
fun getCurrentMetrics(): Any? = null
}
class RemoteService {
suspend fun send(payload: Any) {
//ktor
}
}
class LocalService {
suspend fun store(entity: Any) {
}
suspend fun getNotSendData(): Any = Any()
}
interface QosSender {
fun sendEvent(event: Any)
}
class QoS(
remote: RemoteService,
databaseService: LocalService,
)
class PillarboxQos(
val timingMetrics: QoSSessionAnalyticsListener,
val metrics: PlaybackStatsMetrics,
val service: QosSender,
) : PillarboxAnalyticsListener {
lateinit var sessionManager: PlaybackSessionManager
override fun onStallChanged(eventTime: AnalyticsListener.EventTime, isStalls: Boolean) {
val metrics = metrics.getCurrentMetrics()
service.sendEvent(Any())
}
}
As a developer I need to get rid of the metrics gathering mess that my code has tuned into.
Hints
Specs: https://github.com/SRGSSR/pillarbox-documentation/issues/70
Acceptance criteria
Tasks