Playing music of multimedia based on Android

I'm bored in my spare time. I recently learned some preliminary knowledge of multimedia.

The audio playback is mainly designed to mediaplayer. The audio playback path can come from three places.

1. Audio in application

2. Play the music of the memory card. This part of the code is to replace the previous mediaplayer = mediaplayer. Create (this, r.raw. Loser);

3. To play audio files on the network, we should first match the network environment,

1) Find where we put tomcat,

2) Then double-click startup.bat to run and minimize the interface

3) Then open the CMD command and enter config to find the IPv4 address of our local machine

4) Then try on the browser to see if you can open the home page of Tomcat

5) Put your MP3 file in the root directory of Tomcat

6) Then, on your simulator, open it with the same browser, open the Tomcat home page with your local IPv4 address, and add the name of the music to see if it can be released. If so, it means that the environment has been matched

7) Next, let's write the code

Change the audio path on the previously played memory card to that on the network

Then prepare to finish listening

Finally, pay attention to one detail and add the networking permission in manifest

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Finally, run it and you're done. The interface is very simple

If you want to add lyrics and time, you can continue to improve, but the ideas are the same. That's all for today's sharing

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>