package com.example.music

import android.media.MediaPlayer
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.music.ui.theme.MusicTheme

class MainActivity : ComponentActivity() {

    override fun onCreate (savedInstanceState:Bundle?) {

        super.onCreate (savedInstanceState)
        setContentView (R.layout.activity_main)
    }

    override fun onResume () {
        super.onResume()
        try {
            val mp = MediaPlayer()
            mp.setDataSource ("http://philos.nmu.edu/polka/polka.mp3")
            mp.prepare()
            mp.start()
        } catch (e:Exception) {
            e.printStackTrace()
        }

    }
}

