Android video/audio cache frame Androidvideocache

Source: Internet
Author: User

The Androidvideocache is a video/audio cache library that uses local proxies to enable edge-to-bottom playback, which is very simple to use.

Httpproxycacheserver is the main class, is a proxy server, you can configure the number of cache files, the size of the cache file, the directory of cache files and the cache file naming algorithm, the file cache is based on the LRU algorithm, using Builder to configure:

 //    Builder cachedirectory (file file);  //  public   Builder Filenamegenerator (Filenamegenerator filenamegenerator);  //  public  Builder maxcachesize (long   maxSize);  //  Configure the number of cache files  public  Builder Maxcachefilescount (int  count); 

It is recommended to store httpproxycacheserver in a single-column mode in application:

 Public classAppextendsApplication {PrivateHttpproxycacheserver Proxy;  Public StaticHttpproxycacheserver GetProxy (context context) {app app=(APP) context.getapplicationcontext (); returnApp.proxy = =NULL? (App.proxy =App.newproxy ()): App.proxy; }    Privatehttpproxycacheserver Newproxy () {return NewHttpproxycacheserver ( This); }}

It is very convenient to call, just add one line of code:

@Override protected void onCreate (Bundle savedinstancestate) {super. OnCreate (savedinstancestate);     = GetProxy ();     = Proxy.getproxyurl (video_url);    Videoview.setvideopath (Proxyurl);} Private httpproxycacheserver GetProxy () {    return  app.getproxy (Getapplicationcontext ());}

Android video/audio cache frame Androidvideocache

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.