免费手机游戏、安卓游戏、免费应用下载,尽在37游社手游网!
首页 资讯中心 应用资讯 抖音云蹦迪原理是什么?抖音云蹦迪源码分析

抖音云蹦迪原理是什么?抖音云蹦迪源码分析

YYDS 37游社
lilongzhang
更新时间:2022-04-27 14:03:39 来源:37游社 浏览:190

抖音云蹦迪原理是什么?抖音云蹦迪怎么实现的?想了解更多内容,欢迎来37ys.com阅览。

Unity构建,源码简单,上手只要换图就可以了,可以说没什么技术点。

首先这是一个有联网的普通蹦迪游戏,上面设置了一个镜头自动移动的脚本,然后对接到你的直播间, 这样就可以一直播放所谓的蹦迪画面。

但这样子没有互动,怎么处理?

有一个关键点,抖音或者其他的弹幕都是有接口可以直接获取到数据

以抖音举例:

http://主机地址/douyin/liveroom/chat?token=xxx&room_id=6843198199583378191

返回

{
    "code": 200,
    "msg": "成功",
    "data": {
        "messages": [
            {
                "method": "WebcastChatMessage",
                "msg_id": "7004351817794718504",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "这个是打印机 打印的 是用手机控制的",
                    "user": {
                        "uid": "60302287312",
                        "nickname": "柱公子",
                        "avatar": "https:\/\/p6.douyinpic.com\/img\/tos-cn-i-0813\/de138d53ede04feb983d8c50959bb3e1~c5_100x100.jpeg?from=4010531038",
                        "unique_id": "xjdeu66699632",
                        "sec_uid": "MS4wLjABAAAA-FlfOWotWKrw7Pa5LlPAXCsyL0LNlGZzXRjCYZbX6Ro"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": "7004351952659043335",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "来了",
                    "user": {
                        "uid": "92503879594",
                        "nickname": "芦田爱肉",
                        "avatar": "https:\/\/p9.douyinpic.com\/img\/tos-cn-avt-0015\/9fc37d9fa74ffaec6df64bb8c97c8542~c5_100x100.jpeg?from=4010531038",
                        "unique_id": "336300484",
                        "sec_uid": "MS4wLjABAAAAEQhc63OtZ3RCVPZRxG58FxwgSLC1Rr38ts8KLG1rJzc"
                    }
                }
            },
            {
                "method": "WebcastLikeMessage",
                "msg_id": "7004351959184659496",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "点赞",
                    "user": {
                        "uid": "78770598932",
                        "nickname": "勇丽宇祺",
                        "avatar": "https:\/\/p6.douyinpic.com\/aweme\/100x100\/93c50024e9738b7c4653.jpeg?from=4010531038",
                        "unique_id": "178839669",
                        "sec_uid": "MS4wLjABAAAAuzJXGY3_OdU6M4Vc4PChlFzio8b1sLx--sD4rumxfcY"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": "7004351959515829252",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "来了",
                    "user": {
                        "uid": "101803873147",
                        "nickname": "大理·小青年",
                        "avatar": "https:\/\/p9.douyinpic.com\/aweme\/100x100\/2f95400028ea6e0e83d66.jpeg?from=4010531038",
                        "unique_id": "1172245756",
                        "sec_uid": "MS4wLjABAAAAzw5o0q7Vt7VMiRrTE-7vJpizjr0vbKhIz0Q6wD7Nb_g"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": "7004351963941147655",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "来了",
                    "user": {
                        "uid": "110631983396",
                        "nickname": "你的狗婧",
                        "avatar": "https:\/\/p6.douyinpic.com\/img\/tos-cn-i-0813\/7647b87edf5f455d9457f8273fd5a962~c5_100x100.jpeg?from=4010531038",
                        "unique_id": "1978282703",
                        "sec_uid": "MS4wLjABAAAAYXt-KjJ2DYJcR8H19TOw_JYFpSTixH8rn7lbRIYZYbk"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": "7004351964776207364",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "来了",
                    "user": {
                        "uid": "61931422008",
                        "nickname": "鱼头",
                        "avatar": "https:\/\/p9.douyinpic.com\/img\/tos-cn-avt-0015\/1b5cddb1c8c95d9dd6f27a109fa81c9f~c5_100x100.jpeg?from=4010531038",
                        "unique_id": "28338607",
                        "sec_uid": "MS4wLjABAAAAiWaDmSQmSEmUNmr0Yk8hZMT9Vrch7qgn5mEyKmoEx9E"
                    }
                }
            },
            {
                "method": "WebcastLikeMessage",
                "msg_id": "7004351966726345728",
                "payload": {
                    "room_id": "7004347458255899428",
                    "content": "点赞",
                    "user": {
                        "uid": "78770598932",
                        "nickname": "勇丽宇祺",
                        "avatar": "https:\/\/p6.douyinpic.com\/aweme\/100x100\/93c50024e9738b7c4653.jpeg?from=4010531038",
                        "unique_id": "178839669",
                        "sec_uid": "MS4wLjABAAAAuzJXGY3_OdU6M4Vc4PChlFzio8b1sLx--sD4rumxfcY"
                    }
                }
            }
        ],
        "cursor": "1630827777298_7004351967623387615_1_1",
        "fetch_interval": 1000,
        "now": 1630827777298,
        "internal_ext": "fetch_time:1630827777298|start_time:1630827750419|ack_ids:7004351852948165645_1452,7004351857293005859_1454,7004351869438972966_1458,7004351862568962846_145c,7004351879540167693_145e,7004351879540265997_145e,7004351891874993183_1464,7004351893401244685_1464,7004351895703753767_1464,7004351894389904391_1464,7004351897327064075_1466,7004351891043963944_1466,7004351911935628324_146c,7004351917715706884_146e,7004351918093177870_1470,7004351920580105248_1470,7004351937642910759_1478,7004351939817100318_1478,7004351949411931177_147c,7004351955974935588_1480,7004351959184544808_1482,7004351964708623395_1484,7004351964776223748_1484,7004351966726345728_1486|flag:1|seq:1|next_cursor:1630827777298_7004351967623387615_1_1|door:2-n25",
        "ignores": [
            "WebcastRoomMessage",
            "WebcastRoomIntroMessage",
            "WebcastRoomUserSeqMessage"
        ]
    }
}

你会发现,其实用户的基本信息都已经拿到,接下来就是所谓的弹幕命令,这个很基础,实现也很多,但都是解析字符串,自己研究吧。
其实你仔细看,这就是一些直播弹幕姬的原理,有的开发者天天拿着弹幕姬只有个位数的人在看,满屏都是弹幕姬在读,但有的人直接开发蹦迪现场,所以别人赚钱不是没有理由的。

回复

暂无评论

不要再留垃圾评论了,主题君整理资源不容易,留几句鼓励的话吧。

猜你喜欢