[go: up one dir, main page]

CN116456123B - A method, device and equipment for switching live broadcast on multiple devices - Google Patents

A method, device and equipment for switching live broadcast on multiple devices Download PDF

Info

Publication number
CN116456123B
CN116456123B CN202310717012.5A CN202310717012A CN116456123B CN 116456123 B CN116456123 B CN 116456123B CN 202310717012 A CN202310717012 A CN 202310717012A CN 116456123 B CN116456123 B CN 116456123B
Authority
CN
China
Prior art keywords
server
equipment
live broadcast
switching
main
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.)
Active
Application number
CN202310717012.5A
Other languages
Chinese (zh)
Other versions
CN116456123A (en
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.)
Beijing Sohu New Media Information Technology Co Ltd
Original Assignee
Beijing Jiaodian Xinganxian Information 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 Beijing Jiaodian Xinganxian Information Technology Co ltd filed Critical Beijing Jiaodian Xinganxian Information Technology Co ltd
Priority to CN202310717012.5A priority Critical patent/CN116456123B/en
Publication of CN116456123A publication Critical patent/CN116456123A/en
Application granted granted Critical
Publication of CN116456123B publication Critical patent/CN116456123B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • H04L51/046Interoperability with other network applications or services
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The application discloses a method, a device and equipment for realizing live broadcast switching of multiple devices, which can be applied to the technical field of computer application. The method comprises the following steps: receiving a live broadcast equipment switching request initiated by any one of a plurality of equipment; the plurality of devices includes a primary device and a secondary device; determining a connection state between another device of the plurality of devices and the IM server; the connection state includes: a connected state and an unconnected state; selecting a corresponding switching mode according to the connection state by utilizing the IM server to realize multi-equipment live broadcast switching; the main device and the auxiliary device use the same login system, and the main device and the auxiliary device respectively realize two-way communication through the IM server. Therefore, the multiple devices use the same login system and realize information communication through the instant messaging technology, so that the efficiency and reliability of switching live streams among the multiple devices are improved.

Description

一种实现多设备切换直播的方法、装置及设备A method, device and equipment for switching live broadcast on multiple devices

技术领域Technical field

本申请涉及计算机应用技术领域,特别是涉及一种实现多设备切换直播的方法、装置及设备。The present application relates to the field of computer application technology, and in particular to a method, device and equipment for switching live broadcasts on multiple devices.

背景技术Background technique

房屋可以为用户遮风挡雨,对于有购房需求的人来说,看房是个相对重要的流程。Houses can protect users from wind and rain. For people who want to buy a house, viewing a house is a relatively important process.

传统的模式下,客户需要由销售专员带到线下实地查看房源,这种方式相对而言浪费的时间比较多,因此成交效率不高。而随着互联网的发展,当前购房场景逐渐由线下看房转换为直播看房的场景中。但现有技术中单纯使用手机摄像头采集直播流的方案显得十分局限且不可靠,切换设备的效率又很低,因此不能给客户带来很好的直播看房效果。Under the traditional model, customers need to be taken offline by a sales specialist to view the property. This method wastes relatively much time, so the transaction efficiency is not high. With the development of the Internet, the current home buying scene has gradually transformed from offline home viewing to live streaming home viewing. However, in the existing technology, the solution of simply using mobile phone cameras to capture live streams is very limited and unreliable, and the efficiency of switching devices is very low, so it cannot bring good live viewing effects to customers.

因此,如何提高多设备之间切换直播流的效率以及可靠性,是本领域技术人员急需解决的问题。Therefore, how to improve the efficiency and reliability of switching live streams between multiple devices is an urgent problem that those skilled in the art need to solve.

发明内容Contents of the invention

基于上述问题,本申请提供了一种实现多设备切换直播的方法、装置及设备,通过多设备使用同一套登录系统并通过即时通讯技术实现信息交流,从而解决了多设备之间切换直播流的效率低以及可靠性差的问题。Based on the above problems, this application provides a method, device and equipment for switching live broadcasts between multiple devices. Multiple devices use the same login system and realize information exchange through instant messaging technology, thereby solving the problem of switching live broadcasts between multiple devices. Problems of low efficiency and poor reliability.

第一方面,本申请实施例提供了一种实现多设备切换直播的方法,包括:In the first aspect, embodiments of the present application provide a method for switching live broadcasts on multiple devices, including:

接收多个设备中任一设备发起的直播设备切换请求;所述多个设备包括主设备和副设备;Receive a live broadcast device switching request initiated by any device among multiple devices; the multiple devices include a primary device and a secondary device;

确定多个设备中的另一设备与IM服务器之间的连接状态;所述连接状态包括:已连接状态和未连接状态;Determine the connection status between another device among the plurality of devices and the IM server; the connection status includes: connected status and unconnected status;

利用所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播;Utilize the IM server to select the corresponding switching method according to the connection status to implement multi-device switching live broadcast;

所述主设备和所述副设备使用同一套登录系统且所述主设备和所述副设备分别通过所述IM服务器实现双向通信。The primary device and the secondary device use the same login system, and the primary device and the secondary device implement two-way communication through the IM server respectively.

可选的,所述确定多个设备中的另一设备与IM服务器之间的连接状态,包括:Optionally, determining the connection status between another device among the multiple devices and the IM server includes:

当接收到的是多个设备中主设备发起的直播设备切换请求时,利用IM服务器检测副设备是否与所述IM服务器保持连接;所述IM服务器根据检测结果回复对应的消息;When receiving a live broadcast device switching request initiated by the primary device among multiple devices, use the IM server to detect whether the secondary device maintains a connection with the IM server; the IM server replies with a corresponding message based on the detection result;

根据所述IM服务器回复的消息确定所述副设备与所述IM服务器之间的连接状态。The connection status between the secondary device and the IM server is determined according to the message returned by the IM server.

可选的,所述确定多个设备中的另一设备与IM服务器之间的连接状态,包括:Optionally, determining the connection status between another device among the multiple devices and the IM server includes:

当接收到的是多个设备中副设备发起的直播设备切换请求时,利用IM服务器检测主设备是否与所述IM服务器保持连接;所述IM服务器根据检测结果回复对应的消息;When receiving a live broadcast device switching request initiated by a secondary device among multiple devices, use the IM server to detect whether the primary device maintains a connection with the IM server; the IM server replies with a corresponding message based on the detection result;

根据所述IM服务器回复的消息确定所述主设备与所述IM服务器之间的连接状态。The connection status between the main device and the IM server is determined according to the message returned by the IM server.

可选的,所述利用所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播,包括:Optionally, using the IM server to select a corresponding switching method according to the connection status to implement multi-device switching live broadcast includes:

当确定所述副设备与所述IM服务器之间的连接状态为未连接状态时,利用所述IM服务器控制所述主设备展示所述副设备无法录屏直播的提示;When it is determined that the connection status between the secondary device and the IM server is not connected, use the IM server to control the primary device to display a prompt that the secondary device cannot record live broadcast;

当确定所述副设备与所述IM服务器之间的连接状态为已连接状态时,控制所述主设备停止采集直播流,并利用所述IM服务器向所述副设备发送开始录屏的消息,使所述副设备开始录屏并推流,实现多设备切换直播。When it is determined that the connection status between the secondary device and the IM server is a connected state, control the primary device to stop collecting the live stream, and use the IM server to send a message to start screen recording to the secondary device, Let the secondary device start recording the screen and push the stream to realize switching live broadcast on multiple devices.

可选的,所述利用所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播,包括:Optionally, using the IM server to select a corresponding switching method according to the connection status to implement multi-device switching live broadcast includes:

当确定所述主设备与所述IM服务器之间的连接状态为未连接状态时,利用所述IM服务器控制所述副设备展示所述主设备无法摄像直播的提示;When it is determined that the connection status between the main device and the IM server is not connected, use the IM server to control the secondary device to display a prompt that the main device cannot capture live broadcasts;

当确定所述主设备与所述IM服务器之间的连接状态为已连接状态时,利用所述IM服务器确定所述主设备是否正在直播中;When it is determined that the connection state between the main device and the IM server is a connected state, use the IM server to determine whether the main device is in live broadcast;

若所述主设备不在直播中,则直接利用所述IM服务器控制所述副设备开始录屏并推流,实现多设备切换直播;If the main device is not in the live broadcast, the IM server is directly used to control the secondary device to start recording the screen and pushing the stream, so as to realize switching live broadcast on multiple devices;

