Home » Android » Playing a video from youtube with only audio and no video on a button click

Playing a video from youtube with only audio and no video on a button click

Posted by: admin November 1, 2017 Leave a comment

Questions:

im making a soundboard app and at the moment i only have local files playing, and i tought it would be cool with 1 online sound. But i have not found anything that will only let me play the audio and not audio+video on the device.

i am using this for my local sounds

   final MediaPlayer dingSoundMP = MediaPlayer.create(this, R.raw.ding_sound);

    Button playdingSound = (Button) this.findViewById(R.id.button4);

    playdingSound.setOnClickListener(new View.OnClickListener()  {
        @Override
        public void onClick(View v) {
            dingSoundMP.start();
        }
    });
Answers:

Mashape offers quite a useful way of fetching only audio from Youtube with a simple POST request.

https://market.mashape.com/ehmo/savedeo#-download

Note: This is against the terms and conditions of Youtube.
But well, you gotta do what you gotta do right?