Code Monkey home page Code Monkey logo

video_cache_for_flutter's Introduction

Flutter 视频缓存插件

一个基于 Shelf Web Server 的视频缓存框架,使用 Shelf 做代理服务器,拦截播放器的请求做重定向,然后缓存结果,下一次请求就先读取缓存,没有缓存就重新请求结果。

如何使用

先导入框架

video_cache_plugin: 
  git: 
    url: 'https://github.com/beishicat/video_cache_for_flutter.git'
  1. 开启代理

    VideoCache.setupProxy();

    如果想要对视频缓存的 key 进行处理

    VideoCacheManager().processingCachekey = (key) async {
      // 示范处理,更具自己需求来
      return key.split('?').first;
    };
  2. 生成代理播放链接

    final url = 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';
    final videoUrl = VideoCache.proxyURL(url);
  3. 将生成的代理播放链接放入播放器直接播放。

  4. 清除缓存

    VideoCacheManager().cleanCache();

依赖插件

  • shelf 1.4.1
  • dio 5.2.1+1
  • path_provider 2.1.1
  • crypto 3.0.3

video_cache_for_flutter's People

Contributors

beishicat avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lilicode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.