search

Home  >  Q&A  >  body text

ios - 有关弹幕的东西

想要实现那种悬浮弹幕。
弹幕中包含头像、内容。
来一条数据向上推出一条弹幕。弹幕持续时间规定好。
弹幕超出范围消失。
类似群聊功能那种从下向上出来。
怎么样实现最好。还涉及到到和数据交互。

目前我的想法是:监测到服务器推送数据过来,创建一个自定义的View,添加到屏幕。在推送数据过来,在创建一个View。上一个View如果存在计算view高度,实现上一个View的动画。大致思路就是这样。
但是如果同时推过来很多数据怎么办。性能会不会不好。能不能用Tableview去实现。
新人求指教哈哈---

黄舟黄舟2814 days ago763

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-18 09:28:00

    A pseudo barrage function I recently made seems to be very suitable for your needs. I implemented it using tableview, so that I don’t have to think too much about view reuse. Post the image first!

    • Regarding the barrage view, it is actually quite simple. In order to make the barrage come out from bottom to top, I rotated the transform of the tableview and cell. Then, if there is no new barrage, a cell will be inserted from the top!

    • Regarding data requests, because my project is not a live broadcast type, I have to consider both the old barrage data and the newly pushed data! So when entering the video details page, a batch of barrage data and formats will be requested. As follows,

    {
      "content_html": "

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:28:00

    Use ffmpeg to decode the video and opengl to render the image

    If you want to add barrages, you only need to draw text or textures in the context of opengl, and it is also very convenient to make animations

    reply
    0
  • Cancelreply