Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the application provides a player control hiding method and device.
In view of this, in a first aspect, the present application provides a player control hiding method for controlling a video playing interface played in a browser, where the method includes:
when detecting that a page requested by a user has a video tag, acquiring a preset control shielding script;
determining a player script corresponding to the video tag in the page;
generating a video playing interface corresponding to the video label on the page according to the player script, wherein a control is displayed on the video playing interface;
and generating a shielding layer on the video playing interface according to the preset control shielding script, wherein the position of the shielding layer is located at the top of the control of the video playing interface.
Optionally, the player script comprises a control script,
the method further comprises the following steps:
determining the position of the control script in the player script;
adding the preset control shielding script to a position, corresponding to the control script, in the player script;
and setting the priority of the preset control shielding script to be higher than the priority of the control script.
Optionally, the generating a blocking layer on the video playing interface according to the preset control blocking script includes:
searching a script related to the control in the player script;
when a plurality of scripts related to the control are available, selecting a preset control shielding script with a higher priority;
and rendering and generating a shielding layer on the video playing interface while generating the video playing interface corresponding to the video label.
Optionally, the method further comprises:
acquiring a setting state of the control shielding in the browser;
judging whether the setting state is a shielding state;
and when the setting state is a shielding state, executing the step of generating a shielding layer on the video playing interface according to the preset control shielding script.
In a second aspect, the present application further provides a player control hiding method, configured to control a video playing interface played in a browser, where the method includes:
when detecting that a page requested by a user has a video tag, acquiring a preset control shielding script;
determining a player script corresponding to the video tag in the page; the player script contains a control script,
determining the position of the control script in the player script;
deleting the control script from the player script;
adding the preset control shielding script to a position corresponding to the control script;
and generating a video playing interface corresponding to the video label on the page according to the modified player script, wherein no control is displayed on the video playing interface.
In a third aspect, the present application further provides a device for hiding a player control, configured to control a video playing interface played in a browser, where the device includes:
the script obtaining unit is used for obtaining a preset control shielding script when detecting that a page requested by a user has a video tag;
the determining unit is used for determining a player script corresponding to the video tag in the page;
the interface generating unit is used for generating a video playing interface corresponding to the video label on the page according to the player script, and a control is displayed on the video playing interface;
and the shielding layer generating unit is used for generating a shielding layer on the video playing interface according to the preset control shielding script, and the position of the shielding layer is located at the top of the control of the video playing interface.
Optionally, the player script comprises a control script,
the device further comprises:
the position determining subunit is used for determining the position of the control script in the player script;
the script injection subunit is used for adding the preset control shielding script to a position, corresponding to the control script, in the player script;
and the priority setting subunit is used for setting the priority of the preset control shielding script to be higher than the priority of the control script.
Optionally, the occlusion layer generating unit includes:
the script searching subunit is used for searching the script related to the control in the player script;
the script selecting subunit selects a preset control shielding script with higher priority when a plurality of scripts related to the control are available;
and the rendering subunit is used for generating a video playing interface corresponding to the video label and rendering and generating a shielding layer on the video playing interface.
Optionally, the apparatus further comprises:
the state acquisition unit is used for acquiring the setting state of the control shielding in the browser;
a state judgment unit for judging whether the setting state is a shielding state;
and the shielding layer generating unit is further used for executing the step of generating the shielding layer on the video playing interface according to the preset control shielding script when the setting state is the shielding state.
In a fourth aspect, the present application further provides a device for hiding a player control, configured to control a video playing interface played in a browser, where the device includes:
the script obtaining unit is used for obtaining a preset control shielding script when detecting that a page requested by a user has a video tag;
a script determining unit, configured to determine a player script corresponding to the video tag in the page; the player script contains a control script,
the position determining unit is used for determining the position of the control script in the player script;
a deleting unit, configured to delete the control script from the player script;
the adding unit is used for adding the preset control shielding script to a position corresponding to the control script;
and the interface generating unit is used for generating a video playing interface corresponding to the video label on the page according to the modified player script, and the control is not displayed on the video playing interface.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
according to the method provided by the embodiment of the application, when the situation that a page requested by a user has a video tag is detected, a preset control shielding script is obtained; determining a player script corresponding to the video tag in the page; generating a video playing interface corresponding to the video label on the page according to the player script, wherein a control is displayed on the video playing interface; and generating a shielding layer on the video playing interface according to the preset control shielding script, wherein the position of the shielding layer is located at the top of the control of the video playing interface.
In application, when some videos which do not need to be operated by a user are played, a pre-programmed preset control shielding script can be obtained before a video playing interface is generated in a page of a browser, then a player interface is generated by using the player script during rendering, and a shielding layer is generated on the video playing interface according to the preset control shielding script, so that a control on a player is shielded, namely the player interface does not display the control.
Therefore, when the user watches the video, the control in the video playing interface is invisible, so that the video cannot be controlled, the problem that the video playing is interrupted or other errors occur due to the fact that the control is touched by mistake is avoided, and the user experience effect is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a player control hiding method, which is used for controlling a video playing interface played in a browser. The method can be applied to intelligent terminals, such as: mobile phones, tablet computers, and the like.
Fig. 1 is a flowchart illustrating a player control hiding method according to an embodiment of the present application.
As shown in fig. 1, the method may include the following steps.
S101, when the fact that the page requested by the user has the video label is detected, acquiring a preset control shielding script.
The preset control shielding script is a script which is written by a developer of the browser in advance aiming at the current browser, and the logic of the script is that the control is not displayed on a video playing interface.
In the embodiment of the application, the preset control shielding script can be implanted into the local browser in advance, in addition, the preset control shielding script can also be located in a remote server of the browser, and when a user sets that the control needs to be shielded, namely, when the control shielding function is started, the preset control shielding script is downloaded from the remote server.
S102, determining a player script corresponding to the video tag in the page.
When a page with video is loaded, the code in the code segment of the page is multiple, wherein the code comprises a video tag and a player script corresponding to the video tag, and the player script is used for creating a player playing interface on the webpage when the webpage is loaded.
S103, generating a video playing interface corresponding to the video label on the page according to the player script.
After the script of the player is obtained, a video playing interface corresponding to the video tag can be generated on the page.
Generally, player scripts of different video websites are set individually, and styles of the player scripts are different, but in order to facilitate control, generally, controls are displayed on the video playing interface, and the controls may include: play/pause controls, fast forward/rewind controls, volume adjustment controls, brightness adjustment controls, and setup controls, etc., and for some websites, controls may also include pop-up controls, etc.
And S104, generating a shielding layer on the video playing interface according to the preset control shielding script, wherein the position of the shielding layer is located at the top of the control of the video playing interface.
After the video playing interface is generated, a shielding layer can be generated on the video playing interface according to a pre-written control shielding script.
According to the method provided by the embodiment of the application, when the situation that a page requested by a user has a video tag is detected, a preset control shielding script is obtained; determining a player script corresponding to the video tag in the page; generating a video playing interface corresponding to the video label on the page according to the player script, wherein a control is displayed on the video playing interface; and generating a shielding layer on the video playing interface according to the preset control shielding script, wherein the position of the shielding layer is located at the top of the control of the video playing interface.
In application, when some videos which do not need to be operated by a user are played, a pre-programmed preset control shielding script can be obtained before a video playing interface is generated in a page of a browser, then a player interface is generated by using the player script during rendering, and a shielding layer is generated on the video playing interface according to the preset control shielding script, so that a control on a player is shielded, namely the player interface does not display the control.
Therefore, when the user watches the video, the control in the video playing interface is invisible, so that the video cannot be controlled, the problem that the video playing is interrupted or other errors occur due to the fact that the control is touched by mistake is avoided, and the user experience effect is improved.
In one embodiment of the present application, a control script is included in the player script, and the method may further include the following steps.
And determining the position of the control script in the player script.
And adding the preset control shielding script to a position, corresponding to the control script, in the player script.
And setting the priority of the preset control shielding script to be higher than the priority of the control script.
In this embodiment of the present application, a preset control blocking script may be injected into a player script, and when a video playing interface is generated for rendering in a priority setting manner, only the preset control blocking script is read according to the priority level, so that the foregoing step S103 and step S104 may be performed simultaneously.
Therefore, on the basis of the foregoing embodiment, the foregoing step S104 may include the following steps.
Searching a script related to the control in the player script;
when a plurality of scripts related to the control are available, selecting a preset control shielding script with a higher priority;
and rendering and generating a shielding layer on the video playing interface while generating the video playing interface corresponding to the video label.
In another embodiment of the present application, the method may further include the following steps.
Acquiring a setting state of the control shielding in the browser;
judging whether the setting state is a shielding state;
and when the setting state is a shielding state, executing the step of generating a shielding layer on the video playing interface according to the preset control shielding script.
In the setting interface of the browser, a control shielding setting switch is provided, and further in this embodiment, the setting state of the control shielding can be obtained first, and the foregoing step S101 is performed only when the user selects to set the setting state to the shielding state, so as to obtain the preset control shielding script from the local server or from the remote server.
The application also provides a player control hiding method, which is used for controlling a video playing interface played in a browser, and the method comprises the following steps:
s201, when detecting that a page requested by a user has a video tag, acquiring a preset control shielding script;
s202, determining a player script corresponding to the video tag in the page; the player script contains a control script,
s203, determining the position of the control script in the player script;
s204, deleting the control script from the player script;
s205, adding the preset control shielding script to a position corresponding to the control script;
s206, generating a video playing interface corresponding to the video label on the page according to the modified player script, wherein no control is displayed on the video playing interface.
Compared with the embodiment shown in fig. 1, the method provided by the embodiment of the application replaces the control script in the player script in advance before the video playing interface is generated in the page, and replaces the original script control with the preset control shielding script, so that the control is directly shielded on the video playing interface while the video playing interface is subsequently generated, and the control is not displayed on the video playing interface.
The present application further provides a device for hiding a player control, configured to control a video playing interface played in a browser, as shown in fig. 2, the device includes:
the script obtaining unit 11 is configured to obtain a preset control blocking script when it is detected that a page requested by a user has a video tag;
a determining unit 12, configured to determine a player script corresponding to the video tag in the page;
an interface generating unit 13, configured to generate a video playing interface corresponding to the video tag on the page according to the player script, where a control is displayed on the video playing interface;
and the shielding layer generating unit 14 is configured to generate a shielding layer on the video playing interface according to the preset control shielding script, where the position of the shielding layer is located at the top of the control of the video playing interface.
In an embodiment of the present application, the player script includes a control script, and the apparatus further includes:
the position determining subunit is used for determining the position of the control script in the player script;
the script injection subunit is used for adding the preset control shielding script to a position, corresponding to the control script, in the player script;
and the priority setting subunit is used for setting the priority of the preset control shielding script to be higher than the priority of the control script.
In an embodiment of the present application, the occlusion layer generating unit includes:
the script searching subunit is used for searching the script related to the control in the player script;
the script selecting subunit selects a preset control shielding script with higher priority when a plurality of scripts related to the control are available;
and the rendering subunit is used for generating a video playing interface corresponding to the video label and rendering and generating a shielding layer on the video playing interface.
The present application further provides a device for hiding a player control, configured to control a video playing interface played in a browser, where the device includes:
the script obtaining unit is used for obtaining a preset control shielding script when detecting that a page requested by a user has a video tag;
a script determining unit, configured to determine a player script corresponding to the video tag in the page; the player script contains a control script,
the position determining unit is used for determining the position of the control script in the player script;
a deleting unit, configured to delete the control script from the player script;
the adding unit is used for adding the preset control shielding script to a position corresponding to the control script;
and the interface generating unit is used for generating a video playing interface corresponding to the video label on the page according to the modified player script, and the control is not displayed on the video playing interface.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in a plurality of software and/or hardware when implementing the invention.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for apparatus or system embodiments, since they are substantially similar to method embodiments, they are described in relative terms, as long as they are described in partial descriptions of method embodiments. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
It should be appreciated that the invention is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It is noted that, in this document, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.