Page switching method and device, electronic equipment and storage medium
By maintaining a single player instance in the main window of the application, the increase in memory usage and screen pause of video software when switching the play page is solved, achieving smoother video playback and reducing the risk of memory overflow.
Patent Information
- Application Number
- CN202310714302.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-15
- Publication Date
- 2024-12-17
AI Technical Summary
Existing video software will increase memory usage and screen pauses when switching playback pages, increasing the risk of memory overflow, and the state synchronization logic is complex, affecting the user experience.
By keeping a single player instance in the main application window for page switching, avoiding new player instances and status synchronization, making sure the player is always in playback.
It reduces memory usage, improves video fluency, avoids the risk of black screen and memory overflow, simplifies code logic, and optimizes user experience.
Smart Images

Figure CN119155498A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to Internet technologies, and more particularly to a page switching method, device, electronic device, and storage medium. Background Art
[0002] Video software can be used by users to browse videos. Existing video software can play videos through multiple playback pages, and users can select the desired playback page to browse videos according to their needs.
[0003] Currently, when a user switches a video from a first playback page to a second playback page, the video player is usually paused first, and the playback progress of the video is recorded. Then, the second playback page is entered through an animated transition method, a new player is created and the video is rendered. Then, the recorded playback history is restored on the new player to continue playing the video.
[0004] However, the player is a component that consumes a lot of system resources. Creating a new player when switching playback pages will increase memory usage and increase the risk of memory overflow. In addition, when switching playback pages, there is a certain delay in the synchronization of the status between the players corresponding to the playback pages, which will cause the screen to pause when switching playback pages. Summary of the invention
[0005] The present invention provides a page switching method, device, electronic device and storage medium to reduce memory occupancy during page switching and improve the fluency of video during page switching.
[0006] In a first aspect, an embodiment of the present disclosure provides a page switching method, which is applied to an application program, and the method includes:
[0007] Play the video through the player on the first play page;
[0008] In response to a page switching operation on a first play page, playing the video through the player in a main window of the application;
[0009] Execute a switching operation from the first play page to the second play page;
[0010] Play the video through the player on the second play page
[0011] In a second aspect, an embodiment of the present disclosure further provides a page switching device, which is applied to an application program, and the device includes:
[0012] A first playback module, used to play the video through a player on a first playback page;
[0013] A second playing module, configured to play the video through the player in the main window of the application program in response to a page switching operation on the first playing page;
[0014] A switching module, used to perform a switching operation from the first play page to the second play page;
[0015] The third playing module is used to play the video through the player on the second playing page.
[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, wherein the electronic device includes:
[0017] one or more processing devices;
[0018] a storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the page switching method provided in the embodiment of the present disclosure.
[0020] In a fourth aspect, an embodiment of the present disclosure further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the page switching method provided in the embodiment of the present disclosure.
[0021] In an embodiment of the present disclosure, a video is played through a player on a first play page; in response to a page switching operation on the first play page, the video is played through the player in the main window of the application; a switching operation is performed from the first play page to the second play page; and the video is played through the player on the second play page. When switching the play page, the present disclosure first plays the video through the player in the main window of the application, and after the page is switched to the second play page, the video is played through the player in the second play page. Since the player is always in the play state, the smoothness of the video playback is guaranteed in the scenario of switching the play page, the pause of the picture when the play page is switched, and the black screen phenomenon is avoided. In addition, when switching the play page, the present disclosure only plays the video in the main window of the application and the second play page in turn through one player, which does not involve the creation of a new player instance and state synchronization, avoids the increase of additional memory, and reduces the risk of memory overflow. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0023] Figure 1 is a flow chart of a page switching method provided by an embodiment of the present disclosure;
[0024] Figure 2 is a flow chart of another page switching method provided by an embodiment of the present disclosure;
[0025] Figure 3 is a flow chart of another page switching method provided by an embodiment of the present disclosure;
[0026] Figure 4 is a structural schematic diagram of a page switching device provided by an embodiment of the present disclosure;
[0027] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0034] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0035] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0036] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0037] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0038] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0039] In video social software, a video can have at least one playback page, and different playback pages can realize different functions. For example, one playback page can be a details page for playing a video, and the details page can be a page for users to operate the video itself. The playback page can display a progress bar of the video playback progress and information identifying the viewing angle; for example, another playback page can be a recommendation page for the video, and the video can be commented on and forwarded on the recommendation page.
[0040] When switching pages, the video needs to continue playing. In a scenario, the user browses the video on the recommendation page of the application (or the video list page similar to the recommendation page), and the user can click the "View Details" button to enter the details page to continue watching. After watching, you can return to the recommendation page from the details page and continue to watch the rest of the video from the recommendation page. There is no limitation on the button here, as long as it can achieve the switching of the playback page. The button does not necessarily display "View Details", it can also display "View Panoramic Video" and other words.
[0041] The related technology switches the playback page, such as entering the detail page from the recommendation page. First, the playback of the current video player A is paused, the playback progress of player A is recorded, and then the details page is entered through an animated transition method, a new player B is created and the video is rendered, and the playback progress is resumed on the new player B to continue playback.
[0042] Return to the recommendation page from the details page, first pause the playback of player B, record the playback progress of player B, then return to the recommendation page through the transition method with animation, update the playback progress of player A and play it.
[0043] However, the player is a component that consumes a lot of system resources. Creating a new player when entering the details page will increase memory usage and increase the risk of out of memory (OOM) crashes. For applications that occupy a lot of memory, the risk of out of memory is even higher. When entering and exiting the details page, due to a certain delay in the animation transition of the page switching and the state synchronization between the two players, the sound and picture of the player will pause and the screen will go black for a moment (usually a few tenths of a second) when the page switches, affecting the viewing experience. The preservation and restoration of information such as progress, status (pause, play), and speed between the two players requires the introduction of additional processing logic, which will inevitably increase the complexity of the code and make maintenance more error-prone.
[0044] The present invention discloses a technology that uses a single player instance to call back and forth when switching pages, which can effectively solve the problems of increased memory usage, black screen and freeze playback when switching pages, and complex state synchronization logic between multiple players, thereby optimizing user experience, reducing OOM risk, and simplifying code logic.
[0045] Because there is only one player instance, entering the details page does not involve the creation and state synchronization of a new player instance, so there will be no additional memory increase, and there will be no problem of state synchronization between the two players.
[0046] Before the page switches, the player will be removed from the recommendation page and temporarily placed in the main window of the application, namely keyWindow (each APP has keyWindow). After entering the details page, the player will be removed from keyWindow and placed in the page hierarchy of the details page. During the whole process, the player is at the front of the view hierarchy and the playback is not interrupted, so there will be no pauses or black screen problems when the page transitions.
[0047] Figure 1 It is a flow chart of a page switching method provided by an embodiment of the present disclosure. The embodiment of the present disclosure is applicable to situations where video fluency is improved when switching playback pages. The method can be executed by a page switching device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, which can be a mobile terminal, a PC or a server, etc.
[0048] like Figure 1 As shown, the method includes:
[0049] S110: Play the video through a player on the first play page.
[0050] The first play page may be a page for playing a video.
[0051] In one embodiment, the first play page may be a page displayed on the homepage of the application, such as a recommendation page, and the first play page may include multiple controls, such as controls for following, commenting on, and collecting videos. This step may display the first play page within the application (such as the homepage of the application) to play the video. In the case where the first play page is a recommendation page or a video list page similar to the recommendation page, the second play page may be a details page. In this embodiment, switching between different videos in the first play page may be achieved by sliding the first play page up and down.
[0052] In one embodiment, the first play page may be a detail page of the video, and correspondingly, the second play page may be a recommendation page, or a video list page similar to the recommendation page.
[0053] In this step, the video on the first play page can be played by the player of the first play page, so that the user can browse the video on the first play page. The video can be a panoramic video, and the user can watch the video from different perspectives by adjusting the angle of the mobile phone.
[0054] S120: In response to a page switching operation on the first play page, play the video through the player in the main window of the application.
[0055] The page switching operation can be considered as an operation of switching the playback page, such as switching the first playback page to the second playback page. The operation method of the page switching operation is not limited here, and can be set according to actual needs, as long as the page switching can be achieved. For example, the page switching can be achieved by sliding the screen, or by clicking a button on the screen. This embodiment does not limit the sliding method, nor does it limit the position of the button in the first playback page and the words presented.
[0056] The main window of an application is also called a keyWindow. Each application has a main window, and there can be only one keyWindow while the application is running.
[0057] When a page switching operation is obtained, the video can be played by the player on the first play page, and then played by the player in the application window, that is, the same player is used, the player is removed from the first play page, and added to the application window, so that the video can be played by the player in the application window. The player can be at the top of the keyWindow or fill the entire screen.
[0058] S130: Execute a switching operation from the first play page to the second play page.
[0059] After detecting the page switching operation, this step may execute the switching operation from the first play page to the second play page. Different first play pages and second play pages correspond to different switching operations and are not limited here.
[0060] In one embodiment, if the second play page is a page that needs to be newly created after switching, the second play page can be created first, then the player instance is placed in the second play page, and then the second page is entered to achieve switching from the first play page to the second play page.
[0061] In one embodiment, if the second play page is a page that does not need to be newly created after switching, the player instance can be directly placed in the second play page, and then enter the second play page to achieve switching from the first play page to the second play page.
[0062] In one embodiment, if the second playback page is a page that does not need to be newly created after switching, and if the first playback page is unknown to which second playback page it will return, the player instance can be transferred through a singleton class, and when the second playback page is exited, the player instance can be passed to the first playback page after being destroyed.
[0063] In this embodiment, after the page switching operation is detected, since the video is played through the player in the main window of the application, even if it is necessary to perform a switching operation from the first playback page to the second playback page, from a visual perspective, the video is always displayed on the screen, so there will be no lag.
[0064] S140: Play the video through the player on the second play page.
[0065] After the play page is switched from the first play page to the second play page, the video can be played through the player on the second play page. The second play page can obtain the player instance and put the player view into the view hierarchy of the second play page so that the video can be played through the player.
[0066] In this embodiment, the player used in the first play page, the second play page and the main window of the application is the same player. This embodiment avoids the risk of memory leakage and reduces memory usage by reusing the player. During the entire page switching process, the player can always be at the top level of the view hierarchy, so that the video is always played on the screen, achieving smooth video playback.
[0067] The technical solution of the embodiment of the present disclosure is that when the playback page is switched, the video is first played through the player in the main window of the application, and after the page is switched to the second playback page, the video is played through the player in the second playback page. Since the player is always in the playback state, the smoothness of the video playback is guaranteed in the scenario of switching the playback page, the pause of the picture when the playback page is switched, and the black screen phenomenon is avoided. In addition, when the playback page is switched, the video is played in the main window of the application and the second playback page in turn only through one player, which does not involve the creation of a new player instance and state synchronization, avoids the increase of additional memory, and reduces the risk of memory overflow.
[0068] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0069] In one embodiment, performing a switching operation from the first play page to the second play page includes:
[0070] Create a second play page;
[0071] Adding the player instance to the second play page;
[0072] Jump to the second play page in a set manner.
[0073] In this embodiment, when switching from the first playback page to the second playback page, it is necessary to create the second playback page. After creating the second playback page, the player instance can be passed in and then jump to the second playback page to achieve the switch from the first playback page to the second playback page.
[0074] This embodiment creates a second play page and can obtain an instance of the second play page. Therefore, this embodiment can directly put the player instance into the second play page.
[0075] This embodiment does not limit the setting method, as long as it can jump from the first play page to the second play page.
[0076] In one embodiment, performing a switching operation from the first play page to the second play page includes:
[0077] Add the player instance to the singleton class;
[0078] Exit the first playback page in a set manner.
[0079] In this embodiment, when switching from the first play page to the second play page, there is no need to create the second play page. The first play page is unaware of the second play page to which it is switched, so when performing the switching operation, this embodiment puts the player instance into a singleton class, and then uses the setting method to exit the first play page. The setting method is not limited, as long as it can exit the first play page.
[0080] In this embodiment, the instance of the second play page cannot be determined, so the player instance is placed in the singleton class to achieve transfer. After exiting the first play page, the player instance in the singleton class can be placed in the second play page.
[0081] A singleton class can be thought of as a class that allows one instance of an object to be created.
[0082] In one embodiment, the setting mode is a mode without animation.
[0083] In this embodiment, when entering the second play page and exiting the first play page, a non-animation method can be used. Since the player is always displayed at the top level of the view hierarchy, the animation transition method is not visible. Therefore, this embodiment does not need to use animation to switch pages. This embodiment uses a non-animation method to switch pages, which can further shorten the page switching process and improve the speed of page switching.
[0084] In one embodiment, the setting of the non-animation mode can be completed by setting the animated parameter.
[0085] In one embodiment, playing the video by the player on the second play page includes:
[0086] In the life cycle method of the view controller, the player view is removed from the main window and added to the view hierarchy of the second play page;
[0087] Sets the callback method for the player.
[0088] In one embodiment, each page can be considered as a view controller (VC). Each UI control is essentially a view. The life cycle method of the view controller, also known as viewWillAppear, is called by the system when entering a new page.
[0089] In this embodiment, the view player can be removed from the main window of the application program in the life cycle method of the view controller, and then added to the topmost layer of the view hierarchy of the second play page.
[0090] This embodiment enables the player to determine the object to be interacted with by setting the callback method of the player. For example, placing the player view in the view hierarchy of the second play page (which can be considered as placing the player in a container) determines the relationship between the container and the player from the perspective of the container. From the perspective of the player, after the state changes, it is unknown to whom the changed state is transmitted. Therefore, by setting the callback method of the player, the player can determine the container to which it needs to communicate after the state changes, so as to realize a two-way association between the player and the container.
[0091] In one embodiment, performing a switching operation from the first play page to the second play page, and playing the video through the player on the second play page, includes:
[0092] Create a second play page;
[0093] Adding the player instance to the second play page;
[0094] Jumping to the second play page in a setting manner; in the life cycle method of the view controller, removing the player view from the main window and adding it to the view hierarchy of the second play page;
[0095] Sets the callback method for the player.
[0096] In one embodiment, playing the video by the player on the second play page includes:
[0097] Remove the player instance from the singleton class and add it to the second play page;
[0098] Move the player view out of the main window and add it to the view hierarchy of the second play page;
[0099] Sets the callback method for the player.
[0100] When performing a switching operation, if a singleton class is created, to play a video on the second play page, you can first remove the player instance from the singleton class, and then put the player instance into the second play page. Remove the player view from the main window and put it at the top of the view hierarchy of the second play page. Finally, set the callback method of the player.
[0101] Figure 2 is a flow chart of another page switching method provided by an embodiment of the present disclosure. This embodiment refines the operation of playing a video through a player in the main window of an application. Figure 2 , the page switching methods include:
[0102] S210: Play the video through a player on the first play page.
[0103] S220. In response to a page switching operation on the first play page, remove the player instance of the player from the parent view controller.
[0104] When playing a video through a player in the main window of an application, in this step, the player instance can be removed from the parent view controller first, so that the player instance can be added to the second playback page.
[0105] S230: Add the player view of the first play page to the main window of the application.
[0106] After the player instance is removed from the parent controller, the player view of the first play page can be placed in the main window of the application, so that the player can always be in the play state in the main window during the play page switching process.
[0107] S240: Execute a switching operation from the first play page to a second play page.
[0108] S250: Play the video through the player on the second play page.
[0109] The disclosed embodiment refines the technical means for playing videos through the main window of an application. This embodiment can remove the player instance from the parent view controller and then place the player view into the main window of the application to achieve video playback through the main window of the application, thereby ensuring the continuity of video playback.
[0110] The present disclosure is exemplarily described below. The page switching method provided by the present disclosure can be considered as a method for switching the playback page of a panoramic video in a virtual reality scene on an iOS device to ensure uninterrupted video playback. Figure 3 is a flow chart of another page switching method provided by an embodiment of the present disclosure, see Figure 3 , taking the first play page as the recommendation page and the second play page as the detail page as an example, the user watches a VR video on the recommendation page and clicks the "View Panorama" button, and then the electronic device performs the following operations:
[0111] 1. Get the current player instance and remove it from its parent VC (i.e., the parent view controller) (i.e., remove the player instance of the player from the parent view controller);
[0112] In this step, you can use the removeFromParentViewController method to remove the player instance.
[0113] 2. Get the current keyWindow and put the player view in (that is, add the player view of the first play page to the main window of the application);
[0114] In this step, you can use the addSubview method to add the player view.
[0115] 3. Create a details page VC, pass in the player instance, and enter it without animation (i.e., create a second play page; add the player instance to the second play page; and jump to the second play page in a set manner);
[0116] This step can be achieved by creating the detail page VC and passing in the player instance through the UIViewController*detailVC method and detailVC.player method.
[0117] 4. Now enter the details page, remove the player view from keyWindow in the viewWillAppear lifecycle method, and add it to the details page view hierarchy (that is, in the view controller's lifecycle method, remove the player view from the main window and add it to the view hierarchy of the second play page; set the player's callback method);
[0118] In this embodiment, the callback method can be set by setting the delegate. In this step, the player view can be removed by the removeFromSuperview method, and the player view can be added by the addSubview method, the addChildViewController method, and the didMoveToParentViewController method.
[0119] 5. The user continues to watch the video on the details page until he clicks the exit button. In this scenario, the playback page switching scene can be switched via the singleton class;
[0120] 6. Remove the player instance from the detail page VC, get the current keyWindow, and put the player view in (i.e., remove the player instance of the player from the parent view controller; add the player view of the first play page to the main window of the application);
[0121] 7. Store the removed player instance into a singleton class, and then exit without animation (that is, add the player instance to the singleton class; exit the first playback page in a set manner);
[0122] 8. Now go back to the recommendation page, take the player out of the singleton class, put it into the recommendation page, and set playback-related callbacks (i.e. remove the player instance from the singleton class and add it to the second playback page; remove the player view from the main window and add it to the view hierarchy of the second playback page). Continue watching other videos.
[0123] When creating a second play page to implement page switching, the first play page can be a recommendation page, and the second play page can be a detail page. When implementing play page switching through a singleton class, the first play page can be a detail page, and the second play page can be a recommendation page.
[0124] During the entire page switching process, the user sees the player at the top, and the player is always in the playing state, so the user's viewing experience is guaranteed to be uninterrupted during the switching process of the entire playback page.
[0125] Figure 4 is a schematic diagram of a page switching device provided by an embodiment of the present disclosure, the page switching device is applied to an application program, such as Figure 4 As shown, the device comprises:
[0126] The first playing module 410 is used to play the video through a player on the first playing page;
[0127] A second playing module 420, configured to play the video through the player in the main window of the application program in response to a page switching operation on the first playing page;
[0128] A switching module 430, configured to execute a switching operation from the first play page to the second play page;
[0129] The third playing module 440 is used to play the video through the player on the second playing page.
[0130] The technical solution provided by the embodiment of the present disclosure is that when switching the playback page, the present disclosure first plays the video through the player in the main window of the application, and after the page is switched to the second playback page, the video is played through the player in the second playback page. Since the player is always in the playback state, the smoothness of the video playback is guaranteed in the scenario of switching the playback page, the pause of the picture when the playback page is switched, and the black screen phenomenon is avoided. In addition, when switching the playback page, the present disclosure only uses one player to play the video in the main window of the application and the second playback page in turn, which does not involve the creation of a new player instance and state synchronization, avoids the increase of additional memory, and reduces the risk of memory overflow.
[0131] In one embodiment, the second playback module 420 is specifically configured to:
[0132] In response to a page switching operation on a first play page, removing a player instance of the player from a parent view controller;
[0133] Adding a player view of the first play page to the main window of the application.
[0134] In one embodiment, the switching module 430 includes:
[0135] A creating unit, used for creating a second play page;
[0136] A first adding unit, used for adding the player instance to the second playing page;
[0137] The jump unit is used to jump to the second play page in a set manner.
[0138] In one embodiment, the switching module 430 includes:
[0139] A second adding unit is used to add a player instance to the singleton class;
[0140] The jump unit is used to exit the first play page in a set manner.
[0141] In one embodiment, the setting mode is a mode without animation.
[0142] In one embodiment, the third playback module 440 is specifically configured to:
[0143] In the life cycle method of the view controller, the player view is removed from the main window and added to the view hierarchy of the second play page;
[0144] Sets the callback method for the player.
[0145] In one embodiment, the third playback module 440 is specifically configured to:
[0146] Remove the player instance from the singleton class and add it to the second play page;
[0147] Move the player view out of the main window and add it to the view hierarchy of the second play page;
[0148] Sets the callback method for the player.
[0149] The page switching device provided in the embodiments of the present disclosure can execute the page switching method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0150] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0151] Figure 5 Schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 5 , which shows an electronic device (eg, Figure 5 A schematic diagram of the structure of a terminal device or server) 500.
[0152] The electronic device 500 includes:
[0153] One or more processing devices 501;
[0154] The storage device 508 is used to store one or more programs.
[0155] When the one or more programs are executed by the one or more processing devices 501, the one or more processing devices 501 implement the method provided in the embodiment of the present disclosure.
[0156] The terminal devices in the embodiments of the present disclosure may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0157] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit / output (I / O) interface 505 is also connected to the bus 504.
[0158] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0159] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0160] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0161] The electronic device 500 provided in the embodiment of the present disclosure and the page switching method provided in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0162] An embodiment of the present disclosure provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the page switching method provided by the above embodiment is implemented.
[0163] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
[0164] The computer storage medium may be a storage medium of computer executable instructions, which, when executed by a computer processor, are used to perform the methods provided by the present disclosure.
[0165] Computer readable storage media may be, for example, but not limited to: electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate, or transmit a program used by or in combination with an instruction execution system, device, or device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0166] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0167] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0168] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0169] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: plays a video through a player on a first play page;
[0170] In response to a page switching operation on a first play page, playing the video through the player in a main window of the application;
[0171] Execute a switching operation from the first play page to the second play page;
[0172] The video is played through the player on the second play page.
[0173] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0174] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0175] The modules or units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module or unit does not limit the unit itself in some cases. For example, a switching module may also be described as a "page switching module".
[0176] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0177] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0178] According to one or more embodiments of the present disclosure, [Example 1] provides a page switching method, which is applied to an application program, and the method includes:
[0179] Play the video through the player on the first play page;
[0180] In response to a page switching operation on a first play page, playing the video through the player in a main window of the application;
[0181] Execute a switching operation from the first play page to the second play page;
[0182] The video is played through the player on the second play page.
[0183] According to one or more embodiments of the present disclosure, [Example 2] provides the method of Example 1, in response to a page switching operation on a first play page, playing the video through the player in the main window of the application, including:
[0184] In response to a page switching operation on a first play page, removing a player instance of the player from a parent view controller;
[0185] Adding a player view of the first play page to the main window of the application.
[0186] According to one or more embodiments of the present disclosure, [Example 3] provides the method described in Example 1, performing a switching operation from the first play page to the second play page, including:
[0187] Create a second play page;
[0188] Adding the player instance to the second play page;
[0189] Jump to the second play page in a set manner.
[0190] According to one or more embodiments of the present disclosure, [Example 4] provides the method described in Example 1, performing a switching operation from the first play page to the second play page, including:
[0191] Add the player instance to the singleton class;
[0192] Exit the first playback page in a set manner.
[0193] According to one or more embodiments of the present disclosure, [Example 5] provides the method described in Example 3 or 4, wherein the setting method is a non-animation method.
[0194] According to one or more embodiments of the present disclosure, [Example 6] provides the method described in Example 1, playing the video through the player on the second play page, including:
[0195] In the life cycle method of the view controller, the player view is removed from the main window and added to the view hierarchy of the second play page;
[0196] Sets the callback method for the player.
[0197] According to one or more embodiments of the present disclosure, [Example 7] provides the method described in Example 1, playing the video through the player on the second play page, including:
[0198] Remove the player instance from the singleton class and add it to the second play page;
[0199] Move the player view out of the main window and add it to the view hierarchy of the second play page;
[0200] Sets the callback method for the player.
[0201] According to one or more embodiments of the present disclosure, [Example 8] provides a page switching device, applied to an application, the device comprising:
[0202] A first playback module, used to play the video through a player on a first playback page;
[0203] A second playing module, configured to play the video through the player in the main window of the application program in response to a page switching operation on the first playing page;
[0204] A switching module, used to perform a switching operation from the first play page to the second play page;
[0205] The third playing module is used to play the video through the player on the second playing page.
[0206] According to one or more embodiments of the present disclosure, [Example 9] provides an electronic device, the electronic device comprising:
[0207] one or more processing devices;
[0208] a storage device for storing one or more programs,
[0209] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the method described in any one of Examples 1-7.
[0210] According to one or more embodiments of the present disclosure, [Example 10] provides a storage medium containing computer-executable instructions, which are used to execute any of the methods described in Examples 1-7 when executed by a computer processor.
[0211] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0212] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0213] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A page switching method, characterized in that: Applied to an application program, the method includes: Play the video through the player on the first play page; In response to a page switching operation on a first play page, playing the video through the player in a main window of the application; Executing a switching operation from the first play page to the second play page; Play the video through the player on the second play page.
2. The method according to claim 1, characterized in that In response to a page switching operation on the first play page, playing the video by the player in the main window of the application program includes: In response to a page switch operation on a first play page, removing the player instance of the player from a parent view controller; Adding a player view of the first play page to the main window of the application.
3. The method according to claim 1, characterized in that Performing a switching operation from the first play page to the second play page includes: Create a second play page; Adding the player instance to the second play page; Jump to the second play page in a set manner.
4. The method according to claim 1, wherein Performing a switching operation from the first play page to the second play page includes: Add the player instance to the singleton class; Exit the first playback page using the setting method.
5. The method according to claim 3 or 4, characterized in that The setting method is a non-animation method.
6. The method according to claim 1, wherein Playing the video by the player on the second play page includes: In the lifecycle method of the view controller, remove the player view from the main window and add it to the view hierarchy of the second playback page; Sets the callback method for the player.
7. The method according to claim 1, characterized in that Playing the video by the player on the second play page includes: Remove the player instance from the singleton class and add it to the second playback page; Move the player view out of the main window and add it to the view hierarchy of the second play page; Sets the callback method for the player.
8. A page switching device, characterized in that: Applied to an application, the device includes: The first playback module is used to play the video through the player on the first playback page; A second playing module is configured to play the video through the player in the main window of the application in response to a page switching operation on the first playing page; A switching module, configured to execute a switching operation from the first play page to the second play page; The third playing module is used to play the video through the player on the second playing page.
9. An electronic device, characterized in that: The electronic device comprises: one or more processing devices; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the method according to any one of claims 1 to 7.
10. A storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to perform the method according to any one of claims 1 to 7.
