song and playing the next song.This write playback control is to start a service and send the command as a parameter. Then, the service returns a broadcast and returns the status of the current music player.Let's talk about album pictures. These album pictures are extracted from music files and have similar protocols and algorithms. We will not introduce them here. These things are implemented in
with the. mp3 End of the current directory
}
}
Instantiate the object in the parameterless constructor of the Musicservice class and place the MP3 files in the musiclist.
Java code
Public Musicservice () {
musiclist = new arraylist
Let's write a method to set the name of the current song: (personally think this method is more stupid, but not think of another way)
Java code
The public void Setplayname (String d
resources.Next, if you need to play a music file, you can encapsulate the playback logic by using the player MediaPlayerthat comes with Android: //Start Public voidStart (String path) {Try{mediaplayer.reset (); Mediaplayer.setdatasource (path); Mediaplayer.prepare (); Mediaplayer.start (); Mediautils.currentstate=Constants.play_start; } Catch(IOException e) {e.prints
Playing background music in androidAfter referring to what was written on the internet, I used it to play music in a new thread. Later I found that every time I entered the Activity, I would start playing a music again. To avoid repeated playback, I added the singleton mode based on the original code. This avoids repeated playback.
Package com. liu. zhen. utils;
();
43 * Parameters: sound: ID of the sound to be played, loop: number of cycles
44 * Returns: None.
45 * Description: playback sound
46 * Notes: none.
47 *************************************** ************************/
48 publicvoidplay (intsound, intuLoop ){
49 soundPool. play (soundPoolMap. get (sound), streamVolume, streamVolume, 1, uLoop, 1f );
50}
How does android add background
First file
Query ("SELECT * from {$dbtbpre}ecms_yue where id = '". $id. ""); Query data table require (' template/yue.temp.php '); Import Template file}db_close (); Close the MySQL link $empire=null; ?> Action class variable
A second file
Fetch ($SQL)) //Loop get query record {?> {"SongID":
, },
The above is a PHP loop code 2 files
http://localhost:82/e/song/?id=1322
Connection is like this! Pr
Chapter 2 music and sound effects
The advertisement says "there is no sound, no sound, no matter how good it is". Let's add the sound effect to the program.
In general, the game sounds are divided into two parts: music and sound. The intuitive difference is that the playing time of music is long and the resource file is large. The playback time of sound effects i
. There is only one imageview. When you click it, you can enter the music list listview to select which song to play .. The putextra key-value pairs in intent are sent to the activity that plays the music according to the selected ID .. In a music activity, different la s are used based on the values transmitted by intent. In fact, the artist's pictures are diffe
1. Service Introduction
Official explanation:ServiceIsAn application component that can perform long-running operations in the background and does not provide a user interface. another application component can start a service and it will continue to run in the background even if the user switches to anotherApplication
That is to say, a service is a component that can run in the background without providing a user interface. Other applications can start a service, and even switch to another appl
software architecture, but it's not a smooth road to a brighter future. Competition persists both with Apple platforms and with different vendors on the same industry chain as Android. Everyone is equal in front of Android, how to stand out from the same starting line, get the recognition of the market and customers, is a great challenge before us.
This paper a
;}}The above class to encapsulate music media information, some variables to see the name can also see what is, for example, said title,duration This class, is nothing more than song name, time-length and other information, some variable name word, but do not know what to use, In fact, I do not know what information, although printed out, but do not know exactly where to use, anyway, a brain is read out first, after the printout to see what is. Second
progress bar, is the proportion of the progress bar. The main is to convert these two.Two functions:1 because progress needs to be updated in real time, a thread is used in the system to send messages to the UI thread (every 100 milliseconds), to capture messages in the UI thread with handler, and to get the current position through the getcurrentposition of MediaPlayer. The corresponding position of Seekbar is calculated, and the Seekbar is updated
playback functions are included. On the Android interface, both the Music and Video applications callMediaPlayer. The following two figures are:MediaPlayerExamples of Android and Open Core:The following figure shows the MediaPlayer lifecycle.3.1 Introduction to common MediaPlayer Methods
Method: create (Contextcontext, Uriuri)Explanation: The static me
/PlayAudioByWWW.csSummary of myWe know that when using www loading assetbundle, it is not possible to have Chinese name and Chinese path , but the method used above, why the Chinese file can be loaded and played properly?The above is simply loading the file via WWW, and the loaded file is not in Unity's assetbundle format, so the notation is not the same as loading assetbundle.Problems that existWhen the Ogg format music file is loaded via WWW, it wil
Recently in making an Android phone on the music player, learned a lot of things, such as the use of Fragment,actionbar, and so on, here is the first to introduce the implementation of the lyrics synchronization.
The realization of the lyrics synchronization is simple: Get the time and lyrics in the lyrics file LRC, and then play the corresponding content within
Service translated into Chinese is the services, familiar with the Windows system students must be very familiar with. The service in Android is similar to the service function in Windows, where an invisible process executes in the background.Android services, it is different from the activity, it can not interact with the user, can not be started, run in the background of the program, if we quit the application, the service process does not end, it s
MvcplayerI tried to use the MVC pattern on Android to develop a music player.GitHub Address: Https://github.com/skyhacker2/MVCPlayer What is MVCFrom Wikipedia
Controller controllers-responsible for forwarding requests and processing requests.
Views View-Interface designer for graphical interface design.
Model-Programmer to write programs should have the function (implementation algorithm,
-fading woundsAR (artist) artist name, Ti (title) song Name, Al (album) album Name, by () editor (refers to the person who edited the LRC lyrics)The offset () time compensation value, in milliseconds, with positive values indicating overall advance, negative opposite.The time format in the lyrics is more agreeable: [00:00.20] etc., 00: minutes, 00: seconds,. 50 for the number of milliseconds,It is more convenient to turn them into milliseconds at the end of the process.Ext.: http://www.cr173.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.