Disclosure of Invention
The invention provides a video suspension playing method and device based on an iOS system, which can improve the video playing effect.
In order to achieve the purpose, the invention is realized by the following technical scheme:
in a first aspect, the invention provides a video floating play method based on an iOS system, which determines a constructed floating view model (floating view model), wherein the floating view model is provided with an available attribute of AVPlayerLayer;
passing the flowingviewmodel to a UIviewController (view controller) extended with a floating window presentation function;
determining a floating controller (suspension controller) constructed with a baseWindow and a baseView, wherein the display permission of the baseWindow is the highest display permission, the baseView is placed above the baseWindow, and the AVPlayerLayer is placed above the baseView;
further comprising:
displaying a first page, wherein the first page can support the playing of a target video, and a video suspension playing function button is arranged in the first page;
when the external triggering operation aiming at the video suspension play function button is monitored, determining a second page to be displayed, and acquiring a Controller (Controller) at the uppermost layer of the second page by using a UITabbar Controller (column Controller) in the UIviewcontroller;
controlling the baseWindow to be located at the uppermost layer of the second page by using the Controller and the flowing Controller, and controlling the target video to be played on the AVPlayerLayer according to the available attribute of the AVPlayerLayer by using the UITabbar Controller;
and controlling the displayed page to be switched from the first page to the second page by using a UINavgationcontroller (navigation controller) in the UIviewcontroller.
Further, the controlling the displayed page to switch from the first page to the second page comprises: and according to the pre-constructed transition animation, executing animation conversion processing from the first page to the second page so as to display the second page.
Further, the flowingviewmodel is also provided with available attributes of page sources;
after the monitoring of the external triggering operation for the video floating playing function button, further comprising: recording the page source as the first page by using the UIviewController;
after the controlling the displayed page to be switched from the first page to the second page, further comprising: when the target video is played in a floating mode, when the external trigger operation aiming at a preset button for exiting the floating play function is monitored, the recorded first page is obtained from the UIviewcontroller by using the Floatingcontroller and is transmitted to the UINavgationcontroller; and controlling the displayed page to be switched into the first page by utilizing the UINavgationcontroller.
Further, any one or more of an available attribute of a floating window size, an available attribute of a floating window position, and an available attribute of a floating window switching speed are set in the floating viewmodel.
In a second aspect, the present invention provides an iOS system-based video floating playback apparatus, including:
a determining unit, configured to determine a constructed FloatingViewModel, where an available attribute of the AVPlayerLayer is set in the FloatingViewModel; transmitting the FloatingViewModel to a UIviewController extended with a floating window showing function; determining a flowing controller constructed with a baseWindow and a baseView, wherein the display permission of the baseWindow is the highest display permission, the baseView is placed above the baseWindow, and the AVPlayerLayer is placed above the baseView;
the display unit is used for displaying a first page, wherein the first page can support the playing of a target video, and a video suspension playing function button is arranged in the first page; displaying the second page;
the processing unit is used for determining the second page to be displayed when the external triggering operation aiming at the video suspension play function button is monitored, and acquiring a Controller of the uppermost layer of the second page by using a UITabbar Controller in the UIviewcontroller; controlling the baseWindow to be located at the uppermost layer of the second page by using the Controller and the flowing Controller, and controlling the target video to be played on the AVPlayerLayer according to the available attribute of the AVPlayerLayer by using the UITabbar Controller; and controlling the page displayed by the display unit to be switched from the first page to the second page by using a UINavgationcontroller in the UIviewcontroller.
Further, the processing unit is configured to execute animation conversion processing from the first page to the second page according to pre-constructed TransitionAnimation, so as to control the presentation unit to present the second page.
Further, the flowingviewmodel is also provided with available attributes of page sources;
the processing unit is further configured to record the page source as the first page by using the UIviewController after monitoring an external trigger operation for the video floating play function button; when the display unit is controlled to float and play the target video and the external trigger operation aiming at a preset button exiting the floating and playing function is monitored, the floating controller is utilized to obtain the recorded first page from the UIviewcontroller and transmit the first page to the UINavgationcontroller; and controlling the page displayed by the display unit to be switched into the first page by using the UINavgationcontroller.
Further, any one or more of an available attribute of a floating window size, an available attribute of a floating window position, and an available attribute of a floating window switching speed are set in the floating viewmodel.
In a third aspect, the present invention provides a readable medium, which includes an execution instruction, and when a processor of a storage controller executes the execution instruction, the storage controller executes any one of the above-mentioned iOS system-based video floating playback methods.
In a fourth aspect, the present invention provides a memory controller comprising: a processor, a memory, and a bus;
the storage is used for storing an execution instruction, the processor is connected with the storage through the bus, and when the storage controller runs, the processor executes the execution instruction stored in the storage, so that the storage controller executes any one of the above video floating playing methods based on the iOS system.
The invention provides a video floating playing method and device based on an iOS system. Transferring the suspension view model with the available attributes of the AVPlayerLayer to a view controller with the expanded suspension window display function; determining a floating controller constructed with a dedicated window and a dedicated view above the dedicated window with the highest display right and below the AVPlayerLayer; displaying a first page supporting target video playing; determining a second page when external request is carried out for suspension play, and acquiring a controller at the uppermost layer of the second page by using a column controller; controlling the special window to be positioned at the uppermost layer of the second page by using the controller and the suspension controller; controlling the target video to be played on the AVPlayerLayer by utilizing a column controller according to the available attributes; and switching the displayed page into a second page by utilizing the navigation controller. The invention can improve the video playing effect.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a video floating playback method based on an iOS system, which may include the following steps:
step 101: determining a constructed FloatgViewModel, wherein the FloatgViewModel is provided with the available attribute of the AVPlayerLayer.
Step 102: and transmitting the FloatWiewModel to the UIviewController extended with the floating window showing function.
Step 103: determining a flowing controller constructed with a baseWindow and a baseView, wherein the display permission of the baseWindow is the highest display permission, the baseView is placed above the baseWindow, and the AVPlayerLayer is placed above the baseView.
Step 104: and displaying a first page, wherein the first page can support the playing of a target video, and a video suspension playing function button is arranged in the first page.
Step 105: when the triggering operation of the external video floating play function button is monitored, a second page to be displayed is determined, and a Controller of the uppermost layer of the second page is obtained by using a UITabbar Controller in the UIviewcontroller.
Step 106: controlling the baseWindow to be located at the uppermost layer of the second page by using the Controller and the flowing Controller, and controlling the target video to be played on the AVPlayerLayer according to the available attribute of the AVPlayerLayer by using the UITabbar Controller.
Step 107: and controlling the displayed page to be switched from the first page to the second page by using a UINavgationcontroller in the UIviewcontroller.
The embodiment of the invention provides a video floating playing method based on an iOS system, which comprises the following steps: transferring the suspension view model with the available attributes of the AVPlayerLayer to a view controller with the expanded suspension window display function; determining a floating controller constructed with a dedicated window and a dedicated view above the dedicated window with the highest display right and below the AVPlayerLayer; displaying a first page supporting target video playing; determining a second page when external request is carried out for suspension play, and acquiring a controller at the uppermost layer of the second page by using a column controller; controlling the special window to be positioned at the uppermost layer of the second page by using the controller and the suspension controller; controlling the target video to be played on the AVPlayerLayer by utilizing a column controller according to the available attributes; and switching the displayed page into a second page by utilizing the navigation controller. The embodiment of the invention can improve the video playing effect.
In detail, iOS is a mobile operating system developed by apple inc. The video floating playing method based on the iOS system provided by the embodiment of the invention can be generally used for mobile phones supporting the iOS system.
In the embodiment of the present invention, steps 101 to 103 may be performed in advance, and based on this, steps 104 to 107 may be performed as needed based on user operation, and may be repeated multiple times.
Through steps 101 to 103, the components for implementing the large and small screen switching are determined in advance. And step 105 to step 106, implementing the FloatingViewModel to perform basic configuration at the place where the large screen and the small screen are to be switched. Thus, after the SHOW _ FLOATING _ VIEW notification is sent, the switching between the two pages can be realized, and the video is played on the switched page in a suspending way.
Corresponding to the step 101, in the embodiment of the present invention, the floating view model, which is a floating view model, may be used as a configuration item for configuring each available attribute as needed. The whole scheme can carry out information transfer by means of configuration items. The most important of these available attributes is AVPlayerLayer, which is a prerequisite to ensure that the player does not break.
Corresponding to the above step 102, the constructed flowingviewmodel can be delivered to the UIviewController extended with the floating window display function by means of notification. For example, the UITabbrController + FloatingExtension class may be passed to. This class is an extension to the UITabbar controller, extending the functionality of displaying a floating window.
In detail, UiviewController includes uitabbercontroller and uinavgaptioncontroller. The sub-controllers in the uviewController can use this extended functionality as needed.
Corresponding to the step 103, a floating controller is determined, in which a dedicated baseWindow and baseView are constructed for video floating play. Specifically, the AVPlayerLayer is placed on the baseView, which is in turn placed on the baseWindow. Thus, by constructing a dedicated floating window, global usage may not be affected.
Based on the above, the video floating playing method based on the iOS system provided in the embodiment of the present invention has the whole scope of application in the video playing APP, and at least has the following characteristics:
the characteristics are as follows: and (5) seamless switching of videos.
In detail, the video player of the iOS system is developed on what is called the CALayer subclass, AVPlayerLayer. That is, AVPlayerLayer is the control we really see the picture. Thus, the AVPlayerLayer is transmitted in each page, thereby achieving the purpose of seamless switching without stopping video playing.
For example, in order to make the video of the B page continue to be played after returning to the a page, the AVPlayerLayer only needs to return to the a page to find a position for display.
Because the seamless switching of the videos can be realized, the occurrence probability of phenomena such as video disconnection, sound stop, pause replay and the like during small window playing can be effectively reduced.
And (2) the characteristics: the global function use of the APP cannot be influenced.
In detail, the AVPlayerLayer can be added to a dedicated UIWindow, such as the baseWindow described above, and its display right can be raised to the highest display right, such as to be the same as UIAlert, so that it can be displayed globally without affecting the normal use of the function.
In detail, UIAlert can be used for alert notification in general.
And (3) characteristics: convenient to use and non-invasive.
In detail, the purpose that any layer or view can be operated globally by importing the UIViewController extension header file without writing any lines of codes can be achieved by extending the UIViewController.
In summary, the implementation of the video floating play based on the iOS system disclosed in the embodiments of the present invention does not affect the normal use of the system, and can respond globally. Therefore, after the function is started at the mobile phone end, the user can play the video program continuously through the small window on the whole APP, and normal use of the item is not influenced.
In the embodiment of the invention, all data in the APP can be browsed on the premise of video playing, so that the user experience is greatly improved, and the user can freely operate the whole APP and cannot freely experience the whole APP without being limited by a video playing scope.
In detail, in the process of jumping from the first page to the second page, the animation processing can be added. In which animation processing can be performed by the TransitionAnimation class.
Based on this, in one embodiment of the present invention, the controlling the displayed page to be switched from the first page to the second page comprises: and according to the pre-constructed TransitionAnimation, executing animation conversion processing from the first page to the second page so as to display the second page.
In detail, through the processing of the newly added animation, the switching operation is not obtrusive, and the watching experience of a user is improved.
Corresponding to the above steps 104 to 107, the display terminal may display a first page for the user to view the target video. When a user needs to browse other pages while watching a target video, another page can be displayed, and the target video is played in a floating mode on the page. Typically, a jump may be made to a page immediately preceding the first page.
On the basis, when the user needs to quit the hover play, the display terminal usually needs to display the first page again. Therefore, in an embodiment of the present invention, the flowingviewmodel is also provided with an available attribute of a page source;
after the monitoring of the external triggering operation for the video floating playing function button, further comprising: recording the page source as the first page by using the UIviewController;
after the controlling the displayed page to be switched from the first page to the second page, further comprising: when the target video is played in a floating mode, when the external trigger operation aiming at a preset button for exiting the floating play function is monitored, the recorded first page is obtained from the UIviewcontroller by using the Floatingcontroller and is transmitted to the UINavgationcontroller; and controlling the displayed page to be switched into the first page by utilizing the UINavgationcontroller.
For example, when the user clicks the floating window to request to return to the first page in the floating play process, the first page can be accurately found and displayed through the first page recorded in the floating controller.
In an embodiment of the present invention, any one or more of an available attribute of a floating window size, an available attribute of a floating window position, and an available attribute of a floating window switching speed are further set in the floating viewmodel.
In detail, the user can set these parameters as desired, otherwise preset standard values can be used by default. Based on these parameters, the hover play implementation at page switch can be defined.
As shown in fig. 2, an embodiment of the present invention provides another video floating playing method based on an iOS system, which specifically includes the following steps:
step 201: and determining the constructed FloatgViewModel, wherein the available attribute of the AVPlayerLayer and the available attribute of the page source are set in the FloatgViewModel.
In detail, the flowingviewmodel may also be provided with an available attribute of the floating window size, an available attribute of the floating window position, an available attribute of the floating window switching speed, and the like.
Step 202: the flowingviewmodel is passed to the uviewcontroller that has been extended with the floating window show function.
Step 203: and determining the flowing controller constructed with baseWindow and baseView, wherein the display permission of the baseWindow is the highest display permission, the baseView is placed above the baseWindow, and the AVPlayerLayer is placed above the baseView.
Step 204: and displaying a first page, wherein the first page can support the playing of a target video, and a video suspension playing function button is arranged in the first page.
Taking the mobile phone display as an example, at this time, the mobile phone displays the first page, so that the user can view the target video played on the first page in full screen.
Step 205: when the triggering operation of the external video floating play function button is monitored, a second page to be displayed is determined, a Controller of the uppermost layer of the second page is obtained by using a UITabbar Controller in the UIviewcontroller, and a page source is recorded as the first page by using the UIviewcontroller.
Step 206: controlling baseWindow to be located at the uppermost layer of the second page by using a Controller and a flowing Controller, and controlling the target video to be played on the AVPlayerLayer according to the available attribute of the AVPlayerLayer by using a UITabbar Controller.
Step 207: and executing animation conversion processing from the first page to the second page according to the pre-constructed TransitionAnimation by using a UINavgationcontroller in the UIviewcontroller so as to display the second page.
At this time, the mobile phone displays the second page, and a floating window for playing the target video exists on the second page, so that the user can view the second page and watch the target video continuously through the floating window.
Step 208: when the target video is played in a floating mode, when the external trigger operation aiming at a preset button for exiting the floating play function is monitored, the recorded first page is obtained from the UIviewcontroller by using the floating controller and is transmitted to the UINavgationcontroller.
Assuming that the user finishes viewing the second page at this time, the target video is expected to be played in a full screen mode, so that the small-screen floating playing mode can be exited.
Step 209: and controlling the displayed page to be switched from the second page to the first page by using the UINavgationcontroller.
At this time, the mobile phone displays the first page again, so that the user can watch the target video played on the first page.
As shown in fig. 3, an embodiment of the present invention provides an iOS system-based video floating playback apparatus, including:
a determining unit 301, configured to determine a constructed flowingviewmodel, where an available attribute of AVPlayerLayer is set in the flowingviewmodel; transmitting the FloatingViewModel to a UIviewController extended with a floating window showing function; determining a flowing controller constructed with a baseWindow and a baseView, wherein the display permission of the baseWindow is the highest display permission, the baseView is placed above the baseWindow, and the AVPlayerLayer is placed above the baseView;
the display unit 302 is configured to display a first page, where the first page may support playing of a target video, and a video floating playing function button is arranged in the first page; displaying the second page;
the processing unit 303 is configured to determine the second page to be displayed when it is monitored that an external trigger operation is performed on the video floating play function button, and acquire a Controller of an uppermost layer of the second page by using a uitabbbar Controller in the UIviewController; controlling the baseWindow to be located at the uppermost layer of the second page by using the Controller and the flowing Controller, and controlling the target video to be played on the AVPlayerLayer according to the available attribute of the AVPlayerLayer by using the UITabbar Controller; and controlling the page displayed by the display unit 302 to be switched from the first page to the second page by using a UINavgationcontroller in the UIviewcontroller.
In an embodiment of the present invention, the processing unit 303 is configured to perform an animation conversion process from the first page to the second page according to a pre-constructed TransitionAnimation, so as to control the presentation unit 302 to present the second page.
In an embodiment of the present invention, the flowingviewmodel is further provided with an available attribute of a page source;
the processing unit 303 is further configured to record the page source as the first page by using the UIviewController after monitoring that an external trigger operation is performed on the video floating play function button; when the display unit 302 is controlled to float and play the target video and the external trigger operation for exiting a float play function button is monitored, the floating controller is utilized to acquire the recorded first page from the UIviewcontroller and transmit the first page to the UINavgationcontroller; and controlling the page displayed by the display unit 302 to be switched to the first page by using the UINavgationcontroller.
In an embodiment of the present invention, any one or more of an available attribute of a floating window size, an available attribute of a floating window position, and an available attribute of a floating window switching speed are further set in the floating viewmodel.
Because the information interaction, execution process, and other contents between the units in the device are based on the same concept as the method embodiment of the present invention, specific contents may refer to the description in the method embodiment of the present invention, and are not described herein again.
In addition, an embodiment of the present invention further provides a readable medium, which includes an execution instruction, and when a processor of a storage controller executes the execution instruction, the storage controller executes any one of the iOS system based video floating playing methods described above.
In addition, an embodiment of the present invention further provides a memory controller, including: a processor, a memory, and a bus;
the storage is used for storing an execution instruction, the processor is connected with the storage through the bus, and when the storage controller runs, the processor executes the execution instruction stored in the storage, so that the storage controller executes any one of the above video floating playing methods based on the iOS system.
In summary, the embodiments of the present invention have at least the following advantages:
1. in the embodiment of the invention, the suspension view model with the available attributes of the AVPlayerLayer is transferred to the view controller with the expanded suspension window display function; determining a floating controller constructed with a dedicated window and a dedicated view above the dedicated window with the highest display right and below the AVPlayerLayer; displaying a first page supporting target video playing; determining a second page when external request is carried out for suspension play, and acquiring a controller at the uppermost layer of the second page by using a column controller; controlling the special window to be positioned at the uppermost layer of the second page by using the controller and the suspension controller; controlling the target video to be played on the AVPlayerLayer by utilizing a column controller according to the available attributes; and switching the displayed page into a second page by utilizing the navigation controller. The embodiment of the invention can improve the video playing effect.
2. In the embodiment of the invention, all data in the APP can be browsed on the premise of video playing, so that the user experience is greatly improved, and the user can freely operate the whole APP and cannot freely experience the whole APP without being limited by a video playing scope.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a" does not exclude the presence of other similar elements in a process, method, article, or apparatus that comprises the element.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it is to be noted that: the above description is only a preferred embodiment of the present invention, and is only used to illustrate the technical solutions of the present invention, and not to limit the protection scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.