Giter Club home page Giter Club logo

wechatvideoview's Introduction

作者:林冠宏 / 指尖下的幽灵

掘金:https://juejin.im/user/587f0dfe128fe100570ce2d8

博客:http://www.cnblogs.com/linguanh/

GitHub : https://github.com/af913337456/

为了您的直观体验,请务必看完下面 gif 图,源码 gitHub 链接在其之后。

为了避免大家浪费时间,直接先看下面的 Gif,略大,请耐心点。看完后,若你觉得会需要到,那么就请听我继续。 gif 链接http://123.57.244.105:8081/commentthumb/GIF.gif git显示,略大,请耐心

功能点

如果你看完上面的gif图,你会发现如下几点功能 (Function list):

1,直观的

  • 播放前,可以显示封面缩略图
  • 播放时,如果还没有本地缓存,那么先进行下载
  • 下载过程中,显示圆型区域进度效果
  • 下载后,播放完毕后可以循环播放
  • 播放已经播放过的,是具备本地缓存的,也就是既能播放网络,也能播放本地

2,隐藏的

  • 低耗电量
  • 低内存占用
  • 无延迟图与视频切换
  • 低耦合,高内聚,几行代码接入

解析

直观的功能点,几乎就是和新版微信的一样,从朋友圈点击一个视频,然后进入到一个 Activity 页面进行加载以及播放。

为什么低耗电量和低内存占用?

因为采用的是 SurfaceView 而不是 TextureView,图与视频切换的切换延迟也是这个原因。

在你的 Activity 中这样使用

这样就会以 id 为 activity_main 的 Relativelayout 为父容器装载。 因为要避免内存泄露,所以你还需要做完下面的一些步骤,不会超过6行代码。

wechatvideoview's People

Contributors

af913337456 avatar

Watchers

James Cloos avatar  avatar

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.