Direct broadcasting room switching method and device
By multiplexing the player container during the live broadcast room switching, and only changing the stream address is used to realize the live broadcast room switching, the problem of long waiting time for live broadcast room switching in the prior art is solved and the user experience is improved.
Patent Information
- Application Number
- CN202411465740.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-01-10
AI Technical Summary
When switching live broadcast rooms, the existing technology needs to destroy the current live broadcast room player and create a new player, resulting in long wait times for users and affecting the user experience.
By responding to the sliding operation command, the target container is driven to slide, and the target live broadcast room and stream address are determined at the end of the sliding. Only changing the stream address can realize the live broadcast room switching, multiplexing the player container, and reducing waiting time.
It improves the user experience of switching live broadcast rooms, reduces the waiting time for watching the next live broadcast room, and realizes the switching effect through streaming address replacement, avoiding the destruction and re-creation process of the player.
Smart Images

Figure CN119299735A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Internet technology, and in particular, to a live broadcast room switching method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] When a user is watching a live broadcast, if the user wants to watch other live broadcast rooms, the current live broadcast room will be switched, for example, by sliding up and down to switch to other live broadcast rooms.
[0003] However, since the player of the current live broadcast room is located in the container of the current live broadcast room, when switching between live broadcast rooms, the current live broadcast room player needs to be destroyed and the new live broadcast room player needs to be recreated. This will cause the user to wait for a while before watching the next live broadcast room, which is a poor user experience.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0005] The embodiments of the present application provide a live broadcast room switching method, apparatus, computer equipment, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.
[0006] One aspect of an embodiment of the present application provides a method for switching between live broadcast rooms, the method comprising: In response to a sliding operation instruction for the current live broadcast room, driving the target container to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room; When the sliding operation is finished, determining the target live broadcast room currently switched to and the target stream address of the target live broadcast room; The stream address of the player container is switched to the target stream address for playback.
[0007] Optionally, driving the target container to slide according to the sliding operation instruction includes: monitoring a sliding distance of the sliding operation instruction; The target container is driven to follow the live broadcast room list container to slide a distance that is the same as the sliding distance.
[0008] Optionally, the method further comprises: When the target container is driven to slide to the next live broadcast room, an asynchronous stream pulling task is created for the next live broadcast room; The asynchronous stream pulling task is put into an asynchronous task management queue. The asynchronous task management queue is used to replace the old asynchronous stream pulling task in the asynchronous task management queue with the new asynchronous stream pulling task when a new asynchronous stream pulling task is added.
[0009] Optionally, the asynchronous stream pulling task is created through JavaScript promise.
[0010] Optionally, the asynchronous task management queue is a queue managed by RxJS.
[0011] Optionally, the method further comprises: When a previous sliding operation instruction is completed and a next sliding operation instruction is not received within a preset time, determining that the sliding operation is finished; When a previous sliding operation instruction is completed and a next sliding operation instruction is received within the preset time, it is determined that the sliding operation is not completed and the next sliding operation instruction and the previous sliding operation instruction are regarded as one sliding operation instruction.
[0012] Optionally, the method further comprises: If the sliding operation is not completed and the sliding passes through other live broadcast rooms, the streaming task of the other live broadcast rooms will be skipped.
[0013] Another aspect of an embodiment of the present application provides a live broadcast room switching device, the device comprising: A sliding module, configured to respond to a sliding operation instruction for a current live broadcast room and drive a target container to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room; A determination module, used to determine the target live broadcast room currently switched to and the target stream address of the target live broadcast room when the sliding operation ends; The switching module is used to switch the stream address of the player container to the target stream address for playing.
[0014] Another aspect of an embodiment of the present application provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein: the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described above.
[0015] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0016] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned method when executed by a processor.
[0017] The above technical solution adopted in the embodiment of the present application may have the following advantages: In response to a sliding operation instruction for the current live broadcast room, the target container is driven to slide according to the sliding operation instruction. The sliding operation instruction is used to switch the live broadcast room. The target container at least includes the player container of the current live broadcast room. When the sliding operation is completed, the target live broadcast room currently switched to and the target stream address of the target live broadcast room are determined, and the stream address of the player container is switched to the target stream address for playback. When switching between live broadcast rooms, the player container of the live broadcast room can be reused, and the effect of switching between live broadcast rooms can be achieved by only changing the stream address, thereby reducing the waiting time for users to watch the next live broadcast room and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0019] Figure 1 The operating environment diagram of the live broadcast room switching method according to the first embodiment of the present application is schematically shown; Figure 2 The flowchart of the live broadcast room switching method according to the first embodiment of the present application is schematically shown; Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S200; Figure 4 The live broadcast list page is schematically shown; Figure 5 The newly added process of the live broadcast room switching method according to the first embodiment of the present application is schematically shown; Figure 6 Another newly added process of the live broadcast room switching method according to the first embodiment of the present application is schematically shown; Figure 7 A block diagram of a live broadcast room switching device according to Embodiment 2 of the present application is schematically shown; and Figure 8 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0021] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0022] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0023] First, the following terms are explained: ArkUI framework: A development framework for building cross-platform user interfaces (UIs) launched by Huawei as part of its Hongmeng operating system. ArkUI provides a declarative programming model where developers can build interfaces by describing the state and behavior of the UI in a way similar to React. In ArkUI, decorators are mainly used to monitor and automatically update the UI state.
[0024] JavaScript (abbreviation: JS): is a multi-paradigm high-level interpreted programming language based on prototypes and first-class functions. It supports object-oriented programming, imperative programming, and functional programming. It provides methods to manipulate text, arrays, dates, regular expressions, etc.
[0025] Promise: It is a mechanism for handling asynchronous operations in JavaScript. It represents the final completion (or failure) of an asynchronous operation and its returned result.
[0026] RxJS (Reactive Extensions for JavaScript): is an observable data stream-based library for handling asynchronous and event-based programming. It treats asynchronous operations as data streams and provides a rich and flexible set of tools to manage and operate these data streams.
[0027] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below: In the related art, since the player of the current live broadcast room is located in the container of the current live broadcast room, when switching between live broadcast rooms, the current live broadcast room player will be destroyed and the new live broadcast room player will be recreated, causing the user to wait for a while before watching the next live broadcast room, resulting in a poor user experience.
[0028] To this end, the embodiment of the present application provides a technical solution for switching between live broadcast rooms. In this technical solution, when switching between live broadcast rooms, the waiting time for users to watch the next live broadcast room can be reduced, thereby improving the user experience. See below for details.
[0029] Finally, for ease of understanding, an exemplary operating environment is provided below.
[0030] like Figure 1 As shown, the environment diagram includes a service platform 2, a network 4, and a client 6, wherein: The service platform 2 may be composed of a single or multiple computing devices. The multiple computing devices may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing device may load a virtual machine based on a virtual image and / or other data defining specific software (e.g., operating system, dedicated application, server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device.
[0031] The service platform 2 may be configured to communicate with the client 6 or the like via a network 4. The network 4 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network 4 may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.
[0032] The service platform 2 can provide storage, reading, writing, querying, deleting and other services, such as providing live video services to clients.
[0033] The client 6 may be an electronic device running an operating system such as Windows, Android™ or iOS, such as a smart phone, a tablet device, a laptop computer, a virtual reality device, a gaming device, a set-top box, a vehicle terminal, or a smart TV. Based on the above operating system, various applications may be run, such as an application for watching live broadcasts.
[0034] The client 6 may provide / configure a user access page for manipulating the service platform 2 or uploading an object, etc.
[0035] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.
[0036] The following describes the technical solution of the present application through multiple embodiments, taking the client as the execution subject. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.
[0037] Embodiment 1 Figure 2 The flowchart of the live broadcast room switching method according to the first embodiment of the present application is schematically shown.
[0038] like Figure 2 As shown, the live room switching method may include steps S200 to S204, wherein: Step S200, in response to a sliding operation instruction for the current live broadcast room, driving the target container to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room.
[0039] Step S202, when the sliding operation is completed, determine the target live broadcast room currently switched to and the target stream address of the target live broadcast room.
[0040] Step S204: switch the stream address of the player container to the target stream address for playback.
[0041] The live broadcast room switching method provided in this embodiment responds to a sliding operation instruction for the current live broadcast room, drives the target container to slide according to the sliding operation instruction, the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room. When the sliding operation is completed, the target live broadcast room currently switched to and the target stream address of the target live broadcast room are determined, and the stream address of the player container is switched to the target stream address for playback. When switching between live broadcast rooms, the player container of the live broadcast room can be reused, and the effect of switching between live broadcast rooms can be achieved only by changing the stream address, thereby reducing the waiting time for users to watch the next live broadcast room and improving user experience.
[0042] The following combination Figure 2 , each step in steps S200~S204 and other optional steps are described in detail.
[0043] Step S200 In response to a sliding operation instruction for the current live broadcast room, the target container is driven to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room.
[0044] The sliding operation instruction may be sliding up and down or sliding left and right. In addition to the player container of the current live broadcast room, the target container may also include other containers, such as the background container of the live broadcast room.
[0045] Specifically, when the client receives a sliding operation instruction from the user, it drives the target container to slide following the sliding operation instruction to switch to the live broadcast room that the user wants to watch, such as the next live broadcast room or the previous live broadcast room of the current live broadcast room.
[0046] In an optional embodiment, if Figure 3 As shown, in step S200, the target container is driven to slide according to the sliding operation instruction, which may further include steps S300 to S302: Step S300, monitoring the sliding distance of the sliding operation instruction.
[0047] Step S302, driving the target container to follow the live broadcast room list container to slide the same distance as the sliding distance.
[0048] Please refer to Figure 4 , which is a schematic diagram of the live broadcast list page. The main containers of the live broadcast room are as follows: 1. The live broadcast room list container is used to manage the live broadcast room list so that it supports functions such as sliding switching between live broadcast rooms.
[0049] 2. Player container, used to render live video stream user interface interactions.
[0050] 3. The live broadcast room background container is used to display the live broadcast room background image. In order to avoid blocking other content, the background image is placed at the bottom of the live broadcast room.
[0051] 4. Live broadcast room container, used to manage live broadcast room business interactions.
[0052] 5. Business container, used to manage all services that can clear the screen, and to facilitate support for services such as clearing the screen and large refresh.
[0053] In the related art, the player container is placed in the live broadcast room container, so that when the user slides to switch the live broadcast room, the player container will be destroyed. However, the live broadcast room switching method provided in this embodiment, as shown in the figure, separates the player container from the live broadcast room container, so that when the live broadcast room is slid to switch, the player container will not be destroyed, thereby achieving the purpose of reusing the player container.
[0054] Specifically, when the client receives a sliding operation instruction, it can monitor the sliding distance corresponding to the sliding operation instruction, and drive the target container to follow the live broadcast room list container to slide the same distance as the monitored sliding distance according to the monitored sliding distance. For example, if the target container is a player container and a live broadcast room background container, the player container and the live broadcast room background container are driven according to the monitored sliding distance, and follow the live broadcast room list container to slide the same distance as the monitored sliding distance. More specifically, the client can synchronously update the sliding offset distance and background offset distance of the target container by monitoring the sliding distance value of each sliding operation instruction (sliding gesture) in the live broadcast room. In the Hongmeng system, the sliding offset distance and background offset distance of the target container can be synchronously updated in combination with the decorator in the ArkUI framework. In other systems, such as the Android system, a framework with similar functions to the ArkUI framework can be used to implement the same function. Optionally, code can also be written to implement functions similar to the decorators in the ArkUI framework, for example, the observer mode or event-driven callback function can be used to monitor the sliding state and interface updates.
[0055] In this optional embodiment, by monitoring the sliding distance of the sliding operation instruction, the target container is driven to follow the live broadcast room list container to slide with the same sliding distance. When the live broadcast room is switched, the player container of the live broadcast room can follow the live broadcast room list container to slide accordingly, thereby realizing the reuse of the player container of the live broadcast room, reducing the waiting time for users after switching the live broadcast room, and improving the user experience.
[0056] Step S202 , when the sliding operation is completed, determine the target live broadcast room currently switched to and the target stream address of the target live broadcast room.
[0057] Specifically, when the user's finger leaves the screen and the sliding gesture stops, the client can consider that the sliding operation is completed; when the sliding operation is completed, the position of the target container is restored to the normal state, and the relevant user interface elements are displayed to the normal live broadcast room state, and the target container is synchronously adjusted to a state where the bottom is aligned with the bottom of the mobile phone screen and restored to the normal state. At the same time, the client determines the target live broadcast room currently switched to and obtains the target stream address of the target live broadcast room.
[0058] Step S204 , switch the stream address of the player container to the target stream address for playback.
[0059] Specifically, the client changes the stream address of the player container to the target stream address of the target live broadcast room, and pulls the video stream of the target live broadcast room for playback according to the target stream address. For example, if the user of the client switches to the next live broadcast room, the client changes the stream address of the player container to the stream address of the next live broadcast room, and then pulls the live video stream for playback according to the changed stream address.
[0060] In actual applications, users may not want to watch the previous live broadcast room or the next live broadcast room, so they will slide quickly. During the sliding process, they may pass through multiple live broadcast rooms. One implementation method is that when the user slides through a live broadcast room, the stream address of the live broadcast room passed by replaces the current stream address of the player container. When the sliding operation is completed, the stream address of the target live broadcast room finally switched to replaces the stream address of the previous live broadcast room for playback. However, since the user does not need to watch the live broadcast room passed by in the middle, it is not necessary to request the live video stream corresponding to the live broadcast room slid through in the middle, but only request the live video stream corresponding to the last live broadcast room (i.e., the target live broadcast room).
[0061] In an optional embodiment, if Figure 5 As shown, the live room switching method may further include steps S400-S402: Step S400: When the target container is driven to slide to the next live broadcast room, an asynchronous stream pulling task is created for the next live broadcast room.
[0062] Specifically, the client drives the target container to slide according to the sliding operation instruction. During the sliding process, if it slides to the next live broadcast room, an asynchronous streaming task is created for the new live broadcast room. For example, if you slide from live broadcast room A to live broadcast room B during the sliding process, an asynchronous streaming task is created for live broadcast room B; if you slide to live broadcast room C again, an asynchronous streaming task is created for live broadcast room C. When creating an asynchronous streaming task, it can be created through a callback function or the like; preferably, it can be created through JavaScript promise, and an asynchronous streaming task is created for the live broadcast room through promise, which has the advantages of good code readability and convenient processing of multiple asynchronous tasks.
[0063] Step S402: put the asynchronous stream pulling task into an asynchronous task management queue. The asynchronous task management queue is used to replace the old asynchronous stream pulling task in the asynchronous task management queue with the new asynchronous stream pulling task when a new asynchronous stream pulling task is added.
[0064] Specifically, the client can put the created asynchronous stream pulling task into the pre-created asynchronous task management queue. In the asynchronous task management queue, if a new asynchronous stream pulling task is added, the new asynchronous stream pulling task will replace the old asynchronous stream pulling task in the asynchronous task management queue. For example, if a new asynchronous stream pulling task B is added, and there is an old asynchronous stream pulling task A in the asynchronous task management queue, then after the asynchronous stream pulling task B is added, the asynchronous stream pulling task B will replace the old asynchronous stream pulling task A. Among them, the asynchronous task management queue can be created using Async / Await, JavaScript Generator, etc. Preferably, the asynchronous task management queue is a queue managed by RxJS, and the asynchronous task management queue is implemented by RxJS. The observer mode can be used to monitor and manage asynchronous data streams, which facilitates the flexible processing of asynchronous task streams.
[0065] In this optional embodiment, by driving the target container to slide and slide to the next live broadcast room, an asynchronous stream pulling task is created for the next live broadcast room, and the asynchronous stream pulling task is placed in the asynchronous management queue. The asynchronous task management queue is used to replace the old asynchronous stream pulling task in the asynchronous task management queue with the new asynchronous stream pulling task when the new asynchronous stream pulling task is added. Since the asynchronous stream pulling task corresponding to the live broadcast room that slides through in the middle will be replaced by the asynchronous stream pulling task corresponding to the next live broadcast room before it is executed, and the asynchronous stream pulling task corresponding to the live broadcast room that is finally slid to will not be replaced, therefore, by replacing the old asynchronous stream pulling task with the new asynchronous stream pulling task in the asynchronous task management queue, the live broadcast room that slides through in the middle does not request the corresponding live video stream, but only requests the live video stream of the live broadcast room that is finally switched to, thereby reducing the client's network requests and reducing the consumption of server resources.
[0066] In an optional embodiment, if Figure 6 As shown, the live room switching method may further include steps S500 to S502: Step S500, when the previous sliding operation instruction is completed and the next sliding operation instruction is not received within a preset time, it is determined that the sliding operation is completed.
[0067] The preset time may be, for example, a few milliseconds or tens of milliseconds, and may be set according to actual needs. In order to avoid unnecessary delays, the preset time should not be too long.
[0068] Specifically, the client monitors the user's sliding operation instructions. If it receives a sliding operation instruction input by the user and does not receive the next sliding operation instruction input by the user within a preset time, it determines that the sliding operation is completed, and executes the steps of determining the current target live broadcast room and the target stream address of the target live broadcast room and subsequent steps when the sliding operation is completed.
[0069] Step S502, when the previous sliding operation instruction is completed and the next sliding operation instruction is received within a preset time, it is determined that the sliding operation is not completed and the next sliding operation instruction and the previous sliding operation instruction are regarded as one sliding operation instruction.
[0070] Specifically, if the client receives a sliding operation instruction input by the user and receives the next sliding operation instruction input by the user again within a preset time, it is determined that the sliding operation has not ended, and the next sliding operation instruction and the previous sliding operation instruction are used as one sliding operation instruction, that is, the two sliding operation instructions are merged, and the target container is driven to slide according to the merged sliding operation instruction until the client determines that the sliding operation is ended according to step S500.
[0071] It should be understood that, since two sliding operation instructions input within a preset time interval are merged into one sliding operation instruction in this optional embodiment, multiple sliding operation instructions input continuously and quickly by the user will eventually be merged into one sliding operation instruction; and in the aforementioned scheme, when the sliding operation is completed, the stream address of the player container is switched to the target stream address of the target live broadcast room for playback. Therefore, in combination with the scheme of this optional embodiment, the scheme can be considered to only request the live video stream of the target live broadcast room that is finally switched to, without requesting the live video stream of the live broadcast room that passes through in the middle. Of course, this scheme does not exclude the scheme of pulling the live video stream corresponding to the live broadcast room that passes through in the middle, that is, the live video stream corresponding to the live broadcast room that passes through in the middle can still be pulled.
[0072] In an exemplary embodiment, the live room switching method may further include: when the sliding operation is not completed and the sliding passes through other live rooms, skipping the streaming task of other live rooms. In this way, when the user slides quickly on the client, other live rooms passed by in the middle will not be streamed, and only after the sliding operation is completed, the target live room that is finally switched to will be streamed, thereby reducing the client's network requests and reducing the consumption of server resources.
[0073] In this optional embodiment, by determining that the sliding operation is completed when the previous sliding operation instruction is completed and the next sliding operation instruction is not received within a preset time, and determining that the sliding operation instruction is not completed and using the next sliding operation instruction and the previous sliding operation instruction as one sliding operation instruction when the previous sliding operation instruction is completed and the next sliding operation instruction is received within the preset time, multiple sliding operations can be merged when the user slides quickly, which is beneficial for requesting only the live video stream of the live broadcast room that is finally switched to instead of requesting the live video stream of the live broadcast room passed in the middle, so as to reduce the client's network requests and reduce the consumption of server resources; at the same time, it is also beneficial to realize continuous sliding of the target container during the user's quick sliding, thereby facilitating the operation of the target container.
[0074] Embodiment 2 Figure 7 The block diagram of the live broadcast room switching device 600 according to the second embodiment of the present application is schematically shown. The device 600 can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Figure 7 As shown, the device 600 may include a sliding module 610 , a determining module 620 and a switching module 630 .
[0075] The sliding module 610 is used to respond to a sliding operation instruction for the current live broadcast room and drive the target container to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room; A determination module 620 is used to determine the target live broadcast room currently switched to and the target stream address of the target live broadcast room when the sliding operation ends; The switching module 630 is used to switch the stream address of the player container to the target stream address for playback.
[0076] In an optional embodiment, the sliding module 610 is further used for: monitoring a sliding distance of the sliding operation instruction; The target container is driven to follow the live broadcast room list container to slide a distance that is the same as the sliding distance.
[0077] In an optional embodiment, the device 600 is further used for: When the target container is driven to slide to the next live broadcast room, an asynchronous stream pulling task is created for the next live broadcast room; The asynchronous stream pulling task is put into an asynchronous task management queue. The asynchronous task management queue is used to replace the old asynchronous stream pulling task in the asynchronous task management queue with the new asynchronous stream pulling task when a new asynchronous stream pulling task is added.
[0078] In an optional embodiment, the asynchronous stream pulling task is created through JavaScript promise.
[0079] In an optional embodiment, the asynchronous task management queue is a queue managed using RxJS.
[0080] In an optional embodiment, the device 600 is further used for: When a previous sliding operation instruction is completed and a next sliding operation instruction is not received within a preset time, determining that the sliding operation is finished; When a previous sliding operation instruction is completed and a next sliding operation instruction is received within the preset time, it is determined that the sliding operation is not completed and the next sliding operation instruction and the previous sliding operation instruction are regarded as one sliding operation instruction.
[0081] In an optional embodiment, the device 600 is further used for: If the sliding operation is not completed and the sliding passes through other live broadcast rooms, the streaming task of the other live broadcast rooms will be skipped.
[0082] Embodiment 3 Figure 8 The hardware architecture diagram of a computer device 10000 suitable for implementing a live broadcast room switching method according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Figure 8 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed on the computer device 10000, such as the program code of the live room switching method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0083] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0084] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0085] It should be pointed out that Figure 8 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0086] In this embodiment, the live room switching method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.
[0087] Embodiment 4 An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the live broadcast room switching method in the embodiment are implemented.
[0088] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the live room switching method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
[0089] Embodiment 5 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0090] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0091] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for switching between live broadcast rooms, characterized in that: The method comprises: In response to a sliding operation instruction for the current live broadcast room, driving the target container to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room; When the sliding operation is finished, determining the target live broadcast room currently switched to and the target stream address of the target live broadcast room; The stream address of the player container is switched to the target stream address for playback.
2. The method according to claim 1, characterized in that The step of driving the target container to slide according to the sliding operation instruction includes: monitoring a sliding distance of the sliding operation instruction; The target container is driven to follow the live broadcast room list container to slide a distance that is the same as the sliding distance.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the target container is driven to slide to the next live broadcast room, an asynchronous stream pulling task is created for the next live broadcast room; The asynchronous stream pulling task is put into an asynchronous task management queue. The asynchronous task management queue is used to replace the old asynchronous stream pulling task in the asynchronous task management queue with the new asynchronous stream pulling task when a new asynchronous stream pulling task is added.
4. The method according to claim 3, characterized in that The asynchronous streaming task is created through JavaScript promise.
5. The method according to claim 3, characterized in that: The asynchronous task management queue is a queue managed by RxJS.
6. The method according to claim 1 or 2, characterized in that: The method further comprises: When a previous sliding operation instruction is completed and a next sliding operation instruction is not received within a preset time, determining that the sliding operation is finished; When a previous sliding operation instruction is completed and a next sliding operation instruction is received within the preset time, it is determined that the sliding operation is not completed and the next sliding operation instruction and the previous sliding operation instruction are regarded as one sliding operation instruction.
7. The method according to claim 6, characterized in that The method further comprises: If the sliding operation is not completed and the sliding passes through other live broadcast rooms, the streaming task of the other live broadcast rooms will be skipped.
8. A live broadcast room switching device, characterized in that: include: A sliding module, configured to respond to a sliding operation instruction for a current live broadcast room and drive a target container to slide according to the sliding operation instruction, wherein the sliding operation instruction is used to switch the live broadcast room, and the target container at least includes a player container of the current live broadcast room; A determination module, used to determine the target live broadcast room currently switched to and the target stream address of the target live broadcast room when the sliding operation ends; The switching module is used to switch the stream address of the player container to the target stream address for playback.
9. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Content display method and device, electronic equipment and storage medium
CN121567908A