Kotlin

Build an Online Music App using Kotlin || Streaming Audio from A URL in Android using MediaPlayer



Hello Guys , In This Tutorial we will learn how to Streaming Audio from A URL in Android using MediaPlayer (Kotlin Language).

source code

Kotlin Tutorial for Beginners

How to use the smtp.js api to send emails with javascript.

Variable and data types in Kotlin || Difference between var and…

Similar Posts

9 thoughts on “Build an Online Music App using Kotlin || Streaming Audio from A URL in Android using MediaPlayer
  1. Hello, when I press the play button mutiple times the streaming start multiple times too, resulting in a not good experience. How can I let that btn play the action just once? Thanks

  2. class MainActivity : AppCompatActivity() {

    var mediaPlayer:MediaPlayer?=null

    override fun onCreate(savedInstanceState: Bundle?) {

    super.onCreate(savedInstanceState)

    setContentView(R.layout.activity_main)

    //var mediaPlayer: MediaPlayer = MediaPlayer.create( R.raw.w)

    val button : Button=findViewById(R.id.button)

    button.setOnClickListener(object : View.OnClickListener{

    override fun onClick(v: View?) {

    mediaPlayer=MediaPlayer.create(this@MainActivity, R.raw.w)

    mediaPlayer?.start()

    }

    })

Leave a Reply

Your email address will not be published. Required fields are marked *