若所述主设备正在直播中,则控制所述主设备停止直播推流,并利用所述IM服务器向所述副设备发送开始录屏的消息,使所述副设备开始录屏并推流,实现多设备切换直播。If the main device is in the live broadcast, control the main device to stop the live broadcast and push the stream, and use the IM server to send a message to start screen recording to the secondary device, so that the secondary device starts recording the screen and pushing the stream, Achieve live broadcast switching between multiple devices.

可选的,所述接收多个设备中任一设备发起的直播设备切换请求之前,还包括:Optionally, before receiving a live broadcast device switching request initiated by any one of the multiple devices, the method further includes:

以第一账号将主设备登入用户服务中心并获取所述用户服务中心生成的第一IM账号;Log in the main device to the user service center with the first account and obtain the first IM account generated by the user service center;

利用所述第一IM账号将所述主设备和IM服务器建立连接;Use the first IM account to establish a connection between the main device and the IM server;

以第一账号将副设备登入所述用户服务中心,使所述用户服务中心通过哈希算法生成与所述第一IM账号相关联的第二IM账号;Log in the secondary device to the user service center with the first account, so that the user service center generates a second IM account associated with the first IM account through a hash algorithm;

获取所述用户服务中心生成的第二IM账号;Obtain the second IM account generated by the user service center;

根据所述第二IM账号将所述副设备与所述IM服务器建立连接。Establish a connection between the secondary device and the IM server according to the second IM account.

可选的,所述实现多设备切换直播的方法还包括:Optionally, the method for implementing multi-device switching live broadcast also includes:

获取主设备和副设备的实时状态;Get the real-time status of the primary device and secondary device;

根据所述实时状态对所述主设备和所述副设备的状态记录表进行更新;Update the status record table of the main device and the secondary device according to the real-time status;

所述主设备和所述副设备的实时状态包括:用户中心服务器的登录状态、IM服务器的连接状态以及当前直播状态。The real-time status of the main device and the secondary device includes: the login status of the user center server, the connection status of the IM server, and the current live broadcast status.

可选的,所述实现多设备切换直播的方法还包括:Optionally, the method for implementing multi-device switching live broadcast also includes:

当主设备和/或副设备因为异常情况终止时,控制所述主设备和/或所述副设备重启用户系统以及IM服务器,并根据所述主设备和所述副设备的状态记录表进行现场恢复。When the primary device and/or the secondary device terminates due to abnormal conditions, control the primary device and/or the secondary device to restart the user system and IM server, and perform on-site recovery according to the status record table of the primary device and the secondary device. .

第二方面,本申请提供了一种实现多设备切换直播的装置,包括:In the second aspect, this application provides a device for switching live broadcasts on multiple devices, including:

接收模块,用于接收多个设备中任一设备发起的直播设备切换请求;所述多个设备包括主设备和副设备;A receiving module, configured to receive a live broadcast device switching request initiated by any device among multiple devices; the multiple devices include a primary device and a secondary device;

确定模块,用于确定多个设备中的另一设备与IM服务器之间的连接状态;所述连接状态包括:已连接状态和未连接状态;Determining module, used to determine the connection status between another device among the plurality of devices and the IM server; the connection status includes: connected status and unconnected status;

切换模块,用于利用所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播;所述主设备和所述副设备使用同一套登录系统且所述主设备和所述副设备分别通过所述IM服务器实现双向通信。A switching module, configured to use the IM server to select a corresponding switching method according to the connection status to realize multi-device switching live broadcast; the main device and the secondary device use the same login system, and the main device and the secondary device The devices implement two-way communication through the IM server respectively.

第三方面,本申请提供了一种实现多设备切换直播的设备,包括:In the third aspect, this application provides a device for switching live broadcast on multiple devices, including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现如上述任一项所述实现多设备切换直播的方法的步骤。A processor, configured to implement the steps of the method for implementing multi-device switching live broadcast as described in any one of the above when executing the computer program.

从以上技术方案可以看出,相较于现有技术,本申请具有以下优点:It can be seen from the above technical solutions that compared with the existing technology, this application has the following advantages:

本申请首先接收多个设备中任一设备发起的直播设备切换请求,其中多个设备包括主设备和副设备。然后确定多个设备中的另一设备与IM服务器之间的连接状态,具体的,连接状态包括:已连接状态和未连接状态。最后利用IM服务器,根据连接状态选择对应的切换方式实现多设备切换直播,其中主设备和副设备使用同一套登录系统且主设备和副设备分别通过IM服务器实现双向通信。由此,多设备使用同一套登录系统并通过即时通讯技术实现信息交流,从而提高了多设备之间切换直播流的效率以及可靠性。This application first receives a live broadcast device switching request initiated by any one of multiple devices, including a primary device and a secondary device. Then the connection status between another device among the multiple devices and the IM server is determined. Specifically, the connection status includes: connected status and unconnected status. Finally, the IM server is used to select the corresponding switching method according to the connection status to realize multi-device switching live broadcast. The main device and the secondary device use the same login system, and the main device and the secondary device realize two-way communication through the IM server respectively. As a result, multiple devices use the same login system and exchange information through instant messaging technology, thereby improving the efficiency and reliability of switching live streams between multiple devices.

附图说明Description of drawings

图1为本申请实施例提供的一种实现多设备切换直播的方法的流程图;Figure 1 is a flow chart of a method for switching live broadcasts on multiple devices provided by an embodiment of the present application;

图2为本申请实施例提供的一种实现多设备切换直播的装置的结构示意图。Figure 2 is a schematic structural diagram of a device for implementing live broadcast switching between multiple devices provided by an embodiment of the present application.

具体实施方式Detailed ways

正如前文所述,现有技术中单纯使用手机摄像头采集直播流的方案显得十分局限且不可靠,切换设备的效率又很低,因此不能给客户带来很好的直播看房效果。具体的,现有技术中的副设备一般是主设备的附属设备,不具有独立连接服务器的能力。主设备和副设备之间通过收发心跳数据包来维持协议通信,即端对端通信,这种通信方式需要互相寻址和连接,因此需要知道对方的IP(网络协议)地址和端口号,并且需要穿越防火墙等网络障碍,非常不安全,且一旦断开无法直接建立重连。另外现有技术中用到的直播协议和编码也无法实现对主设备和副设备的快速切换,从而产生了多设备之间切换直播流的效率低以及可靠性差的问题。As mentioned above, the existing technology solution of simply using mobile phone cameras to capture live streams is very limited and unreliable, and the efficiency of switching devices is very low, so it cannot bring good live viewing effects to customers. Specifically, the secondary device in the prior art is generally an accessory device of the main device and does not have the ability to independently connect to the server. The primary device and the secondary device maintain protocol communication by sending and receiving heartbeat packets, that is, end-to-end communication. This communication method requires mutual addressing and connection, so it is necessary to know the other party's IP (network protocol) address and port number, and It needs to go through network obstacles such as firewalls, which is very unsafe, and once disconnected, it cannot be directly reconnected. In addition, the live broadcast protocols and coding used in the existing technology cannot realize rapid switching between the main device and the secondary device, thus causing problems of low efficiency and poor reliability in switching live streams between multiple devices.

为解决上述问题,本申请提供了一种实现多设备切换直播的方法,该方法包括:首先接收多个设备中任一设备发起的直播设备切换请求,其中多个设备包括主设备和副设备。然后确定多个设备中的另一设备与IM服务器之间的连接状态,具体的,连接状态包括:已连接状态和未连接状态。最后利用IM服务器,根据连接状态选择对应的切换方式实现多设备切换直播,其中主设备和副设备使用同一套登录系统且主设备和副设备分别通过IM服务器实现双向通信。In order to solve the above problems, this application provides a method for implementing live broadcast switching between multiple devices. The method includes: first receiving a live broadcast device switching request initiated by any one of multiple devices, where the multiple devices include a primary device and a secondary device. Then the connection status between another device among the multiple devices and the IM server is determined. Specifically, the connection status includes: connected status and unconnected status. Finally, the IM server is used to select the corresponding switching method according to the connection status to realize multi-device switching live broadcast. The main device and the secondary device use the same login system, and the main device and the secondary device realize two-way communication through the IM server respectively.

如此,多设备使用同一套登录系统并通过即时通讯技术以及相关的直播协议和编码实现信息交流,从而提高了多设备之间切换直播流的效率以及可靠性。In this way, multiple devices use the same login system and realize information exchange through instant messaging technology and related live broadcast protocols and coding, thus improving the efficiency and reliability of switching live streams between multiple devices.

