package com.matchlivetv.match_live_tv

import android.content.Context

/** Motore streaming condiviso tra preview UI e RTMP (deve restare legato all'Activity). */
object StreamingEngineHolder {
    @Volatile
    var engine: StreamingEngine? = null

    fun getOrCreate(context: Context): StreamingEngine {
        val existing = engine
        if (existing != null) {
            return existing
        }
        return StreamingEngine(context.applicationContext).also { engine = it }
    }

    fun release() {
        engine?.release()
        engine = null
    }
}
