The player functions are as follows:
1. Pause and play
2. Implement dragging, fast forward, and fast return
3. Synchronization of lyrics
4. Next song, last song.
5. album Image Display
6. Background playback. The notification bar is displayed.
7. Call, pause, stop, and start playing.
The interface is as follows:
During playback, an icon is displayed in the notification bar. Pause, icon disappears
When playing in the background, it will be displayed in the notification bar. Click to go To the playback page.
Usage Details:
Download the code of the music player module from GIthob.
Address: Download the music player module code
After the download, decompress the package and import the project to eclipse.
Use a project as a library and introduce it to the project.
1. Introduce the project
Create a project, right-click the project, right-click the project, properties, android, and add
Interface:
When adding, select the project you just downloaded and imported, and click OK
2. Configure AndroidManifest. xml
Network Access Permissions:
<Uses-permission android: name = "android. permission. INTERNET"/>
Configure activity and service:
<Activity android: name = "com. hck. music. ui. PlayMusicActivity"> </activity>
<Service android: name = "com. hck. music. server. PlayMusicServer"> </service>
Ui used by activity to play music
Service for playing music
3. All right, use it in the project:
When using PlayMusicActivity, you only need to use an intent to upload the corresponding data and start PlayMusicActivity.
First, put your data in an array. Musicean is a music entity class. You can see its attributes in the downloaded source code and save music information. For example
Private ArrayList <MusicBean> beans;
Public void playMusic1 (View view) {// click a button to play the video
Intent intent = new Intent ();
Intent. setClass (this, PlayMusicActivity. class );
Intent. putExtra ("music", beans. toArray (); // beans are a set of data that you have installed.
Intent. putExtra ("id", 0); // gets the corresponding music object at the position of the Set beans
Intent. putExtra ("type", "net"); // whether it is online or local. Enter "net" online or "local ".
StartActivity (intent );
}
// Music, id, type, cannot be changed
OK.
Demo: musicPlayerdemo
Note: This demo must be used with the address: Download the code of the music player module. The code of the music player module is the playback module. The demo shows how to use this module in applications.
The module code is completely transparent. You can modify the code, modify the interface, and annotate the code in detail.