需要说明的是,本申请提供的一种实现多设备切换直播的方法、装置及设备可应用于计算机应用技术领域。上述仅为示例,并不对本发明提供的一种实现多设备切换直播的方法、装置及设备的应用领域进行限定。It should be noted that the method, device and equipment for implementing live broadcast switching between multiple devices provided by this application can be applied to the field of computer application technology. The above are only examples and do not limit the application fields of the method, device and equipment for switching live broadcasts between multiple devices provided by the present invention.

为了使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments These are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.

图1为本申请实施例提供的一种实现多设备切换直播的方法的流程图。结合图1所示,本申请实施例提供的一种实现多设备切换直播的方法,可以包括:Figure 1 is a flow chart of a method for switching live broadcasts on multiple devices provided by an embodiment of the present application. As shown in Figure 1, an embodiment of the present application provides a method for switching live broadcasts on multiple devices, which may include:

S101:接收多个设备中任一设备发起的直播设备切换请求;所述多个设备包括主设备和副设备。S101: Receive a live broadcast device switching request initiated by any one of multiple devices; the multiple devices include a primary device and a secondary device.

在实际应用中,单纯使用手机摄像头采集直播流的方案显得十分局限,无法为客户提供更好的看房体验。总结而言,利用手机终端摄像头采集直播流和平板终端录制屏幕的直播流相互切换向客户展示的方案更有利于为客户提供良好的看房体验。为此本申请提供了一种切换方案,其中实现多设备切换直播的装置时刻等待多个设备发送的请求。在切换流程中,首先需要接收到主设备或者副设备中任一设备发起的直播设备切换请求。这里的主设备和副设备都具备独立连接服务器的能力。In practical applications, the solution of simply using mobile phone cameras to capture live streams is very limited and cannot provide customers with a better viewing experience. In summary, the solution of using the mobile terminal camera to capture the live stream and the tablet terminal to record the screen live stream and switching between each other to display to customers is more conducive to providing customers with a good viewing experience. To this end, this application provides a switching solution, in which a device that implements live broadcast switching between multiple devices always waits for requests sent by multiple devices. In the switching process, you first need to receive a live broadcast device switching request initiated by either the primary device or the secondary device. Both the main device and the secondary device here have the ability to independently connect to the server.

另外,由于主设备和副设备的设置方法需要具体说明,因此本申请可以就设备可能的连接方法进行说明。In addition, since the setting method of the primary device and the secondary device requires specific instructions, this application can describe the possible connection methods of the devices.

在一种情况下,针对如何连接。相应的,所述接收多个设备中任一设备发起的直播设备切换请求之前,还包括:In one case, for how to connect. Correspondingly, before receiving a live broadcast device switching request initiated by any one of the multiple devices, the method further includes:

以第一账号将主设备登入用户服务中心并获取所述用户服务中心生成的第一IM账号;Log in the main device to the user service center with the first account and obtain the first IM account generated by the user service center;

利用所述第一IM账号将所述主设备和IM服务器建立连接;Use the first IM account to establish a connection between the main device and the IM server;

以第一账号将副设备登入所述用户服务中心,使所述用户服务中心通过哈希算法生成与所述第一IM账号相关联的第二IM账号;Log in the secondary device to the user service center with the first account, so that the user service center generates a second IM account associated with the first IM account through a hash algorithm;

获取所述用户服务中心生成的第二IM账号;Obtain the second IM account generated by the user service center;

根据所述第二IM账号将所述副设备与所述IM服务器建立连接。Establish a connection between the secondary device and the IM server according to the second IM account.

在实际应用中,主设备和副设备属于客户端,IM服务器和用户中心服务器属于服务端。其中IM(即时通讯)是一种实时交流的通讯方式,允许用户通过计算机、手机等设备在短时间内发送和接收文本、图片、音频、视频等信息。IM服务器是一种特殊的服务器软件,它提供了即时通讯系统的核心功能,用于处理用户之间的消息传递和通信。首先通过手机号验证的方式将主设备通过登入至用户中心服务器,即通过第一账号登录。然后用户中心服务器会返回一个登录信息和对应的IM账号,即第一IM账号,当返回的是登陆成功的信息后,主设备会自动同步登录信息然后通过第一IM账号登入IM服务器并同步连接状态。此时主设备连接完毕开始副设备与服务器之间的连接。相应的,将副设备同样以第一账号登录用户中心服务器,用户中心服务器收到登陆请求之后,会先利用哈希算法生成主设备的第一IM账号关联的副设备IM账号,即第二IM账号,然后返回给副设备用户信息,以及对应的副设备的第二IM账号。副设备自动同步登录信息然后通过第二IM账号登入IM服务器并同步连接状态。设备与IM服务器连接后便可实现双向通信。In actual applications, the main device and secondary device belong to the client, and the IM server and user center server belong to the server. Among them, IM (Instant Messaging) is a real-time communication method that allows users to send and receive text, pictures, audio, video and other information in a short time through computers, mobile phones and other devices. IM server is a special server software that provides the core functions of an instant messaging system and is used to handle messaging and communication between users. First, log in to the user center server from the main device through mobile phone number verification, that is, log in through the first account. Then the user center server will return a login information and the corresponding IM account, that is, the first IM account. When the information about successful login is returned, the main device will automatically synchronize the login information and then log in to the IM server through the first IM account and synchronize the connection. state. At this time, the connection between the primary device and the server is completed and the connection between the secondary device and the server begins. Correspondingly, the secondary device also logs in to the user center server with the first account. After receiving the login request, the user center server will first use the hash algorithm to generate the IM account of the secondary device associated with the first IM account of the primary device, that is, the second IM. account, and then returns the user information of the secondary device and the corresponding second IM account of the secondary device. The secondary device automatically synchronizes the login information and then logs in to the IM server through the second IM account and synchronizes the connection status. After the device is connected to the IM server, two-way communication can be achieved.

S102:确定多个设备中的另一设备与IM服务器之间的连接状态;所述连接状态包括:已连接状态和未连接状态。S102: Determine the connection status between another device among the multiple devices and the IM server; the connection status includes: connected status and unconnected status.

在实际应用中,主设备和副设备被要求并被设置为通过IM服务器进行通信,但由于多种因素存在,主设备和副设备不一定时刻与IM服务器连接,例如主设备故障无法与IM服务器连接等。不同的连接状态需对应不同的处理方式,因此本申请需要确定主设备和副设备与IM服务器之间的连接状态。具体的,若接收的是主设备发起的直播设备切换请求则需要确定副设备与IM服务器之间的连接状态,若接收的是副设备发起的直播设备切换请求则需要确定主设备与IM服务器之间的连接状态,需要注意的是,连接状态包括已连接状态和未连接状态。In actual applications, the primary device and the secondary device are required and set to communicate through the IM server. However, due to various factors, the primary device and the secondary device may not always be connected to the IM server. For example, the primary device fails and cannot communicate with the IM server. Connection etc. Different connection statuses require different processing methods, so this application needs to determine the connection status between the main device, the secondary device and the IM server. Specifically, if a live broadcast device switching request initiated by the primary device is received, the connection status between the secondary device and the IM server needs to be determined. If a live broadcast device switching request initiated by the secondary device is received, the connection status between the primary device and the IM server needs to be determined. It should be noted that the connection status includes connected status and unconnected status.

另外,由于确定另一设备连接状态的方法不尽相同,因此本申请可以就可能的确定方法进行说明。In addition, since the methods for determining the connection status of another device are different, this application can describe possible determination methods.

在一种情况下,针对如何确定另一设备的连接状态。相应的,所述确定多个设备中的另一设备与IM服务器之间的连接状态,具体包括:In one case, how to determine the connection status of another device. Correspondingly, determining the connection status between another device among the multiple devices and the IM server specifically includes:

当接收到的是多个设备中主设备发起的直播设备切换请求时,利用IM服务器检测副设备是否与所述IM服务器保持连接;所述IM服务器根据检测结果回复对应的消息;When receiving a live broadcast device switching request initiated by the primary device among multiple devices, use the IM server to detect whether the secondary device maintains a connection with the IM server; the IM server replies with a corresponding message based on the detection result;

根据所述IM服务器回复的消息确定所述副设备与所述IM服务器之间的连接状态。The connection status between the secondary device and the IM server is determined according to the message returned by the IM server.

