I recently worked on a screen lock project in my company. I need to display the status of the music player on the screen lock page, similar to the screen lock page of Xiaomi. There are similar functions available on the Internet. Let's make a summary here.
First of all, this data information is sent from the Service (COM. Android. Music. mediaplaybackservice) in the music
;}}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
Playing video and audio in the win computer often uses the WindowsMediaPlayer player in the computer, while in Android, the audio and video are also played using the MediaPlayer player.is the life cycle of MediaPlayer. dle State: When a MediaPlayer object is instantiated with the keyword new or the Reset () method in the calling class is entered into this state; End State: when the release () method is call
call, also need to note that I write here is LinearLayout Layoutparams, so our custom view of the parent space if linearlayout, of course, you can also modify.
4, the use of the control
We just need to get space to call the Start method and then call Setfullscreen and Setnormalscreen in the Onconfigurationchanged method,
Layout
Activity Code
public class Mainactivity extends Appcompatactivity {
Commonvideoview videoview;
@Override
protected void onCreate (Bundle savedin
Sometimes, we take a picture or record a video, the library app does not recognize these newly generated files by default so open the library or video player found that the files are not found, you need to call Mediascanner scan to come out. A class was found from ffmpeg to scan media files. Public classFfmpegmediascannernotifierImplementsmediascannerconnectionclient {Privatemediascannerconnection mconnecti
Suggestion: before learning this instance, Please master the activity lifecycle related events and methods, so that the learning effect will be better.
This instance is for reference only and is not a perfect product. Due to time and technical limitations, we apologize for any shortcomings or errors. Hope enthusiastic netizens can continue to improve.
Below is part of the activity code (I usually have detailed comments ):
Package CN. chaoyang. activity; import Java. io. file; import Java. io. io
. The built-in methods are as follows:
boolean isShowing:当前悬浮控制栏是否显示
setMediaPlayer(MediaController.MediaPlayerControl player):设置控制的组件
setPrevNextListeners(View.OnClickListener next,View.OnClickListener prev):设置上一个视频、下一个视频的切换事件。
By default, the Media controller hovers over 3s and hides, touching the videoview of the response. By default, the Next button is hidden.third, the use of Vid
Objective
Although Android has built-in Videoview components and MediaPlayer classes to support the development of video players, but support the format, performance and so on are very limited, here with everyone to use the free Vitamio to create their own Android Universal player!
Body
I. Achievement of the goal
1.1 Support formats
Support mainstream video
PrefaceAlthough Android has built the VideoView component and MediaPlayer class to support the development of video players, the supported formats, performance, and other aspects are very limited, here we will use free Vitamio to create our Android universal player!
StatementWelcome to repost, but please keep the original source of the article :) blog Park: http
Introduction and use of Android universal player decoding framework Vitamio, androidvitamio
I. Introduction
Vitamio can smoothly play videos in common formats such as 720P or even 1080P hd mkv, FLV, MP4, MOV, TS, and RMVB, and supports MMS, RTSP, RTMP, and, HLS (m3u8) and other common video streaming protocols, including on-demand and live streaming.
Using the Vitamio framework is mainly because it can play
The implementation of the idea of a few lines of code can be done, put a button on the interface or with the play icon ImageView, click on the event to call the local player to play.Uri uri = uri.parse ("http://218.200.69.66:8302/upload/Media/20150327/43bfda1b-7280-469c-a83b-82fa311c79d7.m4v"); /Call the system's own player to play streaming video Intent intent =
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
[The Music marks for determining the sound level are called music marks. There are three kinds of music marks: G, F, and C )]
--- Basic five-line spectrum tutorial
Jamendo's gesture operation is used to control the playing of a song. There are four gestures corresponding to play, pause, last and next. This article mainly describes how to implement the gesture operation. As for the media player, I will not
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.