A video page switching method and device
By reusing the original player kernel to create a new player instance when switching video pages, the stuttering problem during video page switching is solved, achieving continuity and smoothness of video playback and improving user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2023-02-24
- Publication Date
- 2026-07-21
AI Technical Summary
During video page switching, existing technologies require stopping the current video page's player instance and starting a new one, which causes video data caching and decoding to restart, resulting in stuttering during page switching and reducing user experience.
By creating a new player instance that reuses the original player instance's kernel when switching video pages, and maintaining the original player kernel's video data caching and decoding while the new player instance is running, duplicate caching and decoding operations are avoided.
It effectively avoids lag during page transitions, ensures video continuity, and improves user experience, especially maintaining real-time performance and smoothness during live video transitions.
Smart Images

Figure CN116233549B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, particularly to the field of data processing technology, and especially to a video page switching method and apparatus. Background Technology
[0002] When a user uses an application, their device can display various video pages provided by the application, such as short videos and live streams, and different video pages can display the same video information. In this case, when a user needs to switch pages based on the video information displayed on one video page, the application can respond to this need, switch the video page to another video page, and continue playing the same video information on the switched video page. Summary of the Invention
[0003] This disclosure provides a method and apparatus for switching video pages.
[0004] According to one aspect of this disclosure, a method for switching video pages is provided, comprising:
[0005] In response to a user-initiated first page switching request, the system determines the player kernel contained in the first player instance and loads the second video page to be switched above the current first video page. The first player instance is used to: render the first video data cached and decoded in the player kernel to obtain a video frame. The first video data is: the video data to be played on the first video page.
[0006] Create a second player instance that reuses the player kernel and corresponds to the second video page;
[0007] Run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain a video frame, and displays it in the first player view located in the second video page, wherein the first player view is used to display the video frame rendered by the player instance.
[0008] According to another aspect of this disclosure, a video page switching method is provided, comprising:
[0009] In response to a user-initiated second page switching request, if the user's device displays a third video page and a fourth video page is loaded below the third video page, the player kernel contained in the third player instance corresponding to the third video page is called back to the fourth player instance corresponding to the fourth video page. The view displayed on the third video page includes a second player view, which is used to display the video frame rendered by the third player instance on the second video data. The second video data is the video data to be played on the third video page and decoded by the player kernel.
[0010] Run the fourth player instance and transfer the second player view to the fourth video page, so that the fourth player instance renders the video data decoded by the player kernel to obtain a video image, which is then displayed in the second player view located on the fourth video page;
[0011] The third video page after removing the transfer view.
[0012] According to another aspect of this disclosure, a video page switching device is provided, comprising:
[0013] The first response module is used to respond to a user-initiated first page switching request, determine the player kernel contained in the first player instance, and load the second video page to be switched above the current first video page. The first player instance is used to: render the first video data cached and decoded in the player kernel to obtain a video frame. The first video data is: the video data to be played on the first video page.
[0014] The first creation module is used to create a second player instance that reuses the player kernel and corresponds to the second video page.
[0015] A first running module is used to run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain a video frame, and displays it in the first player view located in the second video page, wherein the first player view is used to display the video frame rendered by the player instance.
[0016] According to another aspect of this disclosure, a video page switching device is provided, comprising:
[0017] The second response module is used to respond to a second page switching request initiated by the user. When the user's device displays a third video page and a fourth video page is loaded below the third video page, the module calls back the player kernel contained in the third player instance corresponding to the third video page to the fourth player instance corresponding to the fourth video page. The view displayed on the third video page includes a second player view, which is used to display the video frame rendered by the third player instance on the second video data. The second video data is the video data to be played on the third video page and decoded by the player kernel.
[0018] The second running module is used to run the fourth player instance and transfer the second player view to the fourth video page, so that the fourth player instance renders the video data decoded by the player kernel to obtain a video image and displays it in the second player view located in the fourth video page;
[0019] The page removal module is used to remove the third video page following the transition view.
[0020] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform any of the video page switching methods described above.
[0024] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform any of the video page switching methods described above.
[0025] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements any of the video page switching methods described above.
[0026] As can be seen from the above, when switching video pages using the solution provided in this embodiment, a second player instance is created, corresponding to the second video page and containing the player kernel of the first player instance. Since the player kernel is used to cache and parse video data, when the second player instance is running, the player kernel reused by the second player instance continues to cache and parse the video data to be played on the first video page. Thus, the video screen obtained by rendering the video data decoded by the player kernel can continue to be displayed on the second video page. This avoids stuttering during page switching and improves the user experience of the application.
[0027] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0028] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0029] Figure 1 A flowchart illustrating the first video page switching method provided in this embodiment of the disclosure;
[0030] Figure 2 A flowchart illustrating the second video page switching method provided in this embodiment of the disclosure;
[0031] Figure 3a This is a schematic diagram of the structure of a live streaming page provided in an embodiment of the present disclosure;
[0032] Figure 3b A flowchart illustrating the third video page switching method provided in this embodiment of the disclosure;
[0033] Figure 4 A flowchart illustrating the fourth video page switching method provided in this embodiment of the disclosure;
[0034] Figure 5a A flowchart illustrating the fifth video page switching method provided in this embodiment of the disclosure;
[0035] Figure 5b A flowchart illustrating a live streaming page switching method provided in an embodiment of this disclosure;
[0036] Figure 6 A flowchart illustrating the sixth video page switching method provided in this embodiment of the disclosure;
[0037] Figure 7 A flowchart illustrating the seventh video page switching method provided in this embodiment of the disclosure;
[0038] Figure 8 A flowchart illustrating the eighth video page switching method provided in this embodiment of the disclosure;
[0039] Figure 9 A schematic diagram of the structure of a first video page switching device provided in an embodiment of this disclosure;
[0040] Figure 10 This is a schematic diagram of the structure of a second video page switching device provided in an embodiment of this disclosure;
[0041] Figure 11 This is a block diagram of an electronic device used to implement the video page switching method of the embodiments of this disclosure. Detailed Implementation
[0042] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0043] When displaying a video page provided by an application on a user device, it is necessary to create a player instance corresponding to the video page and cache the video data to be played on the video page in the player kernel contained in the created player instance. The player kernel then decodes the video data, so that the video page displays the video image obtained by the player instance rendering the video data decoded by the player kernel.
[0044] In existing technologies, different video pages provided by an application correspond to different player instances, and these player instances contain different player kernels. When switching video pages provided by the application, it is necessary to stop running the player instance of the current video page and start running the player instance corresponding to the video page to be switched. Thus, during the page switching process, the player kernel of the player instance corresponding to the video page to be switched needs to re-cache video data and decode it, which causes stuttering problems during the page switching process and reduces the user's experience of using the application.
[0045] To address the aforementioned technical problems, this disclosure provides a video page switching method and apparatus, which will be described in detail below through specific embodiments.
[0046] See Figure 1 , Figure 1This is a flowchart illustrating the first video page switching method provided in this embodiment. In this embodiment, the method includes the following steps S101-S103.
[0047] Step S101: In response to the user's first page switching request, determine the player kernel contained in the first player instance, and load the second video page to be switched above the current first video page.
[0048] The first player instance is used to render the first video data cached and decoded in the player kernel to obtain a video image.
[0049] The first video data refers to the video data to be played on the first video page.
[0050] When the user device displays the first video page, the player kernel in the first player instance can cache the video data to be played on the first video page and decode the cached video data. In this way, the rendering module in the first player instance can render the decoded video data, obtain the rendered video image, and display the rendered video image on the first video page.
[0051] The first video page and the second video page mentioned above are two different video pages, and both pages can play the same video information.
[0052] For example, the first video page mentioned above could be a short video page, and the second video page mentioned above could be a live streaming page, where the live stream footage from the live streaming room could be played; the second video page mentioned above could also be an online video playback page, where video clips from online videos could be played.
[0053] The first video page and the second video page mentioned above can also be other video pages, and this disclosure does not limit them.
[0054] Specifically, in response to a user's request to switch to the first page, the system can determine the currently running first player instance corresponding to the first video page, and thus determine the player kernel contained in the first player instance.
[0055] In addition, before responding to a user's page switching request, the first player instance corresponding to the current first video page can be determined in advance, and then the player kernel contained in the first player instance can be determined, thereby determining the correspondence between the first video page and the player kernel. In this way, when responding to the above-mentioned first page switching request, the player kernel corresponding to the first video page can be determined according to this correspondence.
[0056] When the user device displays the first video page, the video played on the first video page can be a video that can be played on another video page, and the application can determine the page type of the other video page. Therefore, when responding to the first page switching request, the application can determine the page type of the second video page to be switched to, and thus can use existing page loading technology to load the second video page of the determined page type above the first video page, so that the user device can prioritize displaying the information displayed on the second video page.
[0057] Step S102: Create a second player instance that reuses the player kernel and corresponds to the second video page.
[0058] Specifically, a player instance can be understood as the code that calls player methods stored in the application to convert video data into video frames, while the player kernel can be understood as the method code within the player methods used to cache and decode video data. When creating a second player instance, the first player instance is running, and the player kernel contained in the first player instance is caching and decoding the aforementioned first video data. At this time, the method code of the player kernel containing the cached first video data in the code corresponding to the first player instance can be added to the code corresponding to the second player instance to create the second player instance, thereby enabling the second player instance to reuse the player kernel of the first player instance.
[0059] Step S103: Run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain the video image and displays it in the first player view located in the second video page.
[0060] The first player view is used to display the video frame rendered by the player instance.
[0061] Specifically, before switching pages, the view displayed on the first video page includes a first player view, which is used to display the video frame obtained by the first player instance rendering the first video data.
[0062] After the second player instance is created, the first player instance can be paused and the second player instance can be started. Since the kernel of the second player instance is the player kernel from the first player instance, this player kernel is always working during the process of the first player instance stopping and the second player instance starting. That is, the player kernel is always decoding the cached video data, and the player instance used to render the player kernel changes from the first player instance to the second player instance. In this way, after the first player view is transferred to the second video page, the first player view can be displayed on the second video page, and the video screen displayed in the first player view is still the video screen obtained from the video data decoded by the rendering player kernel.
[0063] When transferring the first player view, existing view transfer technology can be used to transfer the first player view to the second video page, which will not be described in detail here.
[0064] In addition, when the first player view included in the second video page starts displaying the video, information such as the display time of the first video frame and the position of the first video frame in the video data can be recorded.
[0065] As can be seen from the above, when switching video pages using the solution provided in this embodiment, a second player instance is created, corresponding to the second video page and containing the player kernel of the first player instance. Since the player kernel is used to cache and parse video data, when the second player instance is running, the player kernel reused by the second player instance continues to cache and parse the video data to be played on the first video page. Thus, the video screen obtained by rendering the video data decoded by the player kernel can continue to be displayed on the second video page. This avoids stuttering during page switching, thereby optimizing the page switching process between the two video pages and improving the user experience of the application.
[0066] In one embodiment of this disclosure, the second video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
[0067] Since live video data is usually real-time, and the video page switching scheme provided in this embodiment can avoid the problem of lag during page switching, when the second video page is a live page, the video page switching scheme provided in this embodiment can ensure that the live video is uninterrupted and lag-free during page switching, thereby providing users with real-time and continuous live content display, which can improve the user's live viewing experience.
[0068] In one embodiment of this disclosure, a second video page with a transparent background can be loaded above the first video page. In this case, even when the second video page has not yet displayed any content, the first video page located below the second video page can be displayed on the user device because the background of the second video page is transparent.
[0069] In this solution, the background of the second video page is transparent. This allows the user's device to continue displaying the first video page even before the second video page has shown any content, thus avoiding a black screen issue after the second video page is loaded.
[0070] Additionally, the application can be configured with a second video page with a non-transparent background. When loading the second video page, the application can determine whether it meets the loading conditions for a second video page with a transparent background. If it does, the second video page with a transparent background is loaded; otherwise, the second video page with a non-transparent background is loaded.
[0071] In one embodiment of this disclosure, the loading condition may be the following:
[0072] The second video page requires the latest version of the plugin;
[0073] The application's overall cloud control functionality is enabled;
[0074] The player kernel identifier of the first player instance is not assigned an empty value.
[0075] When switching pages, the application needs to generate page switching instructions that instruct the application to switch between pages, thereby enabling page switching between different pages based on the generated page switching instructions.
[0076] Based on the above, in one embodiment of this disclosure, see [link to relevant documentation]. Figure 2 The present invention provides a flowchart of a second method for switching video pages. In this embodiment, the method includes the following steps S201-S204.
[0077] Step S201: In response to the user's first page switching request, determine the player kernel contained in the first player instance and obtain the kernel identifier of the player kernel; generate a page switching instruction carrying the kernel identifier; and load the second video page to be switched above the current first video page according to the page switching instruction.
[0078] In one embodiment of this disclosure, the page switching instruction can be a switching instruction generated based on the scheme protocol.
[0079] Specifically, after determining the player kernel contained in the first player instance, the kernel identifier of the determined player kernel can be obtained. In this way, when generating page switching instructions, a page switching instruction carrying the kernel identifier can be generated. Based on the page switching instructions, the second video page is loaded on top of the first video using existing page loading technology.
[0080] Step S202: Read the kernel identifier carried in the page switching instruction.
[0081] Specifically, after the application generates a page switching instruction, the kernel identifier carried in the page switching instruction can be read using existing instruction reading technology, which will not be elaborated here.
[0082] In addition, if there are multiple routes for different data transmissions between the application in the user device and the server, after generating the above-mentioned page switching instruction, the video page to be switched indicated by the page switching instruction can be determined, thereby determining the route corresponding to the video page, and then transmitting video data by that route when the video page is displayed subsequently.
[0083] Step S203: Based on the read kernel identifier, reuse the player kernel as the kernel of the second player instance, and create the second player instance corresponding to the second video page.
[0084] Specifically, based on the read kernel identifier, the player kernel contained in the first player instance can be determined. When creating the second player instance, the player kernel contained in the first player instance is used as the kernel of the player instance to be created, thereby creating the second player instance.
[0085] After determining the player kernel contained in the first player instance, the specific implementation method for creating the second player instance can be found above. Figure 1 Step S102 in the illustrated embodiment will not be described again here.
[0086] Step S204: Run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain the video image and displays it in the first player view located in the second video page.
[0087] This step is the same as step S103 above, and will not be repeated here.
[0088] As can be seen from the above, when switching video pages using the solution provided in this embodiment, the kernel identifier of the player kernel contained in the first player instance is carried in the page switching instruction. Thus, when creating the second player instance, the kernel identifier carried in the page switching instruction is read. Based on this kernel identifier, a second player instance with a player kernel can be accurately created, thereby running a more accurate second player instance and ensuring that the application can switch video pages normally. Therefore, applying the video page switching solution provided in this embodiment can improve the stability and reliability of video page switching.
[0089] In one embodiment of this disclosure, before reading the kernel identifier carried in the page switching instruction, it is possible to detect whether the aforementioned player kernel is working properly, and it is also possible to detect whether the video components required for the second video page have been loaded, so as to ensure that subsequent processing can proceed normally. If the aforementioned player kernel is detected to be malfunctioning, it means that the user device is having difficulty displaying the first video page normally. At this time, the player kernel can be initialized. If it is detected that the video components required for the second video page have not been loaded, it means that the application may not have downloaded the video component, or the video component may not have been loaded completely. At this time, it is possible to detect whether the video component exists in the application. If it does not exist, it means that the user device has not previously displayed the second video page. In this case, the video component can be downloaded from the application's background server. If it exists, the video component can be reloaded.
[0090] The video page provided by an application typically consists of multiple container layers, each of which can hold view elements. When the video page is displayed on the application's device, the page can be composed of the view elements contained in each container layer within the video page. For example, see... Figure 3a , Figure 3a The live streaming page is divided into several container layers, including a MixShellActivity background container layer, a Gaussian blur background container layer, a 30% opacity mask container layer, a live streaming room background container layer, a player container layer, a business component container layer, and a first-level plugin IM component container layer. The player container layer can hold the player view rendered by the player instance, or it can hold images.
[0091] When loading a video page, the application can load multiple container layers of the video page according to pre-set rules, thereby enabling some container layers to be displayed and others to be hidden.
[0092] In one embodiment of this disclosure, see [link to embodiment]. Figure 3b The present invention provides a flowchart of a third method for switching video pages. In this embodiment, the above method includes the following steps S301-S304.
[0093] Step S301: In response to the user's first page switching request, determine the player kernel contained in the first player instance, and load the second video page whose display state to be switched is above the current first video page.
[0094] In the second video page, which is partially displayed, the player container layer is in the displayed state, while other container layers are in the hidden state.
[0095] The player container layer is used to place the first player view.
[0096] Specifically, the second video page, which displays a portion of the content, can be loaded using either of the following two methods.
[0097] In the first implementation, when the application loads the second video page with the partial display state to be switched, it can first load the various container layers of the second video page, and then hide the other container layers except for the player container layer, thereby loading the second video page with the partial display state.
[0098] In addition, the operation of hiding other container layers can be completed in a short time after each container layer is loaded. In this way, the display effect of the second video page on the user's device can be approximated as only displaying the player container layer and hiding other container layers.
[0099] In the second implementation, the initial state of the player container layer in the second video page can be set to the displayed state, and the initial state of other container layers can be set to the hidden state. In this way, when the second video page is loaded, the player container layer in the displayed state and other container layers in the hidden state can be loaded.
[0100] Step S302: Create a second player instance that reuses the player kernel and corresponds to the second video page.
[0101] Step S303: Run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain the video image and displays it in the first player view located in the second video page.
[0102] Step S302 is the same as step S102, and step S303 is the same as step S103, so they will not be repeated here.
[0103] Step S304: Display other container layers that are currently hidden in the second video page.
[0104] Specifically, when displaying other container layers, you can directly change the state of the other container layers to the displayed state, thereby displaying them. Alternatively, you can pre-set display animations for other container layers, so that they are displayed according to the set animations.
[0105] For example, you can preset the display animation to a fade-in animation, so that when displaying other container layers, they will be displayed gradually in a fade-in manner.
[0106] The above-mentioned display animation can also be translation animation, scaling animation, etc., and the embodiments disclosed herein are not limited to this.
[0107] As can be seen from the above, when switching video pages using the solution provided in this embodiment, after responding to the first page switching request, a second video page in a partially displayed state is first loaded above the first video page. After the video image is displayed in the first player view located in the second video page, other container layers in the second video page that are in a hidden state are then displayed. By gradually displaying each container layer of the second video page, the user can avoid a sense of jump, improve the smoothness of video page switching, and thus improve the user's viewing experience.
[0108] When transferring the first player view to the second video page, the first player view needs to be removed from the first video page and then added to the second video page. As a result, when the view is removed but not added to the second video page, it is difficult for the user's device to display the video screen shown in the first player view, which will cause the user's device to go black during this process.
[0109] To address the aforementioned issues, in one embodiment of this disclosure, see [link to relevant documentation]. Figure 4 The present invention provides a flowchart of a fourth video page switching method. In this embodiment, the above method includes the following steps S401-S405.
[0110] Step S401: In response to the user's first page switching request, determine the player kernel contained in the first player instance, and load the second video page to be switched above the current first video page.
[0111] Step S402: Create a second player instance that reuses the player kernel and corresponds to the second video page.
[0112] Step S401 is the same as step S101, and step S402 is the same as step S102, so they will not be repeated here.
[0113] Step S403: Obtain a screenshot of the first screen currently displayed in the first player view.
[0114] Specifically, the above first screenshot can be obtained through either of the following two methods.
[0115] In the first implementation, since the first player view is used to display the video screen obtained by the first player instance rendering video data, when obtaining the above-mentioned first screen screenshot, the video screen currently rendered by the first player instance can be obtained as the above-mentioned first screen screenshot.
[0116] In the second implementation, when the second video page has a transparent background, a screenshot of the first video page currently displayed on the user's device can be captured as the first screen screenshot.
[0117] Step S404: Place the screenshot of the first screen into the player container layer of the second video page.
[0118] Since the second video page is located above the first video page, after placing the first screenshot in the player container layer of the second video page, the first screenshot can cover the first video page, so the screen displayed on the user's device is the first screenshot.
[0119] Step S405: Run the second player instance and transfer the first player view of the first video page to the player container layer of the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain the video image and displays it in the first player view located in the second video page.
[0120] The first player view is located above the first screenshot.
[0121] Specifically, when the first player view is transferred to the player container layer of the second video page, this player container layer contains two view elements: the aforementioned first screenshot and the first player view. Within this player container layer, the first player view is positioned above the first screenshot; it can be understood that the first player view covers the first screenshot, thus the screen displayed on the user's device is the first player view.
[0122] In one embodiment of this disclosure, during the transfer of the first player view, the first player view can be located below the first screenshot, so that the first screenshot can be removed after the view transfer is completed. When the first player view is located below the first screenshot, the first screenshot can continue to be displayed on the user device. At this time, removing the first screenshot means that the player container layer of the second video page only contains the first player view, and the user device can then display the video screen displayed by the first player view.
[0123] As can be seen from the above, when switching video pages using the solution provided in this embodiment, the first screenshot is placed in the player container layer of the second video page before the view is transferred. In this way, when the first player view is removed from the first video page and not added to the second video page, the user device can display the first screenshot, thus eliminating the black screen problem.
[0124] The display position and size of different video pages provided by the application may vary. Therefore, in one embodiment of this disclosure, see... Figure 5a The present invention provides a flowchart of the fifth video page switching method. In this embodiment, the above method includes the following steps S501-S506.
[0125] Step S501: In response to the user's first page switching request, determine the player kernel contained in the first player instance, and load the second video page to be switched above the current first video page.
[0126] Step S502: Create a second player instance that reuses the player kernel and corresponds to the second video page.
[0127] Step S503: Obtain a screenshot of the first screen currently displayed in the first player view.
[0128] Step S504: Place the screenshot of the first screen into the player container layer of the second video page.
[0129] Steps S501-S504 are the same as steps S401-S404, and will not be repeated here.
[0130] Step S505: If the first display area and the second display area are inconsistent, the position of the second display area is adjusted to the position of the first display area, and the size of the second display area is adjusted to the size of the first display area.
[0131] The first display area is the display area of the player container layer of the first video page on the user device.
[0132] The second display area is the display area of the player container layer of the second video page on the user's device.
[0133] The first player view before the transfer is placed in the player container layer of the first video page.
[0134] Specifically, when the user device displays the first video page, the application can determine the first display area of the player container layer within the first video page. When responding to a first page switching request, the application can determine the second video page to be loaded, thereby determining the second display area of the player container layer of the second video page on the user device. Thus, after determining the first and second display areas, if the first and second display areas are inconsistent—that is, their positions and / or sizes are inconsistent—then the position of the second display area is adjusted to match the position of the first display area, and the size of the second display area is adjusted to match the size of the first display area.
[0135] Adjusting the position and size of the second display area can be achieved using existing container layer adjustment techniques, which will not be detailed here.
[0136] Step S506: Run the second player instance and restore the position and size of the second display area according to the preset first restoration speed. During the restoration process, transfer the first player view of the first video page to the player container layer.
[0137] The aforementioned first restoration speed can be preset by the user.
[0138] Before restoring the second display area, its position and size are the same as the first display area. Since step S504 places the first screenshot in the player container layer of the second video page, the second display area displays the first screenshot. During the restoration of the second display area's position and size, when the first player view has not yet been added to the player container layer of the second video page, the second display area displays the first screenshot; when the first player view is added to the player container layer of the second video page, the second display area displays the video frame from the first player view.
[0139] The implementation method for transferring the first player view to the player container layer can be found in step S103 above, and will not be repeated here.
[0140] As can be seen from the above, when switching video pages using the solution provided in this disclosure, if the first display area and the second display area are inconsistent, by adjusting the position and size of the second display area to match the position and size of the first display area, and shifting the first player view during the restoration of the position and size of the second display area, the page switching process displayed on the user device becomes a process where the position and size of the video image gradually change while the video content remains unchanged, thus achieving smooth video page switching. Therefore, the video page switching solution provided in this disclosure can smoothly switch video pages, improving the user's viewing experience.
[0141] In one embodiment of this disclosure, see [link to embodiment]. Figure 5b A flowchart illustrating a method for switching live streaming pages is provided. In this embodiment, the first video page is a short video page, and the second video page is a live streaming page.
[0142] Figure 5b In the process, users can initiate a page switching request by clicking on the short video page. The application responds to the request by generating a page switching instruction, obtaining the live stream distributed by the live stream router from the server, and checking whether the player kernel contained in the player instance corresponding to the short video page is working properly. If not, the player kernel is initialized. If it is, the application continues to check whether the live streaming first-level plugin of the live streaming page has been loaded. If not, the live streaming first-level plugin is reloaded. If it is, the page switching instruction is parsed and the page switching begins.
[0143] When switching pages, the system checks if the application meets preset loading conditions. If it does, a live stream page with a transparent background is loaded; otherwise, a live stream page with a non-transparent background is loaded. After loading the live stream page, all container layers except the player container layer are hidden. The kernel flag carried in the page switching instruction is read, the player kernel is reused, and a player instance corresponding to the live stream page is created. After successful player kernel reuse, a screenshot of the player view contained in the short video page is obtained and placed in the player container layer of the live stream page. The player view is then transferred from the short video page to the live stream page. After the view transfer, it checks if the live stream page displayed on the user's device has started playing. If so, a first-frame notification is generated to help record live stream information such as duration and time period. If not, it waits for the live stream page to start playing until the first-frame notification is received. After receiving the first-frame notification, the screenshot in the player container layer of the live stream page is removed, and the hidden container layers are restored to the display.
[0144] When switching video pages using the scheme provided in the above-disclosed embodiments, the second video page is essentially overlaid on top of the first video page, and the player view originally displayed on the first video page is transferred to the second video page, thereby completing the page switching. Contrary to the page switching process described in the above-disclosed embodiments, this disclosure also provides another video page switching method.
[0145] In one embodiment of this disclosure, see [link to embodiment]. Figure 6 The present invention provides a flowchart of a sixth video page switching method. In this embodiment, the above method includes the following steps S601-S603.
[0146] Step S601: In response to the user's request to switch to the second page, if the user's device displays the third video page and a fourth video page is loaded below the third video page, the player kernel contained in the third player instance corresponding to the third video page is called back to the fourth player instance corresponding to the fourth video page.
[0147] The view displayed on the third video page includes a second player view. The second player view is used to display the video frame rendered by the third player instance on the second video data. The second video data is the video data to be played on the third video page and decoded by the player kernel.
[0148] The aforementioned third and fourth video pages are two different video pages, and both pages can play the same video information.
[0149] For example, the third video page mentioned above could be a live streaming page, and the fourth video page mentioned above could be a short video page, in which the live streaming footage from the live streaming room could be played; the third video page mentioned above could also be an online video playback page, in which video clips from online videos could be played.
[0150] The aforementioned third and fourth video pages can also be other video pages, and this disclosure does not limit them.
[0151] Specifically, when a user device displays a third video page and a fourth video page is loaded below it, it means that both the third and fourth video pages have been loaded. However, because the third video page is located above the fourth video page, the fourth video page is overshadowed by the third video page, so the third video page is displayed on the user device. Therefore, when the application loads the third and fourth video pages, it has already created instances of the third player corresponding to the third video page and the fourth player corresponding to the fourth video page. Thus, when responding to a user's request to switch to the second page, it can determine the third player instance corresponding to the third video page, thereby determining the player kernel contained within that instance, and adding the determined player kernel to the fourth player instance corresponding to the fourth video page.
[0152] Step S602: Run the fourth player instance and transfer the second player view to the fourth video page so that the fourth player instance renders the video data decoded by the player kernel to obtain the video image and displays it in the second player view located in the fourth video page.
[0153] This step is the same as the one described above. Figure 1 Step S103 in the illustrated embodiment is similar and will not be described again here.
[0154] Step S603: Remove the third video page after the transfer view.
[0155] Specifically, the third video page is located above the fourth video page. After the third video page is removed, the user device can display the fourth video page. Since the second player view was moved to the fourth video page before the page was removed, the user device can still display the video playing in the second player view when the third video page is removed and the user device displays the fourth video page.
[0156] As can be seen from the above, when switching video pages using the solution provided in this embodiment, if the user device displays a third video page and a fourth video page is loaded below the third video page, the third player instance corresponding to the third video page is in a running state. At this time, the player kernel contained in the third player instance can cache and decode the video data to be played on the third video page. After the player kernel contained in the third player instance is called back to the fourth player instance, the fourth player instance is run. The player kernel contained in the fourth player instance continues to cache and parse the video data to be played. By reusing the same player kernel between the third player instance and the fourth player instance, it is possible to avoid the player kernel contained in the fourth player instance from re-caching and decoding the video data when the fourth player instance is running. This avoids the stuttering problem caused by re-caching video data during page switching, thereby optimizing the page switching process between the two video pages and improving the user experience of the application.
[0157] In one embodiment of this disclosure, the third video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
[0158] Since live video data is usually real-time, and the video page switching scheme provided in this embodiment can avoid the problem of lag during page switching, when the third video page is a live page, the video page switching scheme provided in this embodiment can ensure that the live video is uninterrupted and unlag-free during page switching, thereby providing users with real-time and continuous live content display, which can improve the user's live viewing experience.
[0159] In one embodiment of this disclosure, the switching time consumed by the application in switching pages can also be recorded in real time. If the application still has not completed the page switching when the switching time reaches a preset time threshold, the third and fourth video pages currently loaded by the application are directly removed, and a new fourth video page and a fifth player instance corresponding to the fourth video page are created. The created fifth player instance is run, and the player kernel contained in the fifth player instance re-caches video data and decodes the cached video data, thereby displaying the video screen obtained by the video data rendered and decoded by the fifth player instance in the newly created fourth video page.
[0160] For example, the aforementioned preset duration threshold can be a manually set duration, such as 200 milliseconds, 250 milliseconds, etc.
[0161] When transferring the second player view to the fourth video page, the second player view needs to be removed from the third video page and then added to the fourth video page. As a result, when the view is removed but not added to the fourth video page, the third video page does not contain the second player view. Therefore, it is difficult for the user's device to display the video screen shown in the second player view, which causes the user's device to experience a black screen during this process.
[0162] To address the aforementioned issues, in one embodiment of this disclosure, a screenshot of the second screen currently displayed in the second player view is obtained before transferring the second player view to the fourth video page; the screenshot of the second screen is then placed in the first player container layer of the third video page.
[0163] The first player container layer is the container layer where the second player view is located.
[0164] Specifically, the above second screenshot can be obtained through either of the following two methods.
[0165] In the first implementation, since the second player view is used to display the video screen obtained by the third player instance rendering video data, when obtaining the above-mentioned second screen screenshot, the video screen currently rendered by the third player instance can be obtained as the above-mentioned second screen screenshot.
[0166] In the second implementation method, a screenshot of the third video page currently displayed on the user's device can be directly captured as the second screen screenshot mentioned above.
[0167] After obtaining the second screenshot, it is placed within the first player container layer. This allows the user device to still display the second screenshot within the first player container layer even after the second player view is moved to the fourth video page. When the third video page is removed after the view is moved, all container layers of the third video page are removed, which directly removes the second screenshot from the first player container layer. This allows the user device to display the video playback from the second player view on the fourth video page.
[0168] As can be seen from the above, when switching video pages using the solution provided in this embodiment, the second screenshot is placed in the first player container layer of the third video page before the view is transferred. In this way, when the second player view is removed from the third video page and not added to the fourth video page, the user device can display the second screenshot, thus eliminating the black screen problem.
[0169] In another embodiment of this disclosure, before transferring the second player view to the fourth video page, a screenshot of the second screen currently displayed in the second player view can be obtained; if the third video page is a video page with a transparent background, the screenshot of the second screen is placed in the second player container layer of the fourth video page; and when transferring the second player view to the fourth video page, the second player view is transferred to the second player container layer.
[0170] The second player view is located above the second screenshot.
[0171] The implementation methods for obtaining the second screen screenshot and placing the second screen screenshot in the second player container layer can be found in the above embodiments, and will not be repeated here.
[0172] In the case of a video page with a transparent background on the third video page, when the second player instance is removed from the third video page, the fourth video page located below the third video page can be displayed on the user device. Since the second player container layer contains a second screenshot, the user device can display the second screenshot when displaying the fourth video page, thus eliminating the black screen problem that occurs during the second player view transfer.
[0173] The display position and size of different video pages provided by the application may vary. Therefore, in one embodiment of this disclosure, see... Figure 7 The document provides a flowchart of the seventh video page switching method. In this embodiment, the above method includes the following steps S701-S704.
[0174] Step S701: In response to the user's request to switch to the second page, if the user's device displays the third video page and a fourth video page is loaded below the third video page, the player kernel contained in the third player instance corresponding to the third video page is called back to the fourth player instance corresponding to the fourth video page.
[0175] This step is the same as step S601 above, and will not be repeated here.
[0176] Step S702: If the third display area and the fourth display area are inconsistent, the position of the fourth display area is adjusted to the position of the third display area, and the size of the fourth display area is adjusted to the size of the third display area. The third display area is the display area of the first player container layer of the third video page in the user device, and the fourth display area is the display area of the second player container layer of the fourth video page in the user device. The second player view before the transfer is placed in the first player container layer.
[0177] Step S703: Run the fourth player instance, restore the position and size of the fourth display area according to the preset second restoration speed, and transfer the second player view to the second player container layer during the restoration process.
[0178] Steps S702 and S703 above are respectively related to the above... Figure 5a Steps S505 and S506 in the illustrated embodiment are similar and will not be described again here.
[0179] Step S704: Remove the third video page after the transfer view.
[0180] This step is the same as step S603 above, and will not be repeated here.
[0181] As can be seen from the above, when switching video pages using the solution provided in this disclosure, if the third and fourth display areas are inconsistent, the position and size of the fourth display area are adjusted to match the position and size of the third display area. During the restoration of the fourth display area's position and size, the second player view is transferred. Thus, the page switching process displayed on the user's device is a gradual change in the position and size of the video frame while the video content remains unchanged, achieving smooth video page switching. Therefore, the video page switching solution provided in this disclosure can smoothly switch video pages, improving the user's viewing experience.
[0182] In one embodiment of this disclosure, before running the fourth player instance and transferring the second player view to the fourth video page, other container layers in the third video page besides the first player container layer may also be hidden.
[0183] The first player container layer is the container layer where the second player view is located.
[0184] Hiding container layers other than the first player container layer can be achieved using existing container layer processing techniques, which will not be detailed here.
[0185] When hiding other container layers besides the first player container layer, you can also pre-set a hiding animation, so that when hiding other container layers, you can hide other container layers according to the set hiding animation.
[0186] For example, you can pre-set the hide animation to a fade-out animation, so that when hiding other container layers, the other container layers will gradually fade out.
[0187] The aforementioned hidden animation can also be a translation animation, a scaling animation, etc., and this disclosure does not limit this aspect.
[0188] In addition, before hiding other container layers, interaction between the third video page and the user can be disabled. For example, the interaction could include clicking, swiping up or down, etc.
[0189] As can be seen from the above, when switching video pages using the solution provided in this embodiment, before transferring the second player view to the fourth video page, all container layers in the third video page except for the first player container layer are hidden, and after the second player view is transferred to the fourth video page, the third video page after the transferred view is removed. By gradually removing each container layer of the third video page, the user can avoid a sense of jump, improve the smoothness of video page switching, and thus improve the user's viewing experience.
[0190] In one embodiment of this disclosure, see [link to embodiment]. Figure 8The document provides a flowchart of the eighth video page switching method. In this embodiment, after receiving the second page switching request initiated by the user, the page termination finish method is called in response to the request, and it is determined whether a smooth video page switching is required. For example, it is determined whether the application meets the preset smooth switching conditions or whether the user has indicated a smooth page switching. If a smooth transition between video pages is not required, the `finish` method can be used to terminate the third video page directly. If a smooth transition is required, the interaction between the third video page and the user can be disabled, and all container layers in the third video page except for the player container layer can be hidden. After all other container layers are hidden, it is determined whether a screenshot of the currently displayed video screen of the third video page can be obtained. If the screenshot cannot be obtained, the `finish` method can be used to terminate the third video page directly. If the screenshot can be obtained, it can be placed in the first player container layer of the third video page, or, if the background of the third video page is transparent, it can be placed in the second player container layer of the fourth video page. When placing the screenshot, the player kernel contained in the third player instance corresponding to the third video page can be called back to the fourth player instance corresponding to the fourth video page to run the fourth player instance and transfer the second player view to the fourth video page. Finally, the `finish` method can be used to terminate the third video page.
[0191] In addition, the switching time of the video page during application switching can be recorded in real time. If the video page switching is not completed when the switching time reaches the preset time threshold, the third video page can be terminated directly using the page termination method.
[0192] Corresponding to the above-described video page switching method, this disclosure also provides a video page switching device.
[0193] In one embodiment of this disclosure, see [link to embodiment]. Figure 9 A schematic diagram of the structure of a first type of video page switching device is provided. In this embodiment, the device includes:
[0194] The first response module 901 is used to respond to a first page switching request initiated by a user, determine the player kernel contained in the first player instance, and load the second video page to be switched above the current first video page. The first player instance is used to: render the first video data cached and decoded in the player kernel to obtain a video image. The first video data is: the video data to be played on the first video page.
[0195] The first creation module 902 is used to create a second player instance that reuses the player kernel and corresponds to the second video page.
[0196] The first running module 903 is used to run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain a video frame and displays it in the first player view located in the second video page, wherein the first player view is used to display the video frame rendered by the player instance.
[0197] As can be seen from the above, when switching video pages using the solution provided in this embodiment, a second player instance is created, corresponding to the second video page and containing the player kernel of the first player instance. Since the player kernel is used to cache and parse video data, when the second player instance is running, the player kernel reused by the second player instance continues to cache and parse the video data to be played on the first video page. Thus, the video screen obtained by rendering the video data decoded by the player kernel can continue to be displayed on the second video page. This avoids stuttering during page switching and improves the user experience of the application.
[0198] In one embodiment of this disclosure, the first response module 901 is specifically used for:
[0199] Obtain the kernel identifier of the player kernel;
[0200] Generate a page switching instruction carrying the kernel identifier;
[0201] According to the page switching instruction, load the second video page to be switched to above the current first video page;
[0202] The first creation module 902 is specifically used for:
[0203] Read the kernel identifier carried in the page switching instruction;
[0204] Based on the read kernel identifier, the player kernel is reused as the kernel of the second player instance, and a second player instance corresponding to the second video page is created.
[0205] As can be seen from the above, when switching video pages using the solution provided in this embodiment, the kernel identifier of the player kernel contained in the first player instance is carried in the page switching instruction. Thus, when creating the second player instance, the kernel identifier carried in the page switching instruction is read. Based on this kernel identifier, a second player instance with a player kernel can be accurately created, thereby running a more accurate second player instance and ensuring that the application can switch video pages normally. Therefore, applying the video page switching solution provided in this embodiment can improve the stability and reliability of video page switching.
[0206] In one embodiment of this disclosure, the first response module 901 is specifically used for:
[0207] Load a second video page with a transparent background to be switched above the current first video page.
[0208] In this solution, the background of the second video page is transparent. This allows the user's device to continue displaying the first video page even before the second video page has shown any content, thus avoiding a black screen issue after the second video page is loaded.
[0209] In one embodiment of this disclosure, the first response module 901 is specifically used for:
[0210] A second video page with a partially displayed state to be switched is loaded above the current first video page. In the second video page with a partially displayed state, the player container layer is in a displayed state and other container layers are in a hidden state. The player container layer is used to place the first player view.
[0211] The device further includes:
[0212] The container layer display module is used to display other container layers that are hidden in the second video page after the first player view of the first video page is transferred to the second video page.
[0213] As can be seen from the above, when switching video pages using the solution provided in this embodiment, after responding to the first page switching request, a second video page in a partially displayed state is first loaded above the first video page. After the video image is displayed in the first player view located in the second video page, other container layers in the second video page that are in a hidden state are then displayed. By gradually displaying each container layer of the second video page, the user can avoid a sense of jump, improve the smoothness of video page switching, and thus improve the user's viewing experience.
[0214] In one embodiment of this disclosure, the apparatus further includes:
[0215] The first obtaining module is used to obtain a screenshot of the first screen currently displayed by the first player view before transferring the first player view to the second video page;
[0216] The first placement module is used to place the first screenshot in the player container layer of the second video page;
[0217] The first response module 901 is specifically used for:
[0218] The first player view of the first video page is moved to the player container layer, wherein the first player view is located above the first screenshot.
[0219] As can be seen from the above, when switching video pages using the solution provided in this embodiment, the first screenshot is placed in the player container layer of the second video page before the view is transferred. In this way, when the first player view is removed from the first video page and not added to the second video page, the user device can display the first screenshot, thus eliminating the black screen problem.
[0220] In one embodiment of this disclosure, the apparatus further includes:
[0221] The first adjustment module is used to adjust the position of the second display area to the position of the first display area and adjust the size of the second display area to the size of the first display area if the first display area and the second display area are inconsistent. The first display area is the display area of the player container layer of the first video page in the user device, and the second display area is the display area of the player container layer of the second video page in the user device. The first player view before the transfer is placed in the player container layer of the first video page.
[0222] The first operating module 903 is specifically used for:
[0223] The position and size of the second display area are restored according to a preset first restoration speed, and during the restoration process, the first player view of the first video page is transferred to the player container layer.
[0224] As can be seen from the above, when switching video pages using the solution provided in this disclosure, if the first display area and the second display area are inconsistent, by adjusting the position and size of the second display area to match the position and size of the first display area, and shifting the first player view during the restoration of the position and size of the second display area, the page switching process displayed on the user device becomes a process where the position and size of the video image gradually change while the video content remains unchanged, thus achieving smooth video page switching. Therefore, the video page switching solution provided in this disclosure can smoothly switch video pages, improving the user's viewing experience.
[0225] In one embodiment of this disclosure, the second video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
[0226] Since live video data is usually real-time, and the video page switching scheme provided in this embodiment can avoid the problem of lag during page switching, when the second video page is a live page, the video page switching scheme provided in this embodiment can ensure that the live video is uninterrupted and lag-free during page switching, thereby providing users with real-time and continuous live content display, which can improve the user's live viewing experience.
[0227] In one embodiment of this disclosure, see [link to embodiment]. Figure 10 A schematic diagram of another video page switching device is provided. In this embodiment, the device includes:
[0228] The second response module 1001 is used to respond to a second page switching request initiated by the user. When the user's device displays a third video page and a fourth video page is loaded below the third video page, the module calls back the player kernel contained in the third player instance corresponding to the third video page to the fourth player instance corresponding to the fourth video page. The view displayed on the third video page includes a second player view, which is used to display the video frame obtained by the third player instance rendering the second video data. The second video data is the video data to be played on the third video page and decoded by the player kernel.
[0229] The second running module 1002 is used to run the fourth player instance and transfer the second player view to the fourth video page, so that the fourth player instance renders the video data decoded by the player kernel to obtain a video image and displays it in the second player view located in the fourth video page;
[0230] Page Removal Module 1003 is used to remove the third video page after the transition view.
[0231] As can be seen from the above, when switching video pages using the solution provided in this embodiment, if the user device displays a third video page and a fourth video page is loaded below the third video page, the third player instance corresponding to the third video page is in a running state. At this time, the player kernel contained in the third player instance can cache and decode the video data to be played on the third video page. After the player kernel contained in the third player instance is called back to the fourth player instance, the fourth player instance is run. The player kernel contained in the fourth player instance continues to cache and parse the video data to be played. By reusing the same player kernel between the third player instance and the fourth player instance, it is possible to avoid the player kernel contained in the fourth player instance from re-caching and decoding the video data when the fourth player instance is running. This avoids the stuttering problem caused by re-caching video data during page switching, thereby optimizing the page switching process between the two video pages and improving the user experience of the application.
[0232] In one embodiment of this disclosure, the apparatus further includes:
[0233] The second obtaining module is used to obtain a screenshot of the second screen currently displayed in the second player view before transferring the second player view to the fourth video page;
[0234] The second placement module is used to place the second screenshot on the first player container layer of the third video page, wherein the first player container layer is the container layer where the second player view is located.
[0235] As can be seen from the above, when switching video pages using the solution provided in this embodiment, the second screenshot is placed in the first player container layer of the third video page before the view is transferred. In this way, when the second player view is removed from the third video page and not added to the fourth video page, the user device can display the second screenshot, thus eliminating the black screen problem.
[0236] In one embodiment of this disclosure, the apparatus further includes:
[0237] The second obtaining module is used to obtain a screenshot of the second screen currently displayed in the second player view before transferring the second player view to the fourth video page;
[0238] The third placement module is used to place the second screenshot on the second player container layer of the fourth video page when the third video page is a video page with a transparent background.
[0239] The second operating module 1002 is specifically used for:
[0240] The second player view is moved to the second player container layer, wherein the second player view is located above the second screenshot.
[0241] In the case of a video page with a transparent background on the third video page, when the second player instance is removed from the third video page, the fourth video page located below the third video page can be displayed on the user device. Since the second player container layer contains a second screenshot, the user device can display the second screenshot when displaying the fourth video page, thus eliminating the black screen problem that occurs during the second player view transfer.
[0242] In one embodiment of this disclosure, the apparatus further includes:
[0243] The second adjustment module is used to adjust the position of the fourth display area to the position of the third display area and adjust the size of the fourth display area to the size of the third display area if the third display area and the fourth display area are inconsistent. The third display area is the display area of the first player container layer of the third video page in the user device, and the fourth display area is the display area of the second player container layer of the fourth video page in the user device. The second player view before the transfer is placed in the first player container layer.
[0244] The second operating module 1002 is specifically used for:
[0245] The position and size of the fourth display area are restored according to the preset second restoration speed, and the second player view is transferred to the second player container layer during the restoration process.
[0246] As can be seen from the above, when switching video pages using the solution provided in this disclosure, if the third and fourth display areas are inconsistent, the position and size of the fourth display area are adjusted to match the position and size of the third display area. During the restoration of the fourth display area's position and size, the second player view is transferred. Thus, the page switching process displayed on the user's device is a gradual change in the position and size of the video frame while the video content remains unchanged, achieving smooth video page switching. Therefore, the video page switching solution provided in this disclosure can smoothly switch video pages, improving the user's viewing experience.
[0247] In one embodiment of this disclosure, the apparatus further includes:
[0248] The container layer hiding module is used to hide other container layers in the third video page, except for the first player container layer, before the fourth player instance is run and the second player view is transferred to the fourth video page, wherein the first player container layer is the container layer where the second player view is located.
[0249] As can be seen from the above, when switching video pages using the solution provided in this embodiment, before transferring the second player view to the fourth video page, all container layers in the third video page except for the first player container layer are hidden, and after the second player view is transferred to the fourth video page, the third video page after the transferred view is removed. By gradually removing each container layer of the third video page, the user can avoid a sense of jump, improve the smoothness of video page switching, and thus improve the user's viewing experience.
[0250] In one embodiment of this disclosure, the third video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
[0251] Since live video data is usually real-time, and the video page switching scheme provided in this embodiment can avoid the problem of lag during page switching, when the third video page is a live page, the video page switching scheme provided in this embodiment can ensure that the live video is uninterrupted and unlag-free during page switching, thereby providing users with real-time and continuous live content display, which can improve the user's live viewing experience.
[0252] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0253] In one embodiment of this disclosure, an electronic device is provided, comprising:
[0254] At least one processor; and
[0255] A memory communicatively connected to the at least one processor; wherein,
[0256] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform any of the video page switching methods described above.
[0257] In one embodiment of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform any of the video page switching methods described above.
[0258] In one embodiment of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements any of the video page switching methods described above.
[0259] Figure 11 A schematic block diagram of an example electronic device 1100 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0260] like Figure 11 As shown, device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1102 or a computer program loaded from storage unit 1108 into random access memory (RAM) 1103. The RAM 1103 may also store various programs and data required for the operation of device 1100. The computing unit 1101, ROM 1102, and RAM 1103 are interconnected via bus 1104. Input / output (I / O) interface 1105 is also connected to bus 1104.
[0261] Multiple components in device 1100 are connected to I / O interface 1105, including: input unit 1106, such as keyboard, mouse, etc.; output unit 1107, such as various types of monitors, speakers, etc.; storage unit 1108, such as disk, optical disk, etc.; and communication unit 1109, such as network card, modem, wireless transceiver, etc. Communication unit 1109 allows device 1100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0262] The computing unit 1101 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above, such as the video page switching method. For example, in some embodiments, the video page switching method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1100 via ROM 1102 and / or communication unit 1109. When the computer program is loaded into RAM 1103 and executed by the computing unit 1101, one or more steps of the video page switching method described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to perform the video page switching method by any other suitable means (e.g., by means of firmware).
[0263] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0264] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0265] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0266] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0267] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0268] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0269] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0270] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for switching video pages, comprising: In response to the user's first page switching request, determine the player kernel contained in the first player instance and obtain the kernel identifier of the player kernel; Generate a page switching instruction carrying the kernel identifier; according to the page switching instruction, load the second video page to be switched above the current first video page, wherein the player instance is the code that calls the player method stored in the application to convert video data into a video frame, the player kernel is the method code in the player method used to cache and decode video data, and the first player instance is used to: render the first video data cached and decoded in the player kernel to obtain a video frame, wherein the first video data is: the video data to be played on the first video page; Read the kernel identifier carried in the page switching instruction; add the method code of the player kernel containing the cached first video data to the code corresponding to the second player instance to create the second player instance, so that the second player instance can reuse the player kernel of the first player instance; Run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain a video frame, and displays it in the first player view located in the second video page, wherein the first player view is used to display the video frame rendered by the player instance.
2. The method according to claim 1, wherein, Loading the second video page to be switched to above the current first video page includes: Load a second video page with a transparent background to be switched above the current first video page.
3. The method according to claim 1, wherein, Loading the second video page to be switched to above the current first video page includes: A second video page with a partially displayed state to be switched is loaded above the current first video page. In the second video page with a partially displayed state, the player container layer is in a displayed state and other container layers are in a hidden state. The player container layer is used to place the first player view. After transferring the first player view of the first video page to the second video page, the method further includes: Display other container layers that are currently hidden in the second video page.
4. The method according to any one of claims 1-3, wherein, Before transferring the first player view of the first video page to the second video page, the method further includes: Obtain a screenshot of the first screen currently displayed in the first player view; Place the first screenshot in the player container layer of the second video page; The step of transferring the first player view of the first video page to the second video page includes: The first player view of the first video page is moved to the player container layer, wherein the first player view is located above the first screenshot.
5. The method according to claim 4, further comprising: If the first display area and the second display area are inconsistent, the position of the second display area is adjusted to the position of the first display area, and the size of the second display area is adjusted to the size of the first display area. The first display area is the display area of the player container layer of the first video page in the user device, and the second display area is the display area of the player container layer of the second video page in the user device. The first player view before the transfer is placed in the player container layer of the first video page. The step of transferring the first player view of the first video page to the player container layer includes: The position and size of the second display area are restored according to a preset first restoration speed, and during the restoration process, the first player view of the first video page is transferred to the player container layer.
6. The method according to any one of claims 1-3, wherein, The second video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
7. A method for switching video pages, comprising: In response to a user's request to switch to a second page, if the user's device displays a third video page and a fourth video page is loaded below the third video page, the system determines the third player instance corresponding to the third video page, determines the player kernel contained in the third player instance, and adds the method code of the determined player kernel to the code corresponding to the fourth player instance corresponding to the fourth video page. Here, the player instance is the code that calls a player method stored in the application to convert video data into a video frame, and the player kernel is the method code in the player method used to cache and decode video data. The view displayed on the third video page includes a second player view, which is used to display the video frame rendered by the third player instance from the second video data. The second video data is the video data to be played on the third video page and decoded by the player kernel. Run the fourth player instance and transfer the second player view to the fourth video page, so that the fourth player instance renders the video data decoded by the player kernel to obtain a video image, which is then displayed in the second player view located on the fourth video page; The third video page after removing the transfer view.
8. The method according to claim 7, wherein, Before transferring the second player view to the fourth video page, the method further includes: Obtain a screenshot of the second screen currently displayed in the second player view; The second screenshot is placed in the first player container layer of the third video page, wherein the first player container layer is the container layer where the second player view is located.
9. The method according to claim 7, wherein, Before transferring the second player view to the fourth video page, the method further includes: Obtain a screenshot of the second screen currently displayed in the second player view; In the case where the third video page is a video page with a transparent background, the second screenshot is placed in the second player container layer of the fourth video page; The step of transferring the second player view to the fourth video page includes: The second player view is moved to the second player container layer, where the second player view is located above the second screenshot.
10. The method of claim 9, further comprising: If the third display area and the fourth display area are inconsistent, the position of the fourth display area is adjusted to the position of the third display area, and the size of the fourth display area is adjusted to the size of the third display area. The third display area is the display area of the first player container layer of the third video page in the user device, and the fourth display area is the display area of the second player container layer of the fourth video page in the user device. The second player view before the transfer is placed in the first player container layer. The step of transferring the second player view to the second player container layer includes: The position and size of the fourth display area are restored according to the preset second restoration speed, and the second player view is transferred to the second player container layer during the restoration process.
11. The method according to any one of claims 7-10, wherein, Before running the fourth player instance and transferring the second player view to the fourth video page, the method further includes: Hide all container layers in the third video page except for the first player container layer, where the first player container layer is the container layer where the second player view is located.
12. The method according to any one of claims 7-10, wherein, The third video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
13. A video page switching device, comprising: The first response module is used to respond to the first page switching request initiated by the user, determine the player kernel contained in the first player instance, and obtain the kernel identifier of the player kernel; Generate a page switching instruction carrying the kernel identifier; according to the page switching instruction, load the second video page to be switched above the current first video page, wherein the player instance is the code that calls the player method stored in the application to convert video data into a video frame, the player kernel is the method code in the player method used to cache and decode video data, and the first player instance is used to: render the first video data cached and decoded in the player kernel to obtain a video frame, wherein the first video data is: the video data to be played on the first video page; The first creation module is used to read the kernel identifier carried in the page switching instruction; add the method code of the player kernel containing the cached first video data to the code corresponding to the second player instance to create the second player instance, so that the second player instance reuses the player kernel of the first player instance; A first running module is used to run the second player instance and transfer the first player view of the first video page to the second video page, so that the second player instance renders the first video data decoded by the player kernel to obtain a video frame, and displays it in the first player view located in the second video page, wherein the first player view is used to display the video frame rendered by the player instance.
14. The apparatus according to claim 13, wherein, The first response module is specifically used for: Load a second video page with a transparent background to be switched above the current first video page.
15. The apparatus according to claim 13, wherein, The first response module is specifically used for: A second video page with a partially displayed state to be switched is loaded above the current first video page. In the second video page with a partially displayed state, the player container layer is in a displayed state and other container layers are in a hidden state. The player container layer is used to place the first player view. The device further includes: The container layer display module is used to display other container layers that are hidden in the second video page after the first player view of the first video page is transferred to the second video page.
16. The apparatus according to any one of claims 13-15, further comprising: The first obtaining module is used to obtain a screenshot of the first screen currently displayed by the first player view before transferring the first player view to the second video page; The first placement module is used to place the first screenshot in the player container layer of the second video page; The first response module is specifically used for: The first player view of the first video page is moved to the player container layer, wherein the first player view is located above the first screenshot.
17. The apparatus of claim 16, further comprising: The first adjustment module is used to adjust the position of the second display area to the position of the first display area and adjust the size of the second display area to the size of the first display area if the first display area and the second display area are inconsistent. The first display area is the display area of the player container layer of the first video page in the user device, and the second display area is the display area of the player container layer of the second video page in the user device. The first player view before the transfer is placed in the player container layer of the first video page. The first operating module is specifically used for: The position and size of the second display area are restored according to a preset first restoration speed, and during the restoration process, the first player view of the first video page is transferred to the player container layer.
18. The apparatus according to any one of claims 13-15, wherein, The second video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
19. A video page switching device, comprising: The second response module is used to respond to a user-initiated second page switching request. When the user's device displays a third video page and a fourth video page is loaded below the third video page, the module determines the third player instance corresponding to the third video page, determines the player kernel contained in the third player instance, and adds the method code of the determined player kernel to the code corresponding to the fourth player instance corresponding to the fourth video page. Here, the player instance is the code that calls the player method stored in the application to convert video data into a video frame, and the player kernel is the method code in the player method used to cache and decode video data. The view displayed by the third video page includes a second player view, which is used to display the video frame obtained by the third player instance rendering the second video data. The second video data is the video data to be played on the third video page and decoded by the player kernel. The second running module is used to run the fourth player instance and transfer the second player view to the fourth video page, so that the fourth player instance renders the video data decoded by the player kernel to obtain a video image and displays it in the second player view located in the fourth video page; The page removal module is used to remove the third video page following the transition view.
20. The apparatus of claim 19, further comprising: The second obtaining module is used to obtain a screenshot of the second screen currently displayed in the second player view before transferring the second player view to the fourth video page; The second placement module is used to place the second screenshot on the first player container layer of the third video page, wherein the first player container layer is the container layer where the second player view is located.
21. The apparatus of claim 19, further comprising: The second obtaining module is used to obtain a screenshot of the second screen currently displayed in the second player view before transferring the second player view to the fourth video page; The third placement module is used to place the second screenshot on the second player container layer of the fourth video page when the third video page is a video page with a transparent background. The second operating module is specifically used for: The second player view is moved to the second player container layer, where the second player view is located above the second screenshot.
22. The apparatus of claim 21, further comprising: The second adjustment module is used to adjust the position of the fourth display area to the position of the third display area and adjust the size of the fourth display area to the size of the third display area if the third display area and the fourth display area are inconsistent. The third display area is the display area of the first player container layer of the third video page in the user device, and the fourth display area is the display area of the second player container layer of the fourth video page in the user device. The second player view before the transfer is placed in the first player container layer. The second operating module is specifically used for: The position and size of the fourth display area are restored according to the preset second restoration speed, and the second player view is transferred to the second player container layer during the restoration process.
23. The apparatus according to any one of claims 19-22, further comprising: The container layer hiding module is used to hide other container layers in the third video page, except for the first player container layer, before the fourth player instance is run and the second player view is transferred to the fourth video page, wherein the first player container layer is the container layer where the second player view is located.
24. The apparatus according to any one of claims 19-22, wherein, The third video page is a live streaming page, and the video data decoded by the player kernel is live streaming data.
25. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6 or 7-12.
26. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6 or 7-12.
27. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6 or 7-12.