在实际应用中,主设备使用摄像头采集直播流数据,经过数据压缩和格式转换为H.264格式,然后将直播流数据传给直播服务器,并缓存主设备的直播状态为主设备直播中。观众此时可以通过观看设备实时观看直播,此时的直播流为主设备摄像头采集的数据。IM服务器可以检测当前与自身连接的设备。当主设备发起直播设备切换请求时,主设备向IM服务器发送一条消息,即询问副设备IM是否在线。IM服务器可以检测与自身连接的设备并发送消息。实现多设备切换直播的装置可以通过IM服务器回复的消息确定副设备与IM服务器之间的连接状态。一般IM服务器会回复在线或不在线的消息,分别对应副设备的已连接状态和未连接状态。In practical applications, the main device uses a camera to collect live stream data, compresses and converts the data into H.264 format, then transmits the live stream data to the live broadcast server, and caches the live broadcast status of the main device while the main device is live broadcasting. At this time, the audience can watch the live broadcast in real time through the viewing device. The live stream at this time is the data collected by the camera of the main device. The IM server can detect the device currently connected to itself. When the main device initiates a live broadcast device switching request, the main device sends a message to the IM server, that is, asking the secondary device whether the IM is online. The IM server can detect devices connected to itself and send messages. The device that implements multi-device switching live broadcast can determine the connection status between the secondary device and the IM server through the message replied by the IM server. Generally, the IM server will reply with online or offline messages, corresponding to the connected status and unconnected status of the secondary device respectively.

另外,由于确定另一设备连接状态的方法不尽相同,因此本申请可以就可能的确定方法进行说明。In addition, since the methods for determining the connection status of another device are different, this application can describe possible determination methods.

在另一种情况下,针对如何确定另一设备的连接状态。相应的,所述确定多个设备中的另一设备与IM服务器之间的连接状态,具体包括:In another case, how to determine the connection status of another device. Correspondingly, determining the connection status between another device among the multiple devices and the IM server specifically includes:

当接收到的是多个设备中副设备发起的直播设备切换请求时,利用IM服务器检测主设备是否与所述IM服务器保持连接;所述IM服务器根据检测结果回复对应的消息;When receiving a live broadcast device switching request initiated by a secondary device among multiple devices, use the IM server to detect whether the primary device maintains a connection with the IM server; the IM server replies with a corresponding message based on the detection result;

根据所述IM服务器回复的消息确定所述主设备与所述IM服务器之间的连接状态。The connection status between the main device and the IM server is determined according to the message returned by the IM server.

在实际应用中,可以从副设备发起切换直播设备的流程。具体的,当副设备发起直播设备切换请求时,副设备向IM服务器发送一条消息,即询问主设备IM是否在线。实现多设备切换直播的装置可以通过IM服务器回复的消息确定主设备与IM服务器之间的连接状态。一般IM服务器会回复在线或不在线的消息,分别对应主设备的已连接状态和未连接状态。In practical applications, the process of switching live broadcast devices can be initiated from the secondary device. Specifically, when the secondary device initiates a live broadcast device switching request, the secondary device sends a message to the IM server, that is, asking the primary device whether the IM is online. The device that implements live broadcast switching between multiple devices can determine the connection status between the main device and the IM server through the message replied by the IM server. Generally, the IM server will reply with online or offline messages, corresponding to the connected status and unconnected status of the main device respectively.

S103:利用所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播;主设备和副设备使用同一套登录系统且主设备和副设备分别通过IM服务器实现双向通信。S103: Use the IM server to select the corresponding switching method according to the connection status to realize multi-device switching live broadcast; the main device and the secondary device use the same login system, and the main device and the secondary device implement two-way communication through the IM server respectively.

在实际应用中,IM服务器用于传递实时消息,利用IM服务器双向通信的功能分别向主设备和副设备发送执行信息,从而控制主设备和副设备配合实现多设备切换直播的动作。需要注意的是,主设备和副设备使用同一套登录系统。In practical applications, the IM server is used to transmit real-time messages, and uses the two-way communication function of the IM server to send execution information to the main device and the secondary device respectively, thereby controlling the main device and the secondary device to cooperate to realize the action of switching live broadcasts on multiple devices. It should be noted that the primary device and secondary device use the same login system.

另外,由于不同设备发起请求时具体的切换方式不尽相同,因此本申请可以就可能的切换方式进行说明。In addition, since different devices have different specific switching methods when initiating requests, this application can describe possible switching methods.

在一种情况下,针对主设备发起请求时。相应的,所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播,具体包括:In one case, when a request is made against the master device. Correspondingly, the IM server selects the corresponding switching method according to the connection status to implement multi-device switching live broadcast, specifically including:

当确定所述副设备与所述IM服务器之间的连接状态为未连接状态时,利用所述IM服务器控制所述主设备展示所述副设备无法录屏直播的提示;When it is determined that the connection status between the secondary device and the IM server is not connected, use the IM server to control the primary device to display a prompt that the secondary device cannot record live broadcast;

当确定所述副设备与所述IM服务器之间的连接状态为已连接状态时,控制所述主设备停止采集直播流,并利用所述IM服务器向所述副设备发送开始录屏的消息,使所述副设备开始录屏并推流,实现多设备切换直播。When it is determined that the connection status between the secondary device and the IM server is a connected state, control the primary device to stop collecting the live stream, and use the IM server to send a message to start screen recording to the secondary device, Let the secondary device start recording the screen and push the stream to realize switching live broadcast on multiple devices.

在实际应用中,当主设备发起切换请求时,需要确定副设备是否与IM服务器建立连接。若确定副设备此时未与IM服务器建立连接时,即确定副设备为未连接状态时,则结束切换流程,然后利用IM服务器向主设备发送消息控制主设备展示副设备无法录屏直播的提示。若确定副设备此时与IM服务器建立连接时,即确定副设备为已连接状态时,则继续下一步流程。具体的,控制主设备停止摄像头采集直播流,并向IM服务器发送开始录屏直播的消息。IM服务器接收到消息后,会直接向副设备发送开始录屏的消息,此时缓存主设备的直播状态:主设备停止流采集。副设备接收到开始录屏的消息后会启动屏幕录制功能,并将屏幕录制的直播流经过数据压缩和格式转换为H.264格式,然后将直播流数据传给直播服务器进行录屏推流,实现多设备切换直播。此时副设备缓存直播状态:副设备开始录屏。然后副设备会向IM服务器发送开始录屏回执消息,IM服务器接到后在将消息传递给主设备,主设备收到后会改变用户界面的视图结构,以通知主播用户此时直播看房场景的变更,并缓存当前直播状态为:主设备已知副设备录屏。In practical applications, when the primary device initiates a handover request, it needs to determine whether the secondary device has established a connection with the IM server. If it is determined that the secondary device has not established a connection with the IM server at this time, that is, when it is determined that the secondary device is not connected, the switching process ends, and then the IM server is used to send a message to the primary device to control the primary device to display a prompt that the secondary device cannot record live broadcast. . If it is determined that the secondary device has established a connection with the IM server at this time, that is, when it is determined that the secondary device is in a connected state, the process continues to the next step. Specifically, the main device is controlled to stop the camera from collecting the live stream, and sends a message to the IM server to start recording the live broadcast. After receiving the message, the IM server will directly send a message to start screen recording to the secondary device. At this time, the live broadcast status of the primary device is cached: the primary device stops stream collection. After receiving the message to start screen recording, the secondary device will start the screen recording function, compress and convert the screen recorded live stream into H.264 format, and then transmit the live stream data to the live broadcast server for screen recording and push streaming. Achieve live broadcast switching between multiple devices. At this time, the secondary device caches the live broadcast status: the secondary device starts recording the screen. Then the secondary device will send a screen recording start receipt message to the IM server. After receiving it, the IM server will pass the message to the main device. After receiving it, the main device will change the view structure of the user interface to notify the anchor user of the live viewing scene at this time. changes, and caches the current live broadcast status as: the main device knows that the secondary device is recording screen.

另外,由于不同设备发起请求时具体的切换方式不尽相同,因此本申请可以就可能的切换方式进行说明。In addition, since different devices have different specific switching methods when initiating requests, this application can describe possible switching methods.

在一种情况下,针对副设备发起请求时。相应的,所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播,具体包括:In one case, when a request is made for the secondary device. Correspondingly, the IM server selects the corresponding switching method according to the connection status to implement multi-device switching live broadcast, specifically including:

当确定所述主设备与所述IM服务器之间的连接状态为未连接状态时,利用所述IM服务器控制所述副设备展示所述主设备无法摄像直播的提示;When it is determined that the connection status between the main device and the IM server is not connected, use the IM server to control the secondary device to display a prompt that the main device cannot capture live broadcasts;

