WO2018177404A1 - 一种用于直播中更新在线人数的方法及系统 - Google Patents

一种用于直播中更新在线人数的方法及系统 Download PDF

Info

Publication number
WO2018177404A1
WO2018177404A1 PCT/CN2018/081278 CN2018081278W WO2018177404A1 WO 2018177404 A1 WO2018177404 A1 WO 2018177404A1 CN 2018081278 W CN2018081278 W CN 2018081278W WO 2018177404 A1 WO2018177404 A1 WO 2018177404A1
Authority
WO
WIPO (PCT)
Prior art keywords
live
live broadcast
client
updating
online
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2018/081278
Other languages
English (en)
French (fr)
Inventor
汪刚
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Publication of WO2018177404A1 publication Critical patent/WO2018177404A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/61Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • H04L65/401Support for services or applications wherein the services involve a main real-time session and one or more additional parallel real-time or time sensitive sessions, e.g. white board sharing or spawning of a subconference
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44213Monitoring of end-user related data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/488Data services, e.g. news ticker
    • H04N21/4882Data services, e.g. news ticker for displaying messages, e.g. warnings, reminders

Definitions

  • the present invention relates to the field of Internet mobile application development, and particularly relates to a method for updating the number of online users in a live broadcast and a system for updating the number of online users in a live broadcast.
  • the user will enter and leave the room during the live broadcast, resulting in a change in the current online number of the anchors. If the current online number of live broadcasts in the live broadcast software cannot be updated in real time, The live room will display a wrong number of online users, which will not reflect the popularity of the current live broadcast.
  • the present invention aims to provide a method for updating the number of online users in a live broadcast and a system for updating the number of online users in a live broadcast, which can conveniently and quickly perform the current online number of people in the live broadcast room. Update.
  • the live broadcast client receives the current online number of live broadcasts sent by the barrage server;
  • S2 The live client sends the current online number of the live room to the view controller of the iOS system by proxy;
  • the view controller sends a notification for updating the live broadcast client UI to the sub-interface according to the current number of online users in the live broadcast.
  • the sub-interface is a view interface unit that displays the number of online users in the live client UI.
  • the throwing operation of the notification is performed in the main thread of the live broadcast client;
  • the sub-interface obtains a notification for updating the live client UI, and performs an update of the online number display in the sub-interface.
  • the notification of updating the live broadcast client UI includes an execution code, and the execution code is used to update the online number of people in the sub-interface according to the current number of online users in the obtained live broadcast.
  • the notification of updating the live broadcast client UI is a declaration function
  • the execution code is located in the declaration function, and execution of the execution code is performed in a main thread of a live broadcast client.
  • S301 Determine whether the notification of updating the live client UI includes an execution code, if yes, go to S402, if not, end;
  • S302 Determine whether execution of the execution code is performed in the main thread, and if yes, go to S4, if not, transfer the execution of the execution code back to the main thread, and then go to S4.
  • the live client and the barrage server communicate based on the socket.
  • the current online number of live rooms in the view controller of the iOS system is converted into a long long type of data.
  • the barrage server sends a room number change type message to the live client at a preset time interval.
  • the invention also discloses a system for updating the number of online users in a live broadcast, comprising:
  • a data receiving module configured to receive a current online number of live rooms sent by the barrage server to the live client;
  • a data transmission module configured to throw the current online number of the live rooms received by the data receiving module into the view controller of the iOS system, and control the view controller to pop the updated live client according to the current number of online users in the live broadcast room
  • the notification of the UI, and the throwing operation of the notification is performed in the main thread of the live broadcast client, where the sub-interface is a view interface unit that displays the number of online users in the live client UI;
  • a data update module is configured to perform an update of the online number of people displayed in the sub-interface according to the notification of updating the live client UI.
  • the notification of updating the live broadcast client UI includes an execution code, and the execution code is used to update the online number of people in the sub-interface according to the current number of online users in the obtained live broadcast.
  • the barrage server sends a room number change type message to the live client at a preset time interval.
  • the method for updating the number of online users in the live broadcast has the advantages that the room number change type message is sent to the live broadcast client through the barrage server, so that the live broadcast client can perform the current online number of the live broadcast room.
  • the update the barrage server performs the message push active control mode, which is convenient for the background personnel to flexibly control the frequency of the message push; meanwhile, the two-level agent is used to obtain the current online number of the live room from the received room number change type message to proxy
  • the method is thrown to the view controller, and the view controller throws a notification to update the live client UI to the sub-interface in a proxy manner, effectively processes the distribution of the event, and respectively completes the sending and sending of the respective messages, and the event logic is clearly processed.
  • the sub-interface can complete the update of the online number of people in the live broadcast, effectively reflecting the current popularity of the live broadcast room.
  • An advantage of the system for updating the number of online users in a live broadcast is that the data receiving module receives the current online number of live broadcasts sent by the barrage server, and the current online number of the received live broadcast rooms is thrown to the view controller, the view The controller throws a notification to update the live client UI to the sub-interface, and the sub-interface can update the online number display, so that the anchor or the viewer can grasp the current popularity of the live broadcast, and the current online population update process in the entire live broadcast is logically defined and implemented. Convenience.
  • FIG. 1 is a flow chart of a method for updating a number of online people in a live broadcast according to the present invention.
  • an embodiment of the present invention provides a method for updating the number of online users in a live broadcast, which is used to update the number of online users in the live broadcast client in the iOS system.
  • the live broadcast client is located.
  • the smart mobile device is a mobile phone or a tablet. Specifically include:
  • the live broadcast client receives the current number of online users sent by the barrage server, and the barrage server sends the current online number of the live broadcast room to the live client in the form of a message, and the message sent by the barrage server to the live client has multiple types.
  • the current number of online users in the live broadcast room belongs to the room number change category message.
  • the live client uses the function receiveAssistMessageWithType to accept the message sent by the barrage server.
  • the parameter hostType in the function receiveAssistMessageWithType is used to indicate the server type, which represents the barrage server.
  • the type of message sent to the live client by the barrage server such as: the barrage type, the number of people change, the number change category is divided into all live broadcast number changes, the number of room changes, etc., so when the live client receives the bullet
  • the function isEqualToString is used to determine whether the type of the received message is a change of the number of people. If the number of people changes, the logic processing is performed on the message, and the function receivingAssistMessageWithType is used to further determine whether the message is of the receiveAssistMessageWithType type.
  • the receiveAssistMessageWithType type is expressed as the room number change class, because the change in the number of viewers in the live broadcast belongs to the in-room message. For this, the live client only needs to process the room number change class message.
  • the live client sends the current online number of the live broadcast room to the view controller of the iOS system by proxy, and the current online number of the live broadcast room sent to the view controller of the iOS system is converted into a long long data type, long
  • the long type is a data type of the Objective-C language, similar to the double type.
  • the room number change type message the current online number of people in the live broadcast room is obtained by the function [decoder getItem:@"uc"], and the current online number of the obtained live rooms can be recorded as usercount.
  • the current online number in the live broadcast room is thrown to the view controller of the iOS system through the proxy function, and the proxy function is socketKeepLive.
  • the proxy function is socketKeepLive.
  • the current online number of people in the live broadcast room is thrown.
  • the proxy feature of the iOS system only the proxy protocol of the view server is obeyed, and the function of -(void)socketKeepLive:(NSString*)usercount is implemented, and the view server can
  • the number of current online users in the live broadcast room received by the agent is simple, and the notification and reception of the entire message is simple.
  • only the view server processes the current online number of messages in the live broadcast room, and does not require other controllers to process the message in advance, simplifying the operation.
  • the view controller sends a notification to update the live interface UI (User Interface) to the sub-interface.
  • the live client UI is the live client software of the smart mobile device.
  • the UI, the sub-interface is a view interface unit that displays the number of online people in the live client UI, and the notification throw operation is performed in the main thread of the live client.
  • the notification of updating the live client UI includes an execution code, and the execution code is used to update the online number of people in the sub-interface according to the current number of online users in the obtained live room. According to the development characteristics of the iOS system language, the update UI must be performed in the main thread of the application.
  • the view controller is used to control the display of the live client UI.
  • the live client UI is composed of multiple view interface units. Each view interface unit displays different content categories. Each view interface unit corresponds to a sub-interface, and the sub-interface is a view. Controlled by the view controller, the view controller controls the ViewController in the iOS system.
  • the sub-interface is a view interface unit that displays the number of online users in the live client UI.
  • the execution code is specifically:
  • the notification to update the live client UI is a declaration function, the execution code is located in the declaration function, and the execution of the execution code is performed in the main thread of the live client.
  • the declaration function is executeInMainQueue.
  • S301 Determine whether the notification of updating the live client UI includes an execution code, if yes, go to S402, if not, end, that is, the execution of the declaration function is terminated. By judging whether the execution code exists or not, it is to avoid the case where the incoming execution code is empty, causing the live client program to crash.
  • S302 Determine whether execution of the execution code is performed in the main thread, and if yes, go to S4, if not, transfer the execution of the execution code back to the main thread, and then go to S4. Execution of the execution code is judged by the function [NSThreadisMainThread] in the main thread. If it is not in the main thread, the execution of the execution code is transferred back to the main thread using the function dispatch_async(dispatch_get_main_queue(), block).
  • the process of updating the notification of the live client UI may be performed: in the execution code, the function respondsToSelector is used to determine whether the implementation of the setPersonNum:number: function exists, and if so, Use the function [self.danmuDelegatenumber:count]; to update the live client UI to proxy to the sub-interface.
  • the sub-interface obtains a notification for updating the live client UI, and performs an update of the online number display in the sub-interface.
  • the live client communicates with the barrage server based on a socket (programming interface).
  • the socket is a handle of a communication chain, which is used to implement communication between different virtual machines, different computers or different devices, and uses a socket to change the number of rooms. From the barrage server to the live client, the amount of data in the socket communication is large and fast, and the server resources occupied are small, which can effectively ensure the timeliness of the message transmission of the room number change.
  • the barrage server sends a room number change type message to the live client at a preset time interval, so that the update frequency of the online number of people can be controlled and used flexibly.
  • the method for updating the number of online users in the live broadcast is sent to the live broadcast client through the barrage server, so that the live broadcast client can update the current online number of the live broadcast room, and the barrage server pushes the message.
  • the method of active control is convenient for the background personnel to flexibly control the frequency of message push.
  • the two-level agent is used to obtain the current online number of the live room from the received room number change type message and throw it to the view controller in the form of proxy.
  • the controller throws a notification to update the live client UI to the sub-interface in a proxy manner, effectively processes the distribution of the event, and each completes the sending and sending of the respective message, and the event logic is clearly processed; the sub-interface receives the updated live client.
  • the notification of the UI the online number of people in the live broadcast can be updated, effectively responding to the current popularity of the live broadcast room.
  • the embodiment of the invention further discloses a system for updating the number of online users in a live broadcast based on the above method for updating the number of online users in a live broadcast, comprising: a data receiving module, a data transmission module and a data updating module.
  • the data receiving module is configured to receive the current online number of the live broadcast room sent by the barrage server to the live client; the data transmission module is configured to send the current online number of the live rooms received by the data receiving module to the view controller of the iOS system, and the control view
  • the controller sends a notification for updating the live client UI to the sub-interface according to the obtained current number of live rooms in the live broadcast room, and the throwing operation of the notification is performed in the main thread of the live broadcast client, and the sub-interface displays the number of online users in the live client UI.
  • the view interface unit is configured to update the online number of people in the sub-interface according to the notification of updating the live client UI.
  • the notification of updating the live client UI includes an execution code, and the execution code is used to update the online number of people in the sub-interface according to the current number of online users in the obtained live room.
  • the barrage server sends a room number change type message to the live client at a preset time interval.
  • the system for updating the number of online users in the live broadcast the data receiving module receives the current online number of the live broadcast rooms sent by the barrage server, and the current online number of the received live broadcast rooms is thrown to the view controller, the view controller
  • the notification of updating the live client UI is sent to the sub-interface, and the sub-interface can update the online number display, so that the anchor or the viewer can grasp the current popularity of the live broadcast, and the current online population update process in the entire live broadcast is logical and easy to implement.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Social Psychology (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本发明涉及互联网移动端应用开发领域,公开了一种用于直播中更新在线人数的方法,包括:S1:直播客户端接收弹幕服务器发送的直播间当前在线人数;S2:直播客户端以代理方式将直播间当前在线人数发送至iOS系统的视图控制器;S3:根据获得的直播间当前在线人数,视图控制器以代理方式向子界面抛出更新直播客户端UI的通知,所述子界面为直播客户端UI中显示在线人数的视图界面单元,所述通知的抛出操作在直播客户端的主线程中进行;S4:子界面获取更新直播客户端UI的通知,进行子界面中在线人数显示的更新。本发明还公开了一种用于直播中更新在线人数的系统。本发明能够方便快捷的对直播间当前在线人数进行更新。

Description

一种用于直播中更新在线人数的方法及系统 技术领域
本发明涉及互联网移动端应用开发领域,具体涉及一种用于直播中更新在线人数的方法和一种用于直播中更新在线人数的系统。
背景技术
随着科技的快速发展,手机等智能移动设备的功能越发强大,为丰富业余生活,人们经常使用智能移动设备进行直播及观看直播,在移动端的直播过程中,各个直播间存在直播人气的概念,与直播人气相对应为直播间的当前在线人数,某一直播间的当前在线人数越多,说明该直播间越火爆。人气对于用户来说是告知某个直播间是否火爆的重要信息,同时,人气对于主播来说也是一种极大地鼓励。
但是,对于某一个直播间,主播在直播的过程中,用户会进出房间,导致主播间的当前在线人数发生变化,若无法及时对移动端直播软件中直播间的当前在线人数进行实时更新,则直播间会显示一错误的在线人数,从而无法真实反映当前直播间的人气。
发明内容
针对现有技术中存在的缺陷,本发明的目的在于提供一种用于直播中更新在线人数的方法和一种用于直播中更新在线人数的系统,能够方便快捷的对直播间当前在线人数进行更新。
为达到以上目的,本发明采取的技术方案是:包括:
S1:直播客户端接收弹幕服务器发送的直播间当前在线人数;
S2:直播客户端以代理方式将直播间当前在线人数发送至iOS 系统的视图控制器;
S3:根据获得的直播间当前在线人数,视图控制器以代理方式向子界面抛出更新直播客户端UI的通知,所述子界面为直播客户端UI中显示在线人数的视图界面单元,所述通知的抛出操作在直播客户端的主线程中进行;
S4:子界面获取更新直播客户端UI的通知,进行子界面中在线人数显示的更新。
在上述技术方案的基础上,所述更新直播客户端UI的通知中含有执行代码,所述执行代码用于根据获取的直播间当前在线人数更新子界面中的在线人数显示。
在上述技术方案的基础上,所述更新直播客户端UI的通知为声明函数,所述执行代码位于所述声明函数中,且所述执行代码的执行在直播客户端的主线程中进行。
在上述技术方案的基础上,当更新直播客户端UI的通知抛出后:
S301:判断更新直播客户端UI的通知中是否含有执行代码,若有,转到S402,若没有,则结束;
S302:判断执行代码的执行是否在主线程中进行,若是,转到S4,若不是,则将执行代码的执行操作调回主线程中,然后转到S4。
在上述技术方案的基础上,所述直播客户端与弹幕服务器间基于socket进行通讯。
在上述技术方案的基础上,抛至iOS系统的视图控制器中的直播间当前在线人数,被转化为long long型的数据类型。
在上述技术方案的基础上,所述弹幕服务器按预设时间间隔向直播客户端发送房间人数变化类消息。
本发明还公开了一种用于直播中更新在线人数的系统,包括:
数据接收模块,其用于接收弹幕服务器向直播客户端发送的直播间当前在线人数;
数据传输模块,其用于将数据接收模块接收的直播间当前在线人数抛入iOS系统的视图控制器中,以及控制视图控制器根据获得的直播间当前在线人数向子界面抛出更新直播客户端UI的通知,且所述通知的抛出操作在直播客户端的主线程中进行,所述子界面为直播客户端UI中显示在线人数的视图界面单元;
数据更新模块,其用于根据更新直播客户端UI的通知,进行子界面中在线人数显示的更新。
在上述技术方案的基础上,所述更新直播客户端UI的通知中含有一执行代码,所述执行代码用于根据获取的直播间当前在线人数更新子界面中的在线人数显示。
在上述技术方案的基础上,所述弹幕服务器按预设时间间隔向直播客户端发送房间人数变化类消息。
与现有技术相比,本发明一种用于直播中更新在线人数的方法的优点在于:通过弹幕服务器将房间人数变化类消息发送给直播客户端,便于直播客户端进行直播间当前在线人数的更新,弹幕服务器进行消息推送主动控制的方式,便于后台人员对消息推送的频率进行灵活控制;同时,使用两级代理,从接收的房间人数变化类消息中获取直播间当前在线人数以代理的方式抛给视图控制器,视图控制器以代理方式向子界面抛出更新直播客户端UI的通知,有效的对事件的分发做了处理,各自完成各自消息的抛出发送,事件逻辑处理清晰;子界面接收到更新直播客户端UI的通知后,即可完成直播间的在线人数的更新,有效反应直播间的当前人气。
本发明一种用于直播中更新在线人数的系统的优点在于:数据接 收模块接收到弹幕服务器发送的直播间当前在线人数,同时接收的直播间当前在线人数被抛送给视图控制器,视图控制器向子界面抛出更新直播客户端UI的通知,子界面即可进行在线人数显示的更新,便于主播或观众掌握直播间的当前人气,整个直播间当前在线人数更新过程逻辑分明,且实施方便。
附图说明
图1为本发明一种用于直播中更新在线人数的方法的流程图。
具体实施方式
以下结合附图及实施例对本发明作进一步详细说明。
参见图1所示,本发明实施例提供一种用于直播中更新在线人数的方法,用于对iOS系统中直播客户端内直播间在线人数的更新,本发明实施例中,直播客户端位于操作系统为iOS系统的智能移动设备中,智能移动设备为手机或平板电脑。具体包括:
S1:直播客户端接收弹幕服务器发送的直播间当前在线人数,弹幕服务器以消息的形式向直播客户端发送直播间当前在线人数,且弹幕服务器发送给直播客户端消息有多种类型,直播间当前在线人数属于房间人数变化类消息。直播客户端使用函数receiveAssistMessageWithType接受弹幕服务器发送过来的消息,函数receiveAssistMessageWithType中的参数hostType用以表示服务器类型,此处代表弹幕服务器。
弹幕服务器发送给直播客户端消息的类型,如:弹幕文字类、人数变化类,人数变化类又分为全部直播人数变化类、房间人数变化类等等,因此当直播客户端收到弹幕服务器发送的消息后,需使用函数isEqualToString判断收到的消息的类型是否为人数变化类,若是人数 变化类,则对消息进行相关的逻辑处理,并使用函数receiveAssistMessageWithType进一步判断消息是否为receiveAssistMessageWithType类型,receiveAssistMessageWithType类型即表示为房间人数变化类,因为直播间观看人数的变化属于房间内地消息,对此,直播客户端只需对房间人数变化类消息进行处理。
S2:直播客户端以代理方式将直播间当前在线人数发送至iOS系统的视图控制器,发送至iOS系统的视图控制器中的直播间当前在线人数,被转化为long long型的数据类型,long long型是Objective-C语言的一种数据类型,类似double类型。房间人数变化类消息中直播间当前在线人数的获取通过函数[decoder getItem:@"uc"],同时可以将获取的直播间当前在线人数记为usercount。
直播间当前在线人数通过代理函数抛至iOS系统的视图控制器,代理函数为socketKeepLive。通过代理方式将直播间当前在线人数抛出方式,根据iOS系统的代理特性,只需代理遵从视图服务器的代理协议,同时实现-(void)socketKeepLive:(NSString*)usercount这个函数,视图服务器便能够接受到代理抛出的直播间当前在线人数,整个消息的通知和接收简单,同时仅需视图服务器对直播间当前在线人数消息进行处理,无需其它控制器对消息的前期处理,简化操作。
S3:根据获得的直播间当前在线人数,视图控制器以代理方式向子界面抛出更新直播客户端UI(User Interface,用户界面)的通知,直播客户端UI为智能移动设备中直播客户端软件的UI,子界面为直播客户端UI中显示在线人数的视图界面单元,通知的抛出操作在直播客户端的主线程中进行。更新直播客户端UI的通知中含有一执行代码,执行代码用于根据获取的直播间当前在线人数更新子界面中的 在线人数显示。根据iOS系统语言的开发特性,更新UI必须在应用的主线程中进行,因此,更新直播客户端UI的通知的抛出操作和执行代码的执行均需在直播客户端的主线程中进行。视图控制器用于控制直播客户端UI的显示,直播客户端UI由多个视图界面单元组成,每个视图界面单元所显示内容类别不同,每个视图界面单元均对应一子界面,子界面即view,由视图控制器控制,视图控制器控制即为iOS系统中的ViewController。本发明实施例中子界面为直播客户端UI中显示在线人数的视图界面单元。
执行代码具体为:
Figure PCTCN2018081278-appb-000001
更新直播客户端UI的通知为一声明函数,执行代码位于所述声明函数中,且执行代码的执行在直播客户端的主线程中进行。申明函数为executeInMainQueue,该函数中有一参数block,block即为执行代码。为保证直播间当前在线人数更新的正常进行,当更新直播客户端UI的通知抛出后:
S301:判断更新直播客户端UI的通知中是否含有执行代码,若有,转到S402,若没有,则结束,即申明函数的执行终止。通过判断执行代码是否存在,是为了避免传入一执行代码为空的情况,从而导致直播客户端程序崩溃。
S302:判断执行代码的执行是否在主线程中进行,若是,转到S4,若不是,则将执行代码的执行操作调回主线程中,然后转到S4。执行代码的执行是否在主线程中通过函数[NSThreadisMainThread]进行判断,若不在主线程,则使用函数dispatch_async(dispatch_get_main_queue(),block)将执行代码的执行操作调回主线程中。
当完成S401和S402的判断确认后,即可进行更新直播客户端UI的通知的抛出过程操作:在执行代码中,使用函数respondsToSelector判断setPersonNum:number:这个函数的实现是否存在,若存在,则使用函数[self.danmuDelegatenumber:count];将更新直播客户端UI以代理方式向子界面抛出。
S4:子界面获取更新直播客户端UI的通知,进行子界面中在线人数显示的更新。
直播客户端与弹幕服务器间基于socket(编程接口)进行通讯,socket是一个通信链的句柄,用来实现不同虚拟机、不同计算机或不同设备之间的通信,使用socket将房间人数变化类消息从弹幕服务器传输到直播客户端,socket通信的数据量大且迅速,且占用的服务器资源小,能够有效保证房间人数变化类消息传输的时效性。同时,弹幕服务器按预设时间间隔向直播客户端发送房间人数变化类消息,从而在线人数的更新频率可以控制,使用灵活。
本发明实施例中用于直播中更新在线人数的方法,通过弹幕服务器将房间人数变化类消息发送给直播客户端,便于直播客户端进行直播间当前在线人数的更新,弹幕服务器进行消息推送主动控制的方式,便于后台人员对消息推送的频率进行灵活控制;同时,使用两级代理,从接收的房间人数变化类消息中获取直播间当前在线人数以代 理的方式抛给视图控制器,视图控制器以代理方式向子界面抛出更新直播客户端UI的通知,有效的对事件的分发做了处理,各自完成各自消息的抛出发送,事件逻辑处理清晰;子界面接收到更新直播客户端UI的通知后,即可完成直播间的在线人数的更新,有效反应直播间的当前人气。
本发明实施例还公开了一种基于上述用于直播中更新在线人数的方法的用于直播中更新在线人数的系统,包括:数据接收模块、数据传输模块和数据更新模块。
数据接收模块用于接收弹幕服务器向直播客户端发送的直播间当前在线人数;数据传输模块用于将数据接收模块接收的直播间当前在线人数发送至iOS系统的视图控制器中,以及控制视图控制器根据获得的直播间当前在线人数向子界面抛出更新直播客户端UI的通知,且通知的抛出操作在直播客户端的主线程中进行,子界面为直播客户端UI中显示在线人数的视图界面单元;数据更新模块用于根据更新直播客户端UI的通知,进行子界面中在线人数显示的更新。
更新直播客户端UI的通知中含有一执行代码,执行代码用于根据获取的直播间当前在线人数更新子界面中的在线人数显示。弹幕服务器按预设时间间隔向直播客户端发送房间人数变化类消息。
本发明实施例中用于直播中更新在线人数的系统:数据接收模块接收到弹幕服务器发送的直播间当前在线人数,同时接收的直播间当前在线人数被抛送给视图控制器,视图控制器向子界面抛出更新直播客户端UI的通知,子界面即可进行在线人数显示的更新,便于主播或观众掌握直播间的当前人气,整个直播间当前在线人数更新过程逻辑分明,且实施方便。
本发明不局限于上述实施方式,对于本技术领域的普通技术人员 来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围之内。本说明书中未作详细描述的内容属于本领域专业技术人员公知的现有技术。

Claims (10)

  1. 一种用于直播中更新在线人数的方法,用于对iOS系统中直播客户端内直播间在线人数的更新,其特征在于,包括:
    S1:直播客户端接收弹幕服务器发送的直播间当前在线人数;
    S2:直播客户端以代理方式将直播间当前在线人数发送至iOS系统的视图控制器;
    S3:根据获得的直播间当前在线人数,视图控制器以代理方式向子界面抛出更新直播客户端UI的通知,所述子界面为直播客户端UI中显示在线人数的视图界面单元,所述通知的抛出操作在直播客户端的主线程中进行;
    S4:子界面获取更新直播客户端UI的通知,进行子界面中在线人数显示的更新。
  2. 如权利要求1所述的一种用于直播中更新在线人数的方法,其特征在于:所述更新直播客户端UI的通知中含有执行代码,所述执行代码用于根据获取的直播间当前在线人数更新子界面中的在线人数显示。
  3. 如权利要求2所述的一种用于直播中更新在线人数的方法,其特征在于:所述更新直播客户端UI的通知为声明函数,所述执行代码位于所述声明函数中,且所述执行代码的执行在直播客户端的主线程中进行。
  4. 如权利要求3所述的一种用于直播中更新在线人数的方法,其特征在于,当更新直播客户端UI的通知抛出后:
    S301:判断更新直播客户端UI的通知中是否含有执行代码,若有,转到S402,若没有,则结束;
    S302:判断执行代码的执行是否在主线程中进行,若是,转到 S4,若不是,则将执行代码的执行操作调回主线程中,然后转到S4。
  5. 如权利要求1所述的一种用于直播中更新在线人数的方法,其特征在于:所述直播客户端与弹幕服务器间基于socket进行通讯。
  6. 如权利要求1所述的一种用于直播中更新在线人数的方法,其特征在于:抛至iOS系统的视图控制器中的直播间当前在线人数,被转化为long long型的数据类型。
  7. 如权利要求1所述的一种用于直播中更新在线人数的方法,其特征在于:所述弹幕服务器按预设时间间隔向直播客户端发送房间人数变化类消息。
  8. 一种用于直播中更新在线人数的系统,其特征在于,包括:
    数据接收模块,其用于接收弹幕服务器向直播客户端发送的直播间当前在线人数;
    数据传输模块,其用于将数据接收模块接收的直播间当前在线人数发送至iOS系统的视图控制器中,以及控制视图控制器根据获得的直播间当前在线人数向子界面抛出更新直播客户端UI的通知,且所述通知的抛出操作在直播客户端的主线程中进行,所述子界面为直播客户端UI中显示在线人数的视图界面单元;
    数据更新模块,其用于根据更新直播客户端UI的通知,进行子界面中在线人数显示的更新。
  9. 如权利要求8所述的一种用于直播中更新在线人数的系统,其特征在于:所述更新直播客户端UI的通知中含有一执行代码,所述执行代码用于根据获取的直播间当前在线人数更新子界面中的在线人数显示。
  10. 如权利要求8所述的一种用于直播中更新在线人数的系统,其特征在于:所述弹幕服务器按预设时间间隔向直播客户端发送房间 人数变化类消息。
PCT/CN2018/081278 2017-03-31 2018-03-30 一种用于直播中更新在线人数的方法及系统 Ceased WO2018177404A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710207894.5 2017-03-31
CN201710207894.5A CN107094136B (zh) 2017-03-31 2017-03-31 一种用于直播中更新在线人数的方法及系统

Publications (1)

Publication Number Publication Date
WO2018177404A1 true WO2018177404A1 (zh) 2018-10-04

Family

ID=59649185

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/081278 Ceased WO2018177404A1 (zh) 2017-03-31 2018-03-30 一种用于直播中更新在线人数的方法及系统

Country Status (2)

Country Link
CN (1) CN107094136B (zh)
WO (1) WO2018177404A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113747207A (zh) * 2021-08-11 2021-12-03 北京达佳互联信息技术有限公司 数据的传输方法、装置、电子设备及存储介质
CN114007088A (zh) * 2021-09-16 2022-02-01 阿里巴巴(中国)有限公司 直播信息处理方法、装置及电子设备
CN114222153A (zh) * 2021-12-08 2022-03-22 北京百度网讯科技有限公司 在线用户数量统计方法、装置、电子设备和存储介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107094136B (zh) * 2017-03-31 2018-10-19 武汉斗鱼网络科技有限公司 一种用于直播中更新在线人数的方法及系统
CN108551585B (zh) * 2018-03-28 2021-01-01 武汉斗鱼网络科技有限公司 一种弹幕校验方法、装置、服务器及介质
CN109309859A (zh) * 2018-09-30 2019-02-05 广州虎牙信息科技有限公司 直播间界面展示方法、架构及相关方法、装置及设备
CN111339495B (zh) * 2020-02-18 2021-03-19 北京字节跳动网络技术有限公司 直播间在线人数的统计方法、装置、电子设备及存储介质
CN114449330B (zh) * 2022-01-28 2023-09-01 北京百度网讯科技有限公司 基于直播的信息显示的方法、装置、设备以及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015128758A1 (en) * 2014-02-26 2015-09-03 Yogesh Chunilal Rathod Request based real-time or near real-time broadcasting & sharing of captured & selected media
US20150281756A1 (en) * 2014-03-26 2015-10-01 Nantx Technologies Ltd Data session management method and system including content recognition of broadcast data and remote device feedback
WO2016073258A1 (en) * 2014-11-03 2016-05-12 Microsoft Technology Licensing, Llc Annotating and indexing broadcast video for improving search
CN105824910A (zh) * 2016-03-15 2016-08-03 深圳市游科互动科技有限公司 基于html5的数据可视化系统及方法
CN107094136A (zh) * 2017-03-31 2017-08-25 武汉斗鱼网络科技有限公司 一种用于直播中更新在线人数的方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015128758A1 (en) * 2014-02-26 2015-09-03 Yogesh Chunilal Rathod Request based real-time or near real-time broadcasting & sharing of captured & selected media
US20150281756A1 (en) * 2014-03-26 2015-10-01 Nantx Technologies Ltd Data session management method and system including content recognition of broadcast data and remote device feedback
WO2016073258A1 (en) * 2014-11-03 2016-05-12 Microsoft Technology Licensing, Llc Annotating and indexing broadcast video for improving search
CN105824910A (zh) * 2016-03-15 2016-08-03 深圳市游科互动科技有限公司 基于html5的数据可视化系统及方法
CN107094136A (zh) * 2017-03-31 2017-08-25 武汉斗鱼网络科技有限公司 一种用于直播中更新在线人数的方法及系统

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113747207A (zh) * 2021-08-11 2021-12-03 北京达佳互联信息技术有限公司 数据的传输方法、装置、电子设备及存储介质
CN114007088A (zh) * 2021-09-16 2022-02-01 阿里巴巴(中国)有限公司 直播信息处理方法、装置及电子设备
CN114007088B (zh) * 2021-09-16 2024-03-19 阿里巴巴(中国)有限公司 直播信息处理方法、装置及电子设备
CN114222153A (zh) * 2021-12-08 2022-03-22 北京百度网讯科技有限公司 在线用户数量统计方法、装置、电子设备和存储介质
CN114222153B (zh) * 2021-12-08 2024-03-12 北京百度网讯科技有限公司 在线用户数量统计方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN107094136A (zh) 2017-08-25
CN107094136B (zh) 2018-10-19

Similar Documents

Publication Publication Date Title
CN112153140B (zh) 远程控制方法、装置、设备、存储介质及系统
CN107094136B (zh) 一种用于直播中更新在线人数的方法及系统
WO2021237433A1 (zh) 消息推送方法、装置、电子设备及计算机可读介质
US10165391B2 (en) Companion application for activity cooperation
CN107995247B (zh) 一种文件传输方法、服务器及系统
CN106657370A (zh) 数据传输方法及装置
CN103716901B (zh) 设备之间连接的方法、系统及相关设备
CN104038560A (zh) 移动终端间的远程协助方法、客户端、电子设备及系统
CN107911437A (zh) 屏幕共享的方法、装置、电子设备及存储介质
KR102121358B1 (ko) 데이터 전송 방법 및 디바이스
CN112346751B (zh) 应用程序的安装方法、装置、电子设备和存储介质
CN113407134A (zh) 基于分屏显示实现多客户端之间文件共享的方法和装置
TW202147834A (zh) 同步本地房間和遠端共享
CN104751325B (zh) 一种数据处理方法、装置和系统
WO2021244519A1 (zh) Wi-Fi控制方法、装置及电子设备
CN103401936B (zh) 一种界面共享的处理方法及装置
CN106707978A (zh) 通过通讯录转移智能家居控制权的方法及通讯录
WO2022042592A1 (zh) 投屏方法、装置、电子设备及计算机可读介质
CN104506622B (zh) 多屏同步控制方法及系统
CN111142823A (zh) 业务内容显示方法和装置、计算设备、存储介质
CN202473244U (zh) 多媒体视听娱乐控制系统
JP7153474B2 (ja) メッセンジャーでのファイル送信時に機器間の通信技術を活用する方法及びシステム
CN105991736A (zh) 一种远程控制方法及设备
CN106161152B (zh) 一种智能家居的控制方法和设备
CN110740150B (zh) 消息交互方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18778265

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18778265

Country of ref document: EP

Kind code of ref document: A1