Using Vitamio to create your Android universal player (12)-playing network video Buffering

Source: Internet
Author: User

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!

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.