package com.matchlivetv.match_live_tv

import android.os.Bundle
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterFragmentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // Termina eventuale diretta rimasta attiva da sessione precedente
        StreamingEngineHolder.engine?.stopStream()
        StreamingEngineHolder.release()
        startService(StreamingForegroundService.stopIntent(this))
    }

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        flutterEngine.plugins.add(StreamingPlugin())
    }
}
