Preface
Due to factors such as the speed of the network, buffering is usually required for playing online videos. Generally, you can set the buffer to be increased and the progress bar to be buffered to improve the experience.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog: http://www.cnblogs.com
Vitamio: http://vitamio.org
Farmer's uncle: http://over140.cnblogs.com
Body
I. Main Code
/** Whether to automatically Resume playback, used to automatically pause and Resume playback */
Private boolean needResume;
@ Override
Public boolean onInfo (MediaPlayer arg0, int arg1, int arg2 ){
Switch (arg1 ){
Case MediaPlayer. MEDIA_INFO_BUFFERING_START:
// Start caching and pause playing
If (isPlaying ()){
StopPlayer ();
NeedResume = true;
}
MLoadingView. setVisibility (View. VISIBLE );
Break;
Case MediaPlayer. MEDIA_INFO_BUFFERING_END:
// The cache is complete and playback continues
If (needResume)
StartPlayer ();
MLoadingView. setVisibility (View. GONE );
Break;
Case MediaPlayer. MEDIA_INFO_DOWNLOAD_RATE_CHANGED:
// Display download speed
Logger. e ("download rate:" + arg2 );
Break;
}
Return true;
}
Code for setting the buffer size:
MVideoView. setBufferSize (bufSize)
The Unit is byte. The default size is KB (1 M ).
Ii. OPlayer
Download
Step # Taocode (SVN): (register one without an account)
Project address: http://code.taobao.org/p/oplayer
SVN address: http://code.taobao.org/svn/oplayer/
Google Play)
Https://play.google.com/store/apps/details? Id = com. nmbb. oplayer
Have time to correct
End
The more important the company attaches, the more important it is. The more important it will be, the more practical articles related to Vitamio will be written. Thank you for your continued support of Vitamio!