Gift playback

As shown above, the left side is a common gift, luxury gift right. The following highlights how luxurious gift.
Air source code APP luxury gift gif and clouded leopard svga formats have all dynamically loaded through a network, rather than hard-coded into the app, which can effectively reduce the volume of app.
When the user sending a gift to the model when the first request to a backend interface, the user deduction gold, to reflect the number of votes increases anchor, and then generates a token, back to the client. This token is used to identify a behavior to send gifts, valid only once. When the client receives the http response, obtain the token from the response data, and then call the method socket communication, sends this token to the socket server, then broadcast to the user socket between all current broadcast. As each user receives the socket message, the json parsing to obtain the data inside, get gifts of human id, nickname, gift id, name, type (ordinary or luxury gifts), download address and other data.
If it is luxury gift, go check the local disk, there is no change resource file cache gift, if not, to download. After the download is complete, depending on the type of gift is a gift or gif svga gift, calling different methods on display.
For gif gift, we are using koral- / android-gif-drawable library for playback.
----------------
Disclaimer: This article is the original article CSDN bloggers "clouded leopard Technology Crown", following the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/yun_bao_2144899870/article/details/99428803

Guess you like

Origin www.cnblogs.com/vana/p/11387984.html