当确定所述主设备与所述IM服务器之间的连接状态为已连接状态时,利用所述IM服务器确定所述主设备是否正在直播中;When it is determined that the connection state between the main device and the IM server is a connected state, use the IM server to determine whether the main device is in live broadcast;

若所述主设备不在直播中,则直接利用所述IM服务器控制所述副设备开始录屏并推流,实现多设备切换直播;If the main device is not in the live broadcast, the IM server is directly used to control the secondary device to start recording the screen and pushing the stream, so as to realize switching live broadcast on multiple devices;

若所述主设备正在直播中,则控制所述主设备停止直播推流,并利用所述IM服务器向所述副设备发送开始录屏的消息,使所述副设备开始录屏并推流,实现多设备切换直播。If the main device is in the live broadcast, control the main device to stop the live broadcast and push the stream, and use the IM server to send a message to start screen recording to the secondary device, so that the secondary device starts recording the screen and pushing the stream, Achieve live broadcast switching between multiple devices.

在实际应用中,当副设备发起切换请求时,需要确定主设备是否与IM服务器建立连接。若确定主设备与IM服务器未建立连接,即连接状态为未连接状态时,结束设备切换流程,利用IM服务器控制副设备展示主设备无法摄像直播的提示。若确定主设备与IM服务器建立连接,即连接状态为已连接状态时,需要利用IM服务器发送消息询问主设备是否正在直播中。此时若主设备正在直播,则会在接到询问消息后停止直播推流并向IM服务器发送可以开始录屏推流的消息并推送给副设备,此时主设备缓存当前状态为:主设备停止推流。副设备接收到消息后直接开始屏幕录制,将屏幕录制的直播流传给直播服务器并向IM服务器发送开始录屏回执消息,此时副设备缓存当前状态为:副设备开始录屏。IM服务器接收到副设备的回执消息后转发给主设备,主设备接收到消息后改变用户界面的视图结构,以通知主播用户此时直播看房场景的变更,并缓存当前直播状态为:主设备已知副设备录屏。In practical applications, when the secondary device initiates a handover request, it needs to determine whether the primary device has established a connection with the IM server. If it is determined that the main device has not established a connection with the IM server, that is, when the connection status is not connected, the device switching process ends, and the IM server is used to control the secondary device to display a prompt that the main device cannot record live broadcasts. If it is determined that the main device has established a connection with the IM server, that is, when the connection status is connected, the IM server needs to be used to send a message to ask whether the main device is live broadcasting. If the main device is live broadcasting at this time, it will stop the live streaming after receiving the inquiry message and send a message to the IM server to start recording and streaming and push it to the secondary device. At this time, the current cache status of the main device is: Primary device Stop streaming. After receiving the message, the secondary device directly starts screen recording, streams the screen recorded live broadcast to the live broadcast server and sends a start screen recording receipt message to the IM server. At this time, the current status of the secondary device cache is: the secondary device starts screen recording. The IM server receives the receipt message from the secondary device and forwards it to the main device. After receiving the message, the main device changes the view structure of the user interface to notify the host user of the change in the live viewing scene at this time, and caches the current live broadcast status as: main device The secondary device is known to record the screen.

另外,由于应付突发情况的方法不尽相同,因此本申请可以就可能的应对方式进行说明。In addition, since there are different ways to deal with emergencies, this application can describe possible ways to deal with them.

在一种情况下,针对如何应对突发情况,相应的,所述方法还包括:In one case, regarding how to deal with emergencies, the method also includes:

获取主设备和副设备的实时状态;Get the real-time status of the primary device and secondary device;

根据所述实时状态对所述主设备和所述副设备的状态记录表进行更新;Update the status record table of the main device and the secondary device according to the real-time status;

所述主设备和所述副设备的实时状态包括:用户中心服务器的登录状态、IM服务器的连接状态以及当前直播状态。The real-time status of the main device and the secondary device includes: the login status of the user center server, the connection status of the IM server, and the current live broadcast status.

在实际应用中,主设备和副设备都有可能因为异常情况而终止,在这种异常情况下,为了更为高效的修复,实现多设备切换直播的装置提供了一个状态记录表,用来记录主设备和副设备的实时状态。具体的,该装置实时获取主设备和副设备的实时状态。主设备和副设备的实时状态包括:用户中心服务器的登录状态、IM服务器的连接状态以及当前直播状态。例如,记录主设备成功登录用户中心服务器后实时获取的用户中心服务器的登录状态应为主设备登录成功,登录失败则获取的应为主设备登录失败,副设备同理。另外,利用第一IM账号成功登录IM服务器后实时获取的IM服务器的连接状态应为已连接状态,若登录失败则实时获取的连接状态应为未连接状态。另外,结合上述实施例所述,主设备停止推流后,主设备的当前直播状态为主设备停止流采集;副设备开始推流后,副设备的当前直播状态为副设备开始录屏;主设备接收到IM服务器发送的开始录屏直播的消息后,主设备的当前直播状态为主设备已知副设备录屏。In practical applications, both the main device and the auxiliary device may terminate due to abnormal conditions. In this abnormal situation, in order to repair it more efficiently, the device that realizes multi-device switching live broadcast provides a status record table to record Real-time status of primary and secondary devices. Specifically, the device obtains the real-time status of the main device and the auxiliary device in real time. The real-time status of the main device and the secondary device includes: the login status of the user center server, the connection status of the IM server, and the current live broadcast status. For example, the login status of the user center server obtained in real time after the master device successfully logs into the user center server is recorded as the master device's login success, and if the login fails, the master device's login status is obtained as the master device's login failure. The same applies to the slave device. In addition, after successfully logging into the IM server using the first IM account, the connection status of the IM server obtained in real time should be the connected state. If the login fails, the connection status obtained in real time should be the unconnected state. In addition, combined with the above embodiments, after the main device stops pushing streams, the current live broadcast status of the main device is that the main device stops streaming collection; after the secondary device starts pushing streams, the current live broadcast status of the secondary device is that the secondary device starts recording screen; After the device receives the message sent by the IM server to start screen recording and live broadcast, the current live broadcast status of the main device will be known to the main device and the secondary device will record the screen.

另外,由于应付突发情况的方法不尽相同,因此本申请可以就可能的应对方式进行说明。In addition, since there are different ways to deal with emergencies, this application can describe possible ways to deal with them.

在一种情况下,针对如何应对突发情况,相应的,所述方法还包括:In one case, regarding how to deal with emergencies, the method also includes:

当主设备和/或副设备因为异常情况终止时,控制所述主设备和/或所述副设备重启用户系统以及IM服务器,并根据所述主设备和所述副设备的状态记录表进行现场恢复。When the primary device and/or the secondary device terminates due to abnormal conditions, control the primary device and/or the secondary device to restart the user system and IM server, and perform on-site recovery according to the status record table of the primary device and the secondary device. .

在实际应用中,结合上述状态记录表,当主设备和/或副设备因为异常情况终止时,控制主设备和副设备再次重启用户系统以及IM服务器,并查询状态记录表中缓存的设备状态,然后根据不同的状态进行现场恢复。In practical applications, combined with the above status record table, when the main device and/or the secondary device terminate due to abnormal conditions, control the main device and the secondary device to restart the user system and IM server again, and query the cached device status in the status record table, and then On-site recovery is performed according to different conditions.

