Disclosure of Invention
The application provides a method and a device for automatically correcting a player state by a browser and display equipment, and aims to solve the problem of low efficiency caused by independent test development when various markets suffer from the problems because a player cannot be automatically stopped when the current page is switched.
In order to solve the technical problem, the embodiment of the application discloses the following technical scheme:
in a first aspect, an embodiment of the present application discloses a method for automatically correcting a player status by a browser, where the method includes:
when the browser switches the page, judging whether a player exists in the current page;
if the player exists in the current page, the browser informs the player to stop playing through an interprocess communication channel;
and if the player does not exist in the current page, the browser determines whether to stop the player according to the characteristics of the played program and the boundary characteristics of the switched page.
In a second aspect, an embodiment of the present application discloses an apparatus for automatically modifying a player status by a browser, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to:
when the browser switches the page, judging whether a player exists in the current page;
if the player exists in the current page, the browser informs the player to stop playing through an inter-process communication channel;
and if the player does not exist in the current page, the browser determines whether to stop the player according to the characteristics of the played program and the boundary characteristics of the switched page.
In a third aspect, an embodiment of the present application discloses a display device, which includes the apparatus for automatically modifying a player status by a browser according to the second aspect.
Compared with the prior art, the beneficial effect of this application is:
according to the method for automatically correcting the state of the player by the browser, whether the player exists in the current page or not is judged when the browser switches the page, when the player exists in the current page, the current page is destroyed when the page is switched, and under the condition, the browser informs the player to stop playing through the interprocess communication channel, so that the situation that the player still plays in a background after the page is switched is avoided; when the current page does not have the player, the page where the player is located cannot be destroyed when the page is switched, and in this case, the browser determines whether to stop the player according to the characteristics of the playing program and the boundary characteristics of the switched page. The browser determines whether to send the stop instruction to the player or not by judging whether the player exists in the current page or not so as to automatically stop the player, does not need to contact the head end to modify the page during testing, or independently set the stop of the player according to the condition of each page, can realize the function of automatically stopping the player during page switching, and avoids the problem of low efficiency caused by independent test and development when various markets encounter the problems.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, 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 only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort shall fall within the protection scope of the present application.
IPTV products generally use a B/S (server-side-browser) architecture, that is, an operator deploys broadcast content and browsing content, issues html files via a network, and an integrated browser at a set-top box is responsible for receiving a display page.
The browser finally displays each frame pattern on the screen, and the pattern can be completely realized by the description of one html file or the effect of the combination of a plurality of html files. The html implementation functions are different, and can be only used for displaying contents (described by html language and css grammar in html files), or only used for executing specific functions (described by javascript embedded in html files), or can be simultaneously completed, and usually, presentation and function implementation of one frame pattern are completed by cooperation of a plurality of html files. The browser is responsible for analyzing each html, the part needing to be displayed is subjected to rendering/layout/synthesis and other final display, and javascript (js) statements needing to be executed are analyzed and executed through the browser so as to complete various functions. As shown in fig. 1, a server issues multiple pages (e.g., 1.html, 2.html, and 3.html), a browser parses html and css to predict completion of screen display, parses javascript statements to complete various functions, and sometimes needs other modules such as a player to complete the whole function together.
In order to transmit high-quality video to users more efficiently, IPTV uses a dedicated network (different from the world wide web) to play a video stream in a special format. A series of js interfaces which complete the playing function in the page are defined and expanded for the domestic IPTV industry, after the js expansion is completed by a browser in the set top box, the js interfaces of the related players are executed when the webpage is analyzed, the js interfaces are called to a playing module in the set top box for playing through an interprocess communication mechanism, and various format code streams deployed at the IPTV head end are played smoothly. The extended js interface related to the player mainly has functional interfaces for creating, starting, stopping, fast forwarding and fast rewinding, and the like, and the architecture diagram of the IPTV browser calling the player to play the code stream through js extension is shown in fig. 2.
When the browser presents content switching, a certain html is actually switched to another html usually through a standard repositioning js method, and the browser releases an old page and reloads a new page. However, as can be seen from the above description, when an html currently in use is switched, the display content of the screen may be changed, or only some functions may be changed, and the display content is not adjusted.
Thus, when the browser displays content, a problem often faces: for example, a program is played by creating and starting a player in page a through the JS function extended by the IPTV specification, but when the user switches to page B, the program of page a after page B is still played in the background because page a or page B does not stop the player. There may be several situations when the player is not stopped:
the first condition is as follows: and the display content switching is that when the A.html is transferred to another html through a repositioning method, the player is not actively stopped through js statements.
Case two: html is responsible for creating the player, B.html is responsible for starting playing and displaying, and the displayed content switching is realized by the repositioning method of B.html, and the player is not actively stopped by js statements.
And a third situation: html is responsible for creating the player, B.html is responsible for playing, C.html is responsible for displaying, and the displayed content switching is realized by the C.html through a repositioning method, and the player is not actively stopped through js statements.
In order to solve the above problems, embodiments of the present application provide a method for automatically correcting a player state by a browser, where the method determines how to stop a player by detecting whether the player exists in a page before switching, so that a function of automatically stopping the player during page switching can be implemented, and a problem of low efficiency caused by independent test development when various markets encounter such problems is avoided.
As shown in fig. 3, a method for automatically modifying a player status by a browser according to an embodiment of the present application includes:
s100: when the browser switches the page, whether the player exists in the current page is judged.
When the browser switches the page, if the current page is responsible for creating the player or starting the player, if the situation one and the situation two exist, the current page is destroyed when the current page is switched in a repositioning mode, so that the switched page is reloaded; if the current page is only responsible for displaying the content, if the current page is subjected to relocation switching, the page where the player is located cannot be destroyed. Therefore, when the browser switches pages, whether a player exists in the current page or not needs to be judged, and if the player exists in the current page, S200 is executed; if the player does not exist in the current page, S300 is executed.
The specific method for determining whether the player exists in the current page may be:
after the browser receives and analyzes the html page, a document data structure is formed in the browser, various information after html analysis is recorded in the document data structure, and if a player is created through a js function in the page and the player is started through the js function, a new mark can be created in the document data structure to indicate that the js function for creating the player or the js function for starting the player exists in the current page. Then, when the browser switches the page, whether a document data structure in the browser contains the created new mark or not can be judged, and if the document data structure contains the created new mark, the current page is responsible for creating a player or starting the player; if the document data structure does not contain the created new mark, the current page is not responsible for creating the player and starting the player, and is only responsible for displaying the content.
In addition to creating a new mark in the document data structure to illustrate the presence of a player in a page, the present example may also be illustrated in other ways, as long as the presence of a player in a page can be proved, which all belong to the protection scope of the embodiments of the present application.
S200: if the player exists in the current page, the browser informs the player to stop playing through the interprocess communication channel.
If the current page has a js function for creating the player or a js function for starting the player, when the html page is switched to another page through relocation, the document data structure of the browser internal assembly is destroyed first, and the data structure is reassembled according to the new page, namely the html is destroyed. Therefore, when the document data structure is destroyed, whether the data structure contains the created new mark is judged, and if the data structure contains the created new mark, the player is informed to stop playing through a channel of interprocess communication. Namely, the browser sends a playing stopping instruction to the player through the interprocess communication channel, and the player automatically stops playing after receiving the playing stopping instruction, so that the function of automatically stopping the player by page switching and summarizing is realized.
S300: if the player does not exist in the current page, the browser determines whether to stop the player according to the characteristics of the played program and the boundary characteristics of the switched page.
If the js function for creating the player or the js function for starting the player does not exist in the current page, it is indicated that the current page is only responsible for displaying the content, a determination process needs to be performed to determine whether to stop the player according to the summary of the experience of the docking market, and the specific determination process is shown in fig. 4:
s301: and judging whether the playing code stream is only audio data or not when the player is still playing after the page is switched.
If the player still plays after the page is switched, the player may play video or audio, and therefore it is necessary to determine whether the data played by the player is audio data or not. If there is no video data to decode, but a sound is played, such a scene is usually background music played on some pages, in which case S305 is executed; if there is video data to decode, the data played by the player is video data, and S302 is executed.
S302: and if the playing code stream is not only audio data, judging whether the page transparency is set after switching.
When the data played by the player is video data, whether the transparency of the displayed content is set by the switched page through the js function needs to be judged again. If the transparency is set for the display content, the display content is usually displayed in a scene where the play content matches the page content with translucency, that is, the current page and the switched page can be displayed simultaneously, and then S305 is executed; if the page transparency is not set to the switched page, S303 is performed.
S303: and if the page transparency is not set in the switched page, judging whether the display content of the switched page reaches the preset value of the screen.
When the data played by the player is video data and the page transparency is not set in the switched page, the boundary characteristics of the switched page need to be detected, that is, the rendered result is analyzed by the browser, and whether the sizes of all the displayed contents of the switched page reach the preset value of the actual screen or not is judged. If the sizes of all the displayed contents do not reach the preset value of the actual screen, the scene is usually the situation that the played contents are matched with simple menu prompts, namely, a webpage popup is displayed on a page where the player is located, and then S305 is executed; if all the sizes of the display contents exceed the preset value of the actual screen, the browser determines that the player is not stopped at this time, and S304 is executed. In this example, the preset value may be 3/4.
S304: and if the display content of the switched page reaches the preset value of the screen, informing the player to stop playing through the interprocess communication channel.
When the data played by the player is video data, the page transparency is not set after switching, and the display content of the page after switching reaches the preset value of the screen, which indicates that the player does not stop at this time, a notification is sent to the player through the channel of the interprocess communication to stop the playing operation. Namely, the browser sends a playing stopping instruction to the player through the interprocess communication channel, and the player automatically stops playing after receiving the playing stopping instruction, so that the function of automatically stopping the player by page switching and summarizing is realized.
S305: the player is not subjected to stop processing.
When the page is switched, the player plays only audio data, and such a scene is usually some background music played by the page, and the browser does not send a notification to stop the player.
When the page transparency is set after switching, in such a scenario, the playing content is usually displayed in cooperation with the page content with translucency, and at this time, the browser does not send a notification to stop the player.
When the display content of the switched page does not reach the preset value of the screen, the scene is usually the situation that the playing content is matched with simple menu prompt, and at the moment, the browser does not inform the player to stop.
The method for automatically correcting the state of the player by the browser provided by the embodiment of the application marks the page information of the player, monitors the destruction information of the page, and sends a notice to stop playing when the original page is destroyed when the page is switched; aiming at the situation that some pages are switched but the original pages are not destroyed, whether the player is stopped or not is determined according to the characteristics of the played program and the boundary characteristics of the switched pages, so that the function of automatically stopping the player in page switching is realized, and the problem of low efficiency caused by independent test and development when various markets encounter the problems is solved.
Based on the method for automatically correcting the player state by the browser in the embodiment, the embodiment of the application further provides a device for automatically correcting the player state by the browser.
The device for automatically correcting the state of the player by the browser provided by the embodiment of the application comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
when the browser switches the page, judging whether a player exists in the current page;
if the player exists in the current page, the browser informs the player to stop playing through the interprocess communication channel;
if the player does not exist in the current page, the browser determines whether to stop the player according to the characteristics of the played program and the boundary characteristics of the switched page.
The device for automatically correcting the state of the player by the browser, provided by the embodiment of the application, judges whether the player exists in the current page when the browser switches the page, if the player exists, namely the current page is responsible for creating the player or starting the player, and when the current page is relocated and switched, if the player is not stopped through js, the browser notifies the player to stop the player through an interprocess communication channel so as to realize the function of automatically stopping the player after the page is switched; if the current page does not have the player, namely the current page is only responsible for displaying content, judging whether data played by the player only has audio data or not according to market experience, if the data played by the player only has the audio data, the browser does not send a notice to stop the player, if the data played by the player has the video data, judging whether the page transparency is set on the switched page or not, if the page transparency is set on the switched page, the browser does not send a notice to stop the player, if the page transparency is not set on the switched page, judging whether the displayed content of the switched page reaches the preset value of the screen or not, if the displayed content of the switched page does not reach the preset value of the screen, the browser does not send a notice to stop the player, and if the displayed content of the switched page reaches the preset value of the screen, the browser informs the player to stop playing through an interprocess communication channel. Therefore, the function of automatic stop of the player in page switching is realized, and the problem of low efficiency caused by independent test development when various markets encounter the problems is solved.
On the basis of the foregoing embodiment, an embodiment of the present application further provides a display device, as shown in fig. 5, where the display device includes the apparatus for automatically correcting a player state by a browser in the foregoing embodiment, and when the browser switches a page, the apparatus determines whether a player exists in a current page, marks destruction information of the page where the player is located, monitors destruction information of the page, and sends a notification to stop playing when the original page is destroyed when the page is switched; the method has the advantages that the page without the player is determined whether to stop the player or not according to the characteristics of the played program and the boundary characteristics of the switched page, so that the function of automatically stopping the player in page switching is realized, and the problem of low efficiency caused by independent test development when various markets encounter such problems is solved.
It should be noted that, in the present specification, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a circuit structure, 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 circuit structure, article, or apparatus. Without further limitation, the statement "comprises a" \8230; "8230;" defines an element and does not exclude the presence of additional like elements in circuit structures, articles, or devices comprising the element.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
The above-described embodiments of the present application do not limit the scope of the present application.