Intelligent set top box and browser analysis method
By presetting the parsing mechanism of the MediaPlayer.js file and JS engine module in the smart set-top box, the problem of low development efficiency of interactive Internet TV browsers and difficulty in adjusting the MediaPayer class when parsing javascript statements is solved, achieving rapid adaptation and high efficiency. Playback controls.
Patent Information
- Application Number
- CN202310157734.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2024-08-23
AI Technical Summary
Existing interactive Internet TV set-top box browsers require frequent compilation and debugging when parsing JavaScript statements, which results in a long development and adaptation process and makes it difficult to quickly adjust the specific implementation of the MediaPayer class.
Preset the MediaPlayer.js file in the smart set-top box, receive and parse the network loading page sent by the server through the JS engine module, use the standard function implementation module and the local extension module to parse the statements respectively, realize player control, and when it is necessary to adjust the MediaPayer class , just update the MediaPlayer.js file and restart the browser to avoid changing the browser module code.
It reduces compilation and debugging time, improves the speed of docking adaptation and problem solving, and simplifies the function adjustment process of the MediaPayer class.
Smart Images

Figure CN118540549A
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a smart set-top box and a browser parsing method. Background Art
[0002] Interactive Internet TV uses computers or set-top boxes and TVs to receive video-on-demand programs, video broadcasts, and surf the Internet. Interactive Internet TV can adapt well to the trend of today's rapid Internet development, fully and effectively utilize network resources, and has good interactivity. It is being widely used in operator networks.
[0003] Interactive network TV products generally use a server-browser architecture, that is, operators and servers deploy page content, and the browser integrated in the set-top box is responsible for displaying the page.
[0004] The set-top box browser is responsible for parsing the HTML / CSS and JavaScript statements in the page. HTML / CSS is used for content display, and JavaScript statements are used to perform key processing, page switching, playback control, etc. Summary of the invention
[0005] The present application provides a smart set-top box and a browser parsing method to achieve normal display of a video window in a web page.
[0006] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:
[0007] On the one hand, the embodiment of the present application discloses a smart set-top box, including: a memory, a built-in MediaPlayer.js file, the constructor in the MediaPlayer.js file calls the constructor of the HsMediaPlayer class; the method in the HsMediaPlayer class is used for playback control, calling the player to implement playback control;
[0008] Player, used to control playback behavior;
[0009] A resource loading module, configured to receive page information sent by a server, read the MediaPlayer.js file and inject the MediaPlayer.js file into the page information to generate a page to be parsed;
[0010] The JS parsing module receives the page to be parsed, and parses the page to be parsed to achieve playback control of the player.
[0011] On the other hand, an embodiment of the present application discloses a browser parsing method, including: receiving a network loading page sent by a server, and sending the network loading page to a JS engine module;
[0012] Read and inject the preset MediaPlayer.js file into the network loading page of the JS engine module to generate a page to be parsed, wherein the preset MediaPlayer.js file is set inside the set-top box;
[0013] The JS engine module parses the page to be parsed. The standard function implementation module contains the implementation corresponding to the statement to be parsed. The standard function implementation module is used to parse the statement with parsing.
[0014] There is no implementation corresponding to the statement to be parsed in the standard function implementation module, but there is an implementation corresponding to the statement to be parsed in the local extension module. The statement to be parsed is parsed using the local extension module.
[0015] Beneficial effects of this application:
[0016] The present application discloses a smart set-top box and a browser parsing method, which receives a network loading page sent by a server through a preset MediaPlayer.js file in a system file, and sends the network loading page to a JS engine module. The preset MediaPlayer.js file in the system file is read and injected into the network loading page of the JS engine module to generate a page to be parsed. The JS engine module parses the page to be parsed and determines whether there is an implementation corresponding to the statement to be parsed in the standard function implementation module. If it exists, the parsed statement is parsed using the standard function implementation module. If it does not exist, it is determined whether there is an implementation corresponding to the statement to be parsed in the local extension module. If it exists, the statement to be parsed is parsed using the local extension module. When the specific implementation of the MediaPayer class is adjusted or expanded due to demand adjustment, it is only necessary to adjust the logic of the JS code in MediaPlayer.js, update it to the set-top box file system file, and restart the browser to achieve the function adjustment. There is no need to change the code of the browser module, which reduces the compilation and debugging time and greatly improves the speed of docking adaptation and problem solving. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 is a schematic diagram of a usage scenario of a set-top box according to an embodiment;
[0019] Figure 2 A schematic diagram of a software layer of a smart set-top box shown in an embodiment of the present disclosure;
[0020] Figure 3 A schematic diagram of a browser structure shown in an embodiment of the present disclosure Figure 1 ;
[0021] Figure 4 A browser communication diagram shown in the embodiment of the present disclosure Figure 1 ;
[0022] Figure 5 A schematic diagram of a browser structure shown in an embodiment of the present disclosure Figure 2 ;
[0023] Figure 6 A browser communication diagram shown in the embodiment of the present disclosure Figure 2 ;
[0024] Figure 7 The present invention is a flowchart of a browser parsing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] To facilitate the explanation of the technical solution of the application, some concepts involved in the application are first explained below.
[0026] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0027] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0028] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0029] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0030] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0031] Figure 1 Schematic diagram of a usage scenario of a set-top box according to an embodiment. Figure 1 As shown, the set-top box 100 is a device that connects the display device 200 and the server 400. It can convert the compressed digital signal into TV content and display it on the display device.
[0032] The display device 200 performs data communication with the server 400 , and the user can operate the display device 200 through the smart device 300 or the control apparatus 500 .
[0033] In some embodiments, the control device 500 may be a remote controller, and the communication between the remote controller and the display device includes infrared protocol communication or Bluetooth protocol communication, and at least one of other short-range communication methods, to control the display device 200 wirelessly or wired. The user may control the display device 200 by inputting user commands through at least one of buttons on the remote controller, voice input, and control panel input.
[0034] In some embodiments, the smart device 300 may include any one of a mobile terminal, a tablet computer, a computer, a laptop computer, an AR / VR device, etc.
[0035] In some embodiments, the smart device 300 may also be used to control the display device 200. For example, the display device 200 is controlled using a Java layer of an application running on the smart device.
[0036] In some embodiments, the smart device 300 and the display device may also be used to communicate data.
[0037] In some embodiments, the display device 200 can also be controlled in a manner other than the control device 500 and the smart device 300. For example, the user's voice command control can be directly received through a module for obtaining voice commands configured inside the display device 200, or the user's voice command control can be received through a voice control device set outside the display device 200.
[0038] In some embodiments, the set-top box also carries out data communication with the server 400. The set-top box 100 can be allowed to communicate and connect via a local area network (LAN), a wireless local area network (WLAN) and other networks. The server 400 can provide various contents and interactions to the set-top box 100. The server 400 can be a cluster or a plurality of clusters, and can include one or more classes of servers.
[0039] In some embodiments, the software steps executed by a step execution subject can be migrated to another step execution subject in data communication with it as needed for execution. Exemplarily, the software steps executed by a server can be migrated to a display device in data communication with it as needed for execution, and vice versa.
[0040] The control device 500 can also be connected to the set-top box 100 for communication. Usually, the control device and the set-top box communicate via an infrared protocol, and the set-top box receives the communication signal from the control device to complete the user's remote control operation.
[0041] The set-top box 100 may be externally disposed on the outside of a housing of the display device, or may be built inside the display device.
[0042] In interactive network TV software, the player and browser work independently, and only the player status is transmitted through the message channel.
[0043] Figure 2 A schematic diagram of the software layer of a smart set-top box shown in an embodiment of the present disclosure, as shown in the figure, shows an intelligent set-top box, which is provided with a browser and a player. The browser receives web page data sent by an external server and parses the web page data. The js statement to be parsed is submitted to the js engine module for parsing. The js statement contains playback-related functions, which will eventually be called to the player for playback through the js extension solution.
[0044] The player encapsulates the set-top box browser's ability to play live, on-demand, instant time-shift, playback, music and other media content, and abstracts its basic playback behavior into player-related methods to implement operations such as play, fast forward, jump, pause, and stop.
[0045] When the browser parses the web page data, it parses the HTML / CSS statements and the JavaScript statements. Because the JavaScript statements in the web page data sent by different servers are different, in order to adapt to different JavaScript statements, the corresponding js extension statements of the application Java layer are different, and the browser needs to be recompiled, which consumes a lot of work in the debugging and development stages.
[0046] Figure 3 A schematic diagram of a browser structure shown in an embodiment of the present disclosure Figure 1 . Figure 4 A browser communication diagram shown in the embodiment of the present disclosure Figure 1 .like Figure 3 and Figure 4 As shown, the browser structure includes: a memory, a resource loading module and a JS engine module. The resource loading module is used to load network resources, and the JS engine module is used to parse the loaded network resources. The memory has a built-in MediaPlayer.js file, and the resource loading module is also connected to the memory to read and inject the MediaPlayer.js file into the network resources.
[0047] Figure 5 A schematic diagram of a browser structure shown in an embodiment of the present disclosure Figure 2 . Figure 6 A browser communication diagram shown in the embodiment of the present disclosure Figure 2 .like Figure 5 and Figure 6 As shown, the JS engine module includes a standard function implementation module and a local extension module. The resource loading module includes a network loading interface and a local injection interface. The resource loading module is used to load resource files and send the loaded resource files to the JS engine module, and the JS engine module parses the resource files. The network loading interface is connected to the server and is configured to receive page information sent by the server. The JS engine module parses the web page information, calls the relevant implementation method, and displays the page information.
[0048] In some embodiments, the page information sent by the server includes the page and the designated connection corresponding to the page, which is defined as a network loading page.
[0049] The local injection interface is connected to the set-top box memory, in which the MediaPlayer.js file is preset, and the local injection interface reads the MediaPlayer.js file and injects the file into the JS engine module. The newly created HsMediaPlayer class is called in the MediaPlayer.js file.
[0050] When MediaPlayer.js is injected into the browser parsing module, it will automatically reload the MediaPlayer.js before each page is parsed by the browser module. This way, the file is injected in advance after each page is loaded. In this way, when the browser JS engine module executes the mediaplayer class and function, it will first search and parse the MediaPlayer class from the injected MediaPlayer.js file and execute it. This automatic injection method is used to implement JS extension.
[0051] For example, by adding the executeMpJavaScript method to the DidCommitNavigationInternal function in render_frame_host_impl.cc, DidCommitNavigationInternal will be executed after each page is loaded successfully.
[0052] The implementation of the excuteMpJavaScript method refers to the excuteJavaScript method of the original JS injection of the browser. However, in order to improve the injection efficiency, the mediaplayer.js file is first imported into the specified memory variable when the browser is initialized. When excuteMpJavaScript is executed, it is read from the memory variable and injected into the browser module.
[0053] The MediaPlayer.js file can be preset to the / data / iptv / directory of the set-top box file system. When the browser starts, the local injection interface actively reads and calls the modified JS injection method to inject it into the JS engine module when each page is loaded. After this step, after any page is loaded, the browser's JS engine can already recognize the MediaPlayer class and method.
[0054] The MediaPlayer.js file is a file described by JS syntax, which is used for logical control of playback. The MediaPlayer.js file includes: function constructor and prototype implementation method. The function constructor is used in the MediaPlayer.js file to create the MediaPlayer class. The constructor in MediaPlayer.js calls the constructor of the HsMediaPlayer class. Each method of the class is implemented using the prototype method of the function. The prototype method finally calls the method in the HsMediaPlayer class to realize the actual control of the player.
[0055] For example, the function constructor is as follows:
[0056] function MediaPlayer(){ / / The function constructor in js syntax is equivalent to supporting the MediaPlayer class
[0057] this.media = new HsMediaPlayer (arguments [0]); / / Call the instance creation function of the hsmediaplayer that has implemented the js extension in the browser
[0058] };
[0059] The method implementation in MediaPlayer is as follows:
[0060] MediaPlayer.prototype.joinChannel=function(userChannelID){
[0061] var url = GetUrlFromEID (userChannelID); / / js code implements the parsing of program ID to program URL, this part may be adjusted as needed
[0062] return this.media.Playfromurl(url); / / Call the Playfromurl method of the HsMediaPlayer class that has implemented the js extension in the browser.
[0063] };
[0064] The implementation method in the HsMediaPlayer class is to complete a HsMediaPlayer.cpp.idl file and a HsMediaPlayer.cpp. The playback control method in HsMediaPlayer.cpp calls the player service interface to ultimately communicate and call the IPTV player module to achieve playback control.
[0065] For example, the MediaPlayer class originally had joinchannel(channelid) and setSingleMedia(mediaurl). Both methods are used to play programs, one by specifying the program number and the other by assembling the mediaurl address. In the new abstract class HsMediaPlayer, only one play method playfromurl(url,starttime) is defined to play the program according to the input final url and play time. In the Hs.MediaPlayer.Playfromurl(url,starttime) method, the play interface provided by the player service is finally called to implement the player's play.
[0066] The JS engine module includes a standard function implementation module and a local extension module. The standard function implementation module implements the parsing of HTML / CSS statements; the local extension module is used to implement the local extension of the injected MediaPlayer.js file. The local extension module contains HsMediaPlayer.cpp, which is the implementation method of the HsMediaPlayer class.
[0067] In some embodiments, the browser structure includes: a resource loading module and a JS engine module, wherein the JS engine module includes a standard function implementation module and a local extension module. The resource loading module includes a network loading interface and a local injection interface. The resource loading module is used to load resource files and send the loaded resource files to the JS engine module, and the JS engine module parses the resource files.
[0068] The network loading interface receives the network loading page sent by the server and sends the network loading page to the JS engine module; the local injection interface is connected to the set-top box storage, reads the MediaPlayer.js file and injects the file into the network loading page of the JS engine module to generate a page to be parsed. The JS engine module parses the page to be parsed. When the standard function implementation module has an implementation corresponding to the statement to be parsed, the standard function implementation module is used to parse the statement to be parsed; when the standard function implementation module does not have an implementation corresponding to the statement to be parsed, and the local extension module has an implementation corresponding to the statement to be parsed, the local extension module is used to parse the statement to be parsed.
[0069] Injecting the MediaPlayer.js file into the JS engine module includes: using the function constructor to create a new MediaPlayer class, defined as the HsMediaPlayer class. The methods in the HsMediaPlayer class are used for basic playback control, calling the player's playback interface, and implementing the player's playback.
[0070] In the browser provided by the present disclosure, when the MediaPlayer class is created in the JS code of the page and the method of the MediaPlayer class is called, the JS engine will first find the MediaPlayer.js injected in advance to implement this method, and will create the MediaPlayer class and execute the method defined in MediaPlayer.js according to the logic in MediaPlayer.js. Finally, the HsMediaPlayer class of the browser JS extension is called, and HsMediaPlayer finally interacts with the player module to achieve playback.
[0071] When you want to adjust the specific implementation of the MediaPayer class due to demand adjustment or expansion, you only need to adjust the logic of the JS code in MediaPlayer.js, update it to the / data / iptv directory of the set-top box file system, and restart the browser to adjust the function. There is no need to change the code of the browser module, which reduces compilation and debugging time and greatly improves the speed of docking adaptation and problem solving.
[0072] Figure 7A browser parsing method process diagram shown in the embodiment of the present disclosure Figure 1 .like Figure 7 In some embodiments of the present disclosure, a browser parsing method is provided, including:
[0073] S100: receiving a network loading page sent by a server, and sending the network loading page to a JS engine module.
[0074] S200: Read the preset MediaPlayer.js file in the system file and inject it into the network loading page of the JS engine module to generate a page to be parsed.
[0075] S300: The JS engine module parses the page to be parsed and determines whether there is an implementation corresponding to the statement to be parsed in the standard function implementation module;
[0076] If it exists, the module is used to parse the parsed statement using the standard function implementation;
[0077] If it does not exist, jump to S400;
[0078] S400: Determine whether there is an implementation corresponding to the statement to be parsed in the local extension module. If so, parse the statement to be parsed using the local extension module.
[0079] In some embodiments, the preset MediaPlayer.js file in the system file is read and injected into the JS engine module, and a new MediaPlayer class is created using the function constructor, which is defined as the HsMediaPlayer class. The methods in the HsMediaPlayer class are used for basic playback control, calling the playback interface of the player to implement the playback of the player.
[0080] After MediaPlayer.js is injected into the browser parsing module, it will automatically reload this MediaPlayer.js before each page is parsed by the browser module. In this way, this file is injected in advance after each page is loaded. In this way, when the browser js engine executes the mediaplayer class and function, it will first search and parse the MediaPlayer class from the injected js and execute it. This automatic injection method is used to implement js extension.
[0081] In some embodiments, the preset MediaPlayer.js file in the system file is read and injected into the network loading page of the JS engine module to generate a page to be parsed, including: creating an HsMediaPlayer class, the methods in the HsMediaPlayer class are used for basic playback control, calling the player's playback interface, and realizing the player's playback.
[0082] The present disclosure provides a browser parsing method, which receives a network loading page sent by a server through a preset MediaPlayer.js file in a system file, and sends the network loading page to a JS engine module. The preset MediaPlayer.js file in the system file is read and injected into the network loading page of the JS engine module to generate a page to be parsed. The JS engine module parses the page to be parsed and determines whether there is an implementation corresponding to the statement to be parsed in the standard function implementation module. If so, the parsed statement is parsed using the standard function implementation module. If not, it is determined whether there is an implementation corresponding to the statement to be parsed in the local extension module. If so, the statement to be parsed is parsed using the local extension module.
[0083] The MediaPlayer.js file is read and injected into the JS engine module, and a new MediaPlayer class is created using the function constructor, which is defined as the HsMediaPlayer class. The methods in the HsMediaPlayer class are used for basic playback control, calling the player's playback interface to implement the player's playback.
[0084] When creating the MediaPlayer class in the JS code of the page and calling the methods of the MediaPlayer class, the JS engine will first find the MediaPlayer.js file injected in advance to implement this method, and will create the MediaPlayer class and execute the methods defined in MediaPlayer.js according to the logic in MediaPlayer.js. Finally, the HsMediaPlayer class of the browser JS extension is called, and HsMediaPlayer finally interacts with the player module to achieve playback.
[0085] Since the above embodiments are all described by citing and combining with other embodiments, different embodiments have the same parts, and the same and similar parts between the embodiments in this specification can be referred to each other. No further detailed description is given here.
[0086] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the disclosure of the present application. The present application is intended to cover any variation, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the content of the claims.
[0087] The above-described embodiments of the present application do not constitute a limitation on the protection scope of the present application.
Claims
1. A smart set-top box, It is characterized in that include: A memory, with a built-in MediaPlayer.js file, wherein the constructor in the MediaPlayer.js file calls the constructor of the HsMediaPlayer class; the method in the HsMediaPlayer class is used for playback control, and the player is called to implement playback control; Player, used to control playback behavior; A resource loading module is configured to receive page information sent by a server, read the MediaPlayer.js file and inject the MediaPlayer.js file into the page information to generate a page to be parsed; The JS parsing module receives the page to be parsed, and parses the page to be parsed to achieve playback control of the player.
2. The smart set-top box according to claim 1, It is characterized in that The resource loading module includes: a network loading interface and a local injection interface; The network loading interface is connected to the server and receives the page information sent by the server; The local injection interface is connected to the memory, and the local injection interface is configured to read the MediaPlayer.js file and inject the MediaPlayer.js file into the page information to generate a page to be parsed.
3. The smart set-top box according to claim 1, It is characterized in that The JS engine module includes: a standard function implementation module and a local extension module; The local extension module is configured to: when the corresponding implementation of the statement to be parsed in the page to be parsed does not exist in the standard function implementation module, locally expand and parse the statement to be parsed.
4. The smart set-top box according to claim 1, It is characterized in that The MediaPlayer.js file is a MediaPlayer.js class expressed in js syntax.
5. The smart set-top box according to claim 1, It is characterized in that In the MediaPlayer.js file: the function constructor is used to create the MediaPlayer class, and the constructor in MediaPlayer.js calls the constructor of the HsMediaPlayer class.
6. The smart set-top box according to claim 3, It is characterized in that The locally extending the statement to be parsed includes: using a standard js extension solution to implement an HsMediaPlayer.cpp.idl file and an HsMediaPlayer.cpp corresponding to the statement to be parsed.
7. A browser parsing method, It is characterized in that include: Receive the network loading page sent by the server, and send the network loading page to the JS engine module; Read and inject the preset MediaPlayer.js file into the network loading page of the JS engine module to generate a page to be parsed, wherein the preset MediaPlayer.js file is set inside the set-top box; The JS engine module parses the page to be parsed. The standard function implementation module contains the implementation corresponding to the statement to be parsed. The standard function implementation module is used to parse the statement with parsing. There is no implementation corresponding to the statement to be parsed in the standard function implementation module, but there is an implementation corresponding to the statement to be parsed in the local extension module. The statement to be parsed is parsed using the local extension module.
8. The browser parsing method according to claim 7, It is characterized in that The preset MediaPlayer.js file is a MediaPlayer.js class expressed in js syntax.
9. The browser parsing method according to claim 7, It is characterized in that The method of reading and injecting the preset MediaPlayer.js file into the network loading page of the JS engine module includes: creating an HsMediaPlayer class, the methods in the HsMediaPlayer class are used for playback control, calling the playback interface of the player, and realizing the playback of the player.