另外,实现多设备切换直播的装置还可以实现从副设备录屏直播到主设备摄像直播的切换。具体的,以主设备为例,实现多设备切换直播的装置首先接收主设备发起的切换为主设备摄像直播的切换请求,然后利用IM服务器检测副设备是否与所述IM服务器保持连接,当确定副设备与IM服务器之间的连接状态为未连接状态时,利用IM服务器控制主设备展示副设备无法录屏直播的提示;当确定副设备与IM服务器之间的连接状态为已连接状态时,控制副设备停止录屏直播,并利用IM服务器向主设备发送开始摄像直播的消息,使主设备开始摄像并推流,实现多设备切换直播。副设备同理,实现多设备切换直播的装置首先接收副设备发起的切换为主设备摄像直播的切换请求,然后利用IM服务器检测主设备是否与所述IM服务器保持连接,当确定主设备与IM服务器之间的连接状态为未连接状态时,利用IM服务器控制副设备展示主设备无法摄像直播的提示;当确定主设备与IM服务器之间的连接状态为已连接状态时,控制副设备停止录屏直播,并利用IM服务器向主设备发送开始摄像直播的消息,使主设备开始摄像并推流,实现多设备切换直播。In addition, the device that implements multi-device live broadcast switching can also switch from the secondary device's screen recording live broadcast to the main device's camera live broadcast. Specifically, taking the main device as an example, the device that implements multi-device switching live broadcast first receives a switching request initiated by the main device to switch to the main device to record live broadcast, and then uses the IM server to detect whether the secondary device maintains a connection with the IM server. When it is determined When the connection status between the secondary device and the IM server is not connected, use the IM server to control the main device to display a prompt that the secondary device cannot record live broadcast; when it is determined that the connection status between the secondary device and the IM server is connected, Control the secondary device to stop recording and live broadcasting, and use the IM server to send a message to start recording and live broadcasting to the main device, so that the main device starts recording and pushing streams, enabling multi-device switching of live broadcasts. In the same way as the secondary device, the device that implements multi-device switching live broadcast first receives the switching request initiated by the secondary device to switch to the main device to record live broadcast, and then uses the IM server to detect whether the main device maintains a connection with the IM server. When it is determined that the main device is connected to the IM When the connection status between the servers is not connected, use the IM server to control the secondary device to display a prompt that the main device cannot record live broadcast; when it is determined that the connection status between the main device and the IM server is connected, control the secondary device to stop recording. Live broadcast on the screen, and use the IM server to send a message to start camera live broadcast to the main device, so that the main device starts camera and pushes the stream, realizing switching live broadcast on multiple devices.

综上所述,本申请首先接收多个设备中任一设备发起的直播设备切换请求,其中多个设备包括主设备和副设备。然后确定多个设备中的另一设备与IM服务器之间的连接状态,具体的,连接状态包括:已连接状态和未连接状态。最后利用IM服务器,根据连接状态选择对应的切换方式实现多设备切换直播,其中主设备和副设备使用同一套登录系统且主设备和副设备分别通过IM服务器实现双向通信。由此,多设备使用同一套登录系统,通过一个推流地址推流,保证观众端画面不会有很大波动。通过IM服务器来进行双向的通信,确保信息传输的延时性、安全性和稳定性,从而提高了多设备之间切换直播流的效率以及可靠性。另外本申请提供了一套用于记录主设备和副设备实时状态的状态记录表,方便异常情况下查询并对现场进行恢复。To sum up, this application first receives a live broadcast device switching request initiated by any one of multiple devices, including a primary device and a secondary device. Then the connection status between another device among the multiple devices and the IM server is determined. Specifically, the connection status includes: connected status and unconnected status. Finally, the IM server is used to select the corresponding switching method according to the connection status to realize multi-device switching live broadcast. The main device and the secondary device use the same login system, and the main device and the secondary device realize two-way communication through the IM server respectively. As a result, multiple devices use the same login system and push streams through one push address, ensuring that the viewer's picture will not fluctuate greatly. Two-way communication is carried out through the IM server to ensure the delay, security and stability of information transmission, thereby improving the efficiency and reliability of switching live streams between multiple devices. In addition, this application provides a set of status record tables for recording the real-time status of the main equipment and auxiliary equipment to facilitate query and on-site recovery under abnormal circumstances.

图2为本申请实施例提供的一种实现多设备切换直播的装置的结构示意图。结合图2所示,本申请实施例提供的实现多设备切换直播的装置200,包括:Figure 2 is a schematic structural diagram of a device for implementing live broadcast switching between multiple devices provided by an embodiment of the present application. As shown in FIG. 2 , the device 200 for implementing live broadcast switching between multiple devices provided by the embodiment of the present application includes:

接收模块201,用于接收多个设备中任一设备发起的直播设备切换请求;所述多个设备包括主设备和副设备;The receiving module 201 is used to receive a live broadcast device switching request initiated by any device among multiple devices; the multiple devices include a primary device and a secondary device;

确定模块202,用于确定多个设备中的另一设备与IM服务器之间的连接状态;所述连接状态包括:已连接状态和未连接状态;Determining module 202, used to determine the connection status between another device among the plurality of devices and the IM server; the connection status includes: connected status and unconnected status;

切换模块203,用于利用所述IM服务器,根据所述连接状态选择对应的切换方式实现多设备切换直播;所述主设备和所述副设备使用同一套登录系统且所述主设备和所述副设备分别通过所述IM服务器实现双向通信。The switching module 203 is used to use the IM server to select the corresponding switching method according to the connection status to realize multi-device switching live broadcast; the main device and the secondary device use the same login system, and the main device and the The secondary devices respectively implement two-way communication through the IM server.

作为一种实施方式,针对如何确定另一设备的连接状态,上述确定模块202包括第一子确定模块;As an implementation manner, regarding how to determine the connection status of another device, the above-mentioned determination module 202 includes a first sub-determination module;

第一子确定模块,用于当接收到的是多个设备中主设备发起的直播设备切换请求时,利用IM服务器检测副设备是否与所述IM服务器保持连接;所述IM服务器根据检测结果回复对应的消息;The first sub-determination module is used to use the IM server to detect whether the secondary device maintains a connection with the IM server when receiving a live broadcast device switching request initiated by the primary device among multiple devices; the IM server replies according to the detection result corresponding message;

根据所述IM服务器回复的消息确定所述副设备与所述IM服务器之间的连接状态。The connection status between the secondary device and the IM server is determined according to the message returned by the IM server.

作为一种实施方式,针对如何确定另一设备的连接状态,上述确定模块202还包括第二子确定模块;As an implementation manner, regarding how to determine the connection status of another device, the above-mentioned determination module 202 also includes a second sub-determination module;

第二子确定模块,用于当接收到的是多个设备中副设备发起的直播设备切换请求时,利用IM服务器检测主设备是否与所述IM服务器保持连接;所述IM服务器根据检测结果回复对应的消息;The second sub-determination module is used to use the IM server to detect whether the main device maintains a connection with the IM server when receiving a live broadcast device switching request initiated by a secondary device among multiple devices; the IM server replies according to the detection result corresponding message;

根据所述IM服务器回复的消息确定所述主设备与所述IM服务器之间的连接状态。The connection status between the main device and the IM server is determined according to the message returned by the IM server.

作为一种实施方式,针对如何实现多设备切换直播,上述切换模块203包括:第一切换子模块;As an implementation manner, regarding how to implement multi-device live broadcast switching, the above-mentioned switching module 203 includes: a first switching sub-module;

第一切换子模块,用于当确定所述副设备与所述IM服务器之间的连接状态为未连接状态时,利用所述IM服务器控制所述主设备展示所述副设备无法录屏直播的提示;The first switching submodule is used to use the IM server to control the main device to display a message indicating that the secondary device cannot record live broadcast when it is determined that the connection state between the secondary device and the IM server is not connected. hint;

当确定所述副设备与所述IM服务器之间的连接状态为已连接状态时,控制所述主设备停止采集直播流,并利用所述IM服务器向所述副设备发送开始录屏的消息,使所述副设备开始录屏并推流,实现多设备切换直播。When it is determined that the connection status between the secondary device and the IM server is a connected state, control the primary device to stop collecting the live stream, and use the IM server to send a message to start screen recording to the secondary device, Let the secondary device start recording the screen and push the stream to realize switching live broadcast on multiple devices.

作为一种实施方式,针对如何实现多设备切换直播,上述切换模块203还包括:第二切换子模块;As an implementation manner, regarding how to implement multi-device switching of live broadcast, the above-mentioned switching module 203 also includes: a second switching sub-module;

第二切换子模块,用于当确定所述主设备与所述IM服务器之间的连接状态为未连接状态时,利用所述IM服务器控制所述副设备展示所述主设备无法摄像直播的提示;The second switching submodule is used to use the IM server to control the secondary device to display a prompt that the primary device cannot capture live broadcasts when it is determined that the connection status between the primary device and the IM server is not connected. ;

当确定所述主设备与所述IM服务器之间的连接状态为已连接状态时,利用所述IM服务器确定所述主设备是否正在直播中;When it is determined that the connection state between the main device and the IM server is a connected state, use the IM server to determine whether the main device is in live broadcast;

若所述主设备不在直播中,则直接利用所述IM服务器控制所述副设备开始录屏并推流,实现多设备切换直播;If the main device is not in the live broadcast, the IM server is directly used to control the secondary device to start recording the screen and pushing the stream, so as to realize switching live broadcast on multiple devices;

