Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Owner and Founder. Opencart
Top Partners
Playing audios directly without downloading it is an easy and fast way to use media and it also saves device memory. Playing media online also saves you from the headache of management of files in the device.
To stream audios, android provides a class MediaPlayer which is used to play online or offline media files in the app.
You can follow the below code segment and the explanation after that to stream the media directly from the URL.
As you can see in the above code segment that an object of MediaPlayer is created and the url is passed to the function setDataSource().
start() function is used to play the audio file on the URL.
Similarly to play the downloaded audio file. You can follow the below given code segment and the explanation following it.
This is similar to the playing media online except that you need to create() function and pass the file path to the as the parameter.
To perform some task after the completion of audio. you can use the MediaPlayer.OnCompletionListener() function. Check the code segment below
You can also use the isPlaying function to make a single button for play and pause.
Thank you very much, this is Vedesh Kumar signing off.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Osama
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.