Author: Guan Hong Lam/Ghost Nuggets at fingertips: juejin.cn/user/178526… Blog: www.cnblogs.com/linguanh/ making: github.com/af913337456…

For your intuitive experience, please be sure to see the following GIF, source gitHub link after it.

The purpose of doing this thing is: to complete the design: a fake wechat APP that does not rely on various clouds, but uses C++ and Golang as the back end


In order to avoid wasting time, I will directly watch the Gif below. It is a little big, please be patient. After watching this, if you feel you need it, please listen to me continue.

Git display, slightly larger, please be patient

Making a link

Note: this display is only part of it, the point is: FFmpeg + Camera recording part, so your star is also an update notification (I notify you).

Github.com/af913337456…

The function point

If you watch the GIF above, you’ll notice the following Function list:

1. Intuitive

  • The cover thumbnail can be displayed before playing
  • If there is no local cache when playing, download it first
  • The round area progress effect is displayed during the download process
  • After downloading, it can be played in a loop after playing
  • Play what has already been played, it has local cache, that is, it can play both network and local

2. Hidden

  • Low power consumption
  • Low memory footprint
  • Delayless graph and video switching
  • Low coupling, high cohesion, a few lines of code, three classes

parsing

Intuitive function point, almost the same as the new wechat, click a video from moments, and then enter an Activity page for loading and playing.

Why low power consumption and low memory footprint?

This is due to the fact that we use SurfaceView instead of TextureView.

Use this in your Activity

Technical points (you can skip them)

1. Download operation:

Custom AsyncTask. PS: AsyncTask is more convenient than Thread + handler, but if the AsyncTask is ready to use, then it is destroyed.

2. Video playback combination: surfaceView + mediaPlayer

The surfaceView is used as the display, and the mediaPlayer decodes the relationship: mediaPlayer binds the surfaceView.

Why not use TextrueView?
3. Progress area

Custom View, 3 brushes, one circle, one edge, one sector.