若所述主设备正在直播中,则控制所述主设备停止直播推流,并利用所述IM服务器向所述副设备发送开始录屏的消息,使所述副设备开始录屏并推流,实现多设备切换直播。If the main device is in the live broadcast, control the main device to stop the live broadcast and push the stream, and use the IM server to send a message to start screen recording to the secondary device, so that the secondary device starts recording the screen and pushing the stream, Achieve live broadcast switching between multiple devices.

作为一种实施方式,针对如何设置多个设备,上述实现多设备切换直播的装置200还包括:设置模块;As an implementation manner, regarding how to set up multiple devices, the above-mentioned device 200 for implementing multi-device switching live broadcast also includes: a setting module;

设置模块,用于以第一账号将主设备登入用户服务中心并获取所述用户服务中心生成的第一IM账号;A setting module for logging the main device into the user service center with the first account and obtaining the first IM account generated by the user service center;

利用所述第一IM账号将所述主设备和IM服务器建立连接;Use the first IM account to establish a connection between the main device and the IM server;

以第一账号将副设备登入所述用户服务中心,使所述用户服务中心通过哈希算法生成与所述第一IM账号相关联的第二IM账号;Log in the secondary device to the user service center with the first account, so that the user service center generates a second IM account associated with the first IM account through a hash algorithm;

获取所述用户服务中心生成的第二IM账号;Obtain the second IM account generated by the user service center;

根据所述第二IM账号将所述副设备与所述IM服务器建立连接。Establish a connection between the secondary device and the IM server according to the second IM account.

作为一种实施方式,针对如何应对突发情况,上述实现多设备切换直播的装置200还包括:记录模块;As an implementation manner, in terms of how to deal with emergencies, the above-mentioned device 200 for implementing multi-device switching live broadcast also includes: a recording module;

记录模块,用于获取主设备和副设备的实时状态;Recording module, used to obtain the real-time status of the main device and secondary device;

根据所述实时状态对所述主设备和所述副设备的状态记录表进行更新;Update the status record table of the main device and the secondary device according to the real-time status;

所述主设备和所述副设备的实时状态包括:用户中心服务器的登录状态、IM服务器的连接状态以及当前直播状态。The real-time status of the main device and the secondary device includes: the login status of the user center server, the connection status of the IM server, and the current live broadcast status.

作为一种实施方式,针对如何应对突发情况,上述实现多设备切换直播的装置200还包括:处理模块;As an implementation manner, in terms of how to deal with emergencies, the above-mentioned device 200 for implementing multi-device switching live broadcast also includes: a processing module;

处理模块,用于当主设备和/或副设备因为异常情况终止时,控制所述主设备和/或所述副设备重启用户系统以及IM服务器,并根据所述主设备和所述副设备的状态记录表进行现场恢复。A processing module configured to control the primary device and/or the secondary device to restart the user system and the IM server when the primary device and/or the secondary device terminate due to abnormal conditions, and to restart the user system and the IM server according to the status of the primary device and the secondary device. Record sheet for on-site recovery.

综上所述,本申请首先接收多个设备中任一设备发起的直播设备切换请求,其中多个设备包括主设备和副设备。然后确定多个设备中的另一设备与IM服务器之间的连接状态,具体的,连接状态包括:已连接状态和未连接状态。最后利用IM服务器,根据连接状态选择对应的切换方式实现多设备切换直播,其中主设备和副设备使用同一套登录系统且主设备和副设备分别通过IM服务器实现双向通信。由此,多设备使用同一套登录系统,通过一个推流地址推流,保证观众端画面不会有很大波动。通过IM服务器来进行双向的通信,确保信息传输的延时性、安全性和稳定性,从而提高了多设备之间切换直播流的效率以及可靠性。另外本申请提供了一套用于记录主设备和副设备实时状态的状态记录表,方便异常情况下查询并对现场进行恢复。To sum up, this application first receives a live broadcast device switching request initiated by any one of multiple devices, including a primary device and a secondary device. Then the connection status between another device among the multiple devices and the IM server is determined. Specifically, the connection status includes: connected status and unconnected status. Finally, the IM server is used to select the corresponding switching method according to the connection status to realize multi-device switching live broadcast. The main device and the secondary device use the same login system, and the main device and the secondary device realize two-way communication through the IM server respectively. As a result, multiple devices use the same login system and push streams through one push address, ensuring that the viewer's picture will not fluctuate greatly. Two-way communication is carried out through the IM server to ensure the delay, security and stability of information transmission, thereby improving the efficiency and reliability of switching live streams between multiple devices. In addition, this application provides a set of status record tables for recording the real-time status of the main equipment and auxiliary equipment to facilitate query and on-site recovery under abnormal circumstances.

另外,本申请还提供了一种实现多设备切换直播的设备,其特征在于,包括:In addition, this application also provides a device for switching live broadcast on multiple devices, which is characterized by including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现如上述任一项所述实现多设备切换直播的方法的步骤。A processor, configured to implement the steps of the method for implementing multi-device switching live broadcast as described in any one of the above when executing the computer program.

另外,本申请还提供了一种可读存储介质,所述可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述任一项所述实现多设备切换直播的方法的步骤。In addition, the present application also provides a readable storage medium. A computer program is stored on the readable storage medium. When the computer program is executed by a processor, the method for implementing multi-device switching live broadcast as described in any one of the above is implemented. A step of.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be practiced in other embodiments without departing from the spirit or scope of the application. Therefore, the present application is not to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A method for implementing multi-device switching live broadcast, the method comprising:
receiving a live broadcast equipment switching request initiated by any one of a plurality of equipment; the plurality of devices includes a primary device and a secondary device;
determining a connection state between another device of the plurality of devices and the IM server; the connection state includes: a connected state and an unconnected state;
selecting a corresponding switching mode according to the connection state by utilizing the IM server to realize multi-equipment live broadcast switching;
the main equipment and the auxiliary equipment use the same login system, and the main equipment and the auxiliary equipment respectively realize two-way communication through the IM server;
the determining a connection state between another device of the plurality of devices and the IM server includes:
when a live equipment switching request initiated by a main equipment in a plurality of equipment is received, detecting whether a secondary equipment is kept connected with an IM server by utilizing the IM server; the IM server replies corresponding information according to the detection result;
determining a connection state between the auxiliary equipment and the IM server according to the message replied by the IM server;
the method for realizing multi-device live broadcast switching by using the IM server and selecting a corresponding switching mode according to the connection state comprises the following steps:
when the connection state between the auxiliary equipment and the IM server is determined to be the unconnected state, controlling the main equipment to display a prompt that the auxiliary equipment cannot record and broadcast live broadcast by utilizing the IM server;
when the connection state between the auxiliary equipment and the IM server is determined to be the connected state, controlling the main equipment to stop collecting live broadcast streams, and sending a message for starting screen recording to the auxiliary equipment by utilizing the IM server, so that the auxiliary equipment starts screen recording and pushes streams, and multi-equipment switching live broadcast is realized.
2. The method of claim 1, wherein determining a connection status between another device of the plurality of devices and the IM server comprises:
when a live equipment switching request initiated by a secondary equipment in a plurality of equipment is received, detecting whether the main equipment is kept connected with an IM server or not by utilizing the IM server; the IM server replies corresponding information according to the detection result;
and determining the connection state between the main equipment and the IM server according to the message replied by the IM server.
3. The method according to claim 2, wherein the selecting, by the IM server, a corresponding switching manner according to the connection state to implement multi-device switching live broadcast includes:
when the connection state between the main equipment and the IM server is determined to be the unconnected state, controlling the auxiliary equipment to display a prompt that the main equipment cannot pick up live broadcast by utilizing the IM server;
when the connection state between the main device and the IM server is determined to be the connected state, determining whether the main device is in live broadcast or not by utilizing the IM server;
if the main equipment is not in live broadcast, the IM server is directly utilized to control the auxiliary equipment to start screen recording and stream pushing, so that multi-equipment switching live broadcast is realized;
and if the main equipment is in live broadcast, controlling the main equipment to stop live broadcast and push stream, and sending a message for starting screen recording to the auxiliary equipment by utilizing the IM server, so that the auxiliary equipment starts screen recording and pushes stream, and realizing multi-equipment switching live broadcast.
4. The method of claim 1, wherein prior to receiving the live device switch request initiated by any one of the plurality of devices, further comprising:
logging the main equipment into a user service center by using a first account number and acquiring a first IM account number generated by the user service center;
establishing connection between the main equipment and an IM server by using the first IM account;
logging the auxiliary equipment into the user service center by using a first account, so that the user service center generates a second IM account associated with the first IM account through a hash algorithm;
acquiring a second IM account number generated by the user service center;
and establishing connection between the auxiliary equipment and the IM server according to the second IM account.
5. The method according to claim 1, wherein the method further comprises:
acquiring real-time states of the main equipment and the auxiliary equipment;
updating the state record tables of the main equipment and the auxiliary equipment according to the real-time state;
the real-time status of the primary device and the secondary device includes: the login state of the user center server, the connection state of the IM server and the current live broadcast state.
6. The method of claim 5, wherein the method further comprises:
when the main equipment and/or the auxiliary equipment is terminated due to abnormal conditions, the main equipment and/or the auxiliary equipment is controlled to restart the user system and the IM server, and the on-site recovery is carried out according to the state record tables of the main equipment and the auxiliary equipment.
7. An apparatus for implementing multi-device switching live broadcast, comprising:
the receiving module is used for receiving a live broadcast equipment switching request initiated by any one of a plurality of equipment; the plurality of devices includes a primary device and a secondary device;
a determining module for determining a connection state between another device of the plurality of devices and the IM server; the connection state includes: a connected state and an unconnected state;
the switching module is used for selecting a corresponding switching mode according to the connection state by utilizing the IM server to realize multi-equipment live broadcast switching; the main equipment and the auxiliary equipment use the same login system, and the main equipment and the auxiliary equipment respectively realize two-way communication through the IM server;
the first determining submodule is used for detecting whether the auxiliary equipment is connected with the IM server or not by utilizing the IM server when a live equipment switching request initiated by the main equipment in the plurality of equipment is received; the IM server replies corresponding information according to the detection result;
determining a connection state between the auxiliary equipment and the IM server according to the message replied by the IM server;
the first switching sub-module is used for controlling the main equipment to display a prompt that the auxiliary equipment cannot record and broadcast live broadcast by utilizing the IM server when the connection state between the auxiliary equipment and the IM server is determined to be an unconnected state;
when the connection state between the auxiliary equipment and the IM server is determined to be the connected state, controlling the main equipment to stop collecting live broadcast streams, and sending a message for starting screen recording to the auxiliary equipment by utilizing the IM server, so that the auxiliary equipment starts screen recording and pushes streams, and multi-equipment switching live broadcast is realized.
8. A device for implementing multi-device switching live broadcast, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method of implementing a multi-device switch live as claimed in any one of claims 1 to 6 when executing said computer program.
CN202310717012.5A 2023-06-16 2023-06-16 A method, device and equipment for switching live broadcast on multiple devices Active CN116456123B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310717012.5A CN116456123B (en) 2023-06-16 2023-06-16 A method, device and equipment for switching live broadcast on multiple devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310717012.5A CN116456123B (en) 2023-06-16 2023-06-16 A method, device and equipment for switching live broadcast on multiple devices

