Synchronize the lyrics of the android mobile music player
I recently learned a lot from a music player on an android phone, such as Fragment and ActionBar. Here I will first introduce the implementation of lyrics synchronization.
The idea of implementing lyrics synchronization is simple: Get the time and the content of
to understand how to get the value. If you do not understand, it's okay, I have an article in Hon Yang is more specific. Recommend to you: http://blog.csdn.net/lmj623565791/article/details/45022631, still waiting for what. Poke it in and take you to fly. 2. Define your own controlsSource code 1:Source Code 2:PS: Two copies of the above self-defined source code. In fact you look carefully. The difference is not very big, changed a place, the change of place, in fact, in our current project encou
(Global.bt_play_play = = False) {Play.setbackgroundresource (r.drawable.xml_player_play); Global.bt_play_play = true;}The Global.bt_play_play is a boolean static variable, which, by default, is true, which is used to determine whether a pattern is currently a divine horse or not.It looks like there's a problem with the wood, but it works:Just run up:After clicking:Click once more:Why is it that there is an oval circle in it? And the picture changes, the previous picture did not disappear, coinc
android.content.Intent.ACTION_ The view intent data is set to the URI of an audio file, * and its MIME type is established so that Android can pick the appropriate application for playback. */intent Intent = new Intent (Android.content.Intent.ACTION_VIEW); File sdcard = Environment.getexternalstoragedirectory (); File AudioFile = new file (Sdcard.getpath () + "/good.mp3"), and/or place a file name in the SD card that is called the good mp3. Intent.se
that was obtained before the activity was bound to the service. whenever the activitybinder.transact (0, data, reply, 0); When invoked, the service invokes the Ontransact method, loads the obtained data into the parcel object reply, and then the entire The IBinder object returns activity. MP3 player This is finished, may be very messy, I hope to help you, source code download Link: http://download.csdn.net/detail/sinat_23092639/8933995 Copyright NO
Android app-simple and beautiful music players add phone monitors
In September 2nd, the simplified and beautiful music players started Stage 1
Stage 1 has completed the following functions:
1. automatically display the music list
2. Click the list to play the music.
3. Long press List dialog box
4. Pause music
5. Last music
6. Next music
7. automatically play the next song
8. Single Loop
9. All Loops
10. Random playback
In
reply,
Int flags) throws RemoteException {
String str = data.readString();
Int currentPosition = mediaPlayer.getCurrentPosition();
Float s = (float)currentPosition/mediaPlayer.getDuration();
If(isPlay)
reply.writeFloat(s);
Return super.onTransact(code, data, reply, flags);
}
Yes, I do. It is the IBinder object that was obtained prior to the activity and service binding. whenever the activitybinder.transact (0, data, reply, 0); The service calls the Ontransact method. Load the acquired
encoding.Number of referencesEncoding subtitle encoding. Assume that null will self-detect itself.public int getsublocation ()Gets the caption position type. 0 for inline subtitles, 1 for external subtitles.public void Setsubpath (String subpath)Sets the external caption path. Must be a local file path.Public String Getsubpath ()Gets the external caption path.public void Setsubtrack (int trackid)Sets the caption number. Must be a return value of Getsubtrackmap.public int Getsubtrack ()Gets the
The code for updating the playback time and progress bar of the music player in Android is in the packages/audio music/mediaplaybackactivity. Java file.
Source code reference: http://www.oschina.net/code/explore/android-2.2-froyo/com/android/music/MediaPlaybackActivity.java
1. In the onstart () function, start to updat
(); Mediaplayer.setdatasource (filepath);//set the data source for playbackMediaplayer.setaudiostreamtype (Audiomanager.stream_music); Mediaplayer.prepare ();//ready to start playback, the logic of playback is the C code executed on the new thread. Mediaplayer.start (); Bt_play.setenabled (false); Mediaplayer.setoncompletionlistener (NewOncompletionlistener () { Public voidoncompletion (MediaPlayer arg0) {bt_play.setenabled (true); } }); } Catch(Exception e) {Toast.mak
Recently I wrote a simple android Audio/Video Player:
1. Scan and play sdcard music files
2. The lyrics synchronization function (only the line can be synchronized, because it is in lrc format. If you need to synchronize to every word, you need to parse the krc file like kogou)
3. Video Playback
4. Play the network video function (listview can pull down and refresh to obtain network disconnection data)
() again before starting playback for the first time, because the Create method has already been called. return Super.onstartcommand (Intent, flags, startid); } /*** service is stopped after call */@OverridePublic void OnDestroy () { mediaplayer.stop (); //Stop playing mediaplayer.release (); //release prepared resources, and if you still need to use this object, you can first do not destroy }}Mainactivity.java:Package Thonlon.example.cn.servicedemo;import android.content.Intent
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.