Publications (2)

Publication Number Publication Date
CN116456123A CN116456123A (en) 2023-07-18
CN116456123B true CN116456123B (en) 2023-09-12

Family

ID=87134181

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310717012.5A Active CN116456123B (en) 2023-06-16 2023-06-16 A method, device and equipment for switching live broadcast on multiple devices

Country Status (1)

Country Link
CN (1) CN116456123B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105610777A (en) * 2015-09-24 2016-05-25 广州视睿电子科技有限公司 remote live broadcast method and system
CN108668174A (en) * 2017-03-28 2018-10-16 张克 It is a kind of to realize video resource and the social method blended and video social activity emerging system
CN110312140A (en) * 2019-05-30 2019-10-08 北京奇艺世纪科技有限公司 Live data processing method, device, system and computer readable storage medium
CN112738540A (en) * 2020-12-25 2021-04-30 广州虎牙科技有限公司 Multi-device live broadcast switching method, device and system, electronic device and readable storage medium
CN112788358A (en) * 2020-12-31 2021-05-11 腾讯科技(深圳)有限公司 Video live broadcast method, video sending method, device and equipment for game match
WO2021114795A1 (en) * 2019-12-11 2021-06-17 厦门雅基软件有限公司 Cloud game live broadcast method, cloud game anchor end, viewer end and computer-readable storage medium
CN113242441A (en) * 2021-05-08 2021-08-10 北京有竹居网络技术有限公司 Live broadcast method and device, computer equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105610777A (en) * 2015-09-24 2016-05-25 广州视睿电子科技有限公司 remote live broadcast method and system
WO2017050006A1 (en) * 2015-09-24 2017-03-30 广州视睿电子科技有限公司 Remote live broadcast method and system
CN108668174A (en) * 2017-03-28 2018-10-16 张克 It is a kind of to realize video resource and the social method blended and video social activity emerging system
CN110312140A (en) * 2019-05-30 2019-10-08 北京奇艺世纪科技有限公司 Live data processing method, device, system and computer readable storage medium
WO2021114795A1 (en) * 2019-12-11 2021-06-17 厦门雅基软件有限公司 Cloud game live broadcast method, cloud game anchor end, viewer end and computer-readable storage medium
CN112738540A (en) * 2020-12-25 2021-04-30 广州虎牙科技有限公司 Multi-device live broadcast switching method, device and system, electronic device and readable storage medium
CN112788358A (en) * 2020-12-31 2021-05-11 腾讯科技(深圳)有限公司 Video live broadcast method, video sending method, device and equipment for game match
CN113242441A (en) * 2021-05-08 2021-08-10 北京有竹居网络技术有限公司 Live broadcast method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN116456123A (en) 2023-07-18

Similar Documents

Publication Publication Date Title
CN102571726B (en) Method, system and the state judgment server that multi-medium data is shared
US8116235B2 (en) Peer-to-peer aided live video sharing system
WO2019071829A1 (en) Method, storage medium, device and system for implementing microphone connection-based battle between hosts on pc
CN101297312B (en) Voice instant messaging between mobile and computing devices
EP3032838A1 (en) Message processing method, device, gateway, set-top box and internet protocol television system
CN104683434B (en) Network system keeps connection method, communication means, electronic equipment, keeps Connection Service device, application server, program
CN111479121A (en) Live broadcasting method and system based on streaming media server
US20220209878A1 (en) Method, system and device for pushing information, and storage medium thereof
WO2018166415A1 (en) Cloud storage system, media data storage method and system
CN112804213B (en) Communication disconnection reconnection method, device, system, readable medium and electronic equipment
CN101895576A (en) P2P distributed streaming media live broadcast method with small-startup time delay
WO2017219852A1 (en) Data information sharing method and apparatus, and terminal
EP2421226A1 (en) Method of p2p video communication implemented on web page
CN103929623B (en) Video data handling procedure in a kind of video monitoring system
CN103595950A (en) Method for carrying out video communication based on cable digital television set top box
CN101557296A (en) Method of quick recovery after break of multicast service, device and gateway device
CN116456123B (en) A method, device and equipment for switching live broadcast on multiple devices
WO2015089790A1 (en) Service processing method, apparatus, and system
US20050154794A1 (en) Systems and methods for providing a discovery protocol
CN113014961A (en) Video pushing and transmitting method, visual angle synchronizing method and device and storage medium
CN117412167A (en) Video transmission method, video transmission device, electronic equipment and computer storage medium
WO2012051900A1 (en) Method, apparatus and system for multiple cdn sharing videos of same subject matter
WO2023130545A1 (en) Data sharing method and system, and storage medium
CN106850659B (en) A method, device and system for establishing a media channel
US20240414239A1 (en) Interaction method, system and apparatus, and non-volatile computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231113

Address after: 100190 901-1, Floor 9, Building 3, No. 2 Academy South Road, Haidian District, Beijing

Patentee after: Beijing Bodian Zhihe Technology Co.,Ltd.

Address before: 100190 1001-3, 10th floor, building 3, No.2 Academy of Sciences South Road, Haidian District, Beijing

Patentee before: BEIJING JIAODIAN XINGANXIAN INFORMATION TECHNOLOGY CO.,LTD.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240812

Address after: Room 1201, 12th Floor, Building 3, No. 2 Science Academy South Road, Haidian District, Beijing, 100084

Patentee after: BEIJING SOHU NEW MEDIA INFORMATION TECHNOLOGY Co.,Ltd.

Country or region after: China

Address before: 100190 901-1, Floor 9, Building 3, No. 2 Academy South Road, Haidian District, Beijing

Patentee before: Beijing Bodian Zhihe Technology Co.,Ltd.

Country or region before: China