CN112559121A - Processing method and system for JavaScript extension object of IPTV browser - Google Patents

Processing method and system for JavaScript extension object of IPTV browser Download PDF

Info

Publication number
CN112559121A
CN112559121A CN202011126874.3A CN202011126874A CN112559121A CN 112559121 A CN112559121 A CN 112559121A CN 202011126874 A CN202011126874 A CN 202011126874A CN 112559121 A CN112559121 A CN 112559121A
Authority
CN
China
Prior art keywords
local
javascript
localobject
web
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011126874.3A
Other languages
Chinese (zh)
Inventor
陈伟
黎明
彭鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Tianyi Comheart Telecom Co Ltd
Original Assignee
Sichuan Tianyi Comheart Telecom Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Tianyi Comheart Telecom Co Ltd filed Critical Sichuan Tianyi Comheart Telecom Co Ltd
Priority to CN202011126874.3A priority Critical patent/CN112559121A/en
Publication of CN112559121A publication Critical patent/CN112559121A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4782Web browsing, e.g. WebTV

Abstract

The invention discloses a processing method of a JavaScript extended object of an IPTV browser, which comprises the steps of entering a JavaScript object initialization module, locally injecting the JavaScript object into a JS module to realize the definition of a LocalObject prototype, intercepting a page through the shouldOververrudUrLoading of webview, and judging whether the current page contains the object and the method of the local extended object extension; if not, the page does not carry out any processing and jumps to the fourth step; if the Java object exists, injecting a local JavaScript injection object prototype definition LocalObject, establishing an injected LocalObject original object definition and LocalFunA, executing the real-time analysis of JS grammar by the browser, and triggering the calling process from a WEB local expansion object to a JAVA global object; judging whether a local expansion object is analyzed; further directly calling the method functionan () of javalocalObject in the functionan () of the locally injected object LocalObject; and completing the request loading and the grammar parsing of the current page. By the method and the device, the compatibility of a mechanism and user experience can be realized, and the problem of use cost of a user is reduced.

Description

Processing method and system for JavaScript extension object of IPTV browser
Technical Field
The invention relates to the field of IPTV set-top boxes, in particular to a method and a system for processing a JavaScript extension object of an IPTV browser.
Background
With the continuous improvement of the basic network and the improvement of the network quality in China, video terminal products developed by operators of telecom, mobile, Unicom, radio and television and the like based on the basic network are successively released, wherein the IPTV set top box is greatly developed, but simultaneously, with the gradual saturation of the market, the development of the IPTV set top box gradually changes from the mode of market development, quantity expansion and the mode that the operators increase the respective user scale, and gradually changes to the direction of improving the content quality of users and reducing the operation cost.
Generally, a set-top box terminal device bears an IPTV EPG service, for this terminal product, the hardware cost and software development cost of an IPTV set-top box itself are included, but with the continuous popularization of an Android television and the continuous improvement of television performance, the hardware capability of an Android television system itself is gradually stronger than the hardware configuration of the IPTV set-top box, and the IPTV function is realized by integrating an application software middleware in the television system, so that the cost of the hardware of the IPTV box itself is removed, which has become an important development direction.
Currently, the mainstream implementation mode of IPTV on set-top box is to bear the content of EPG through a browser, where the EPG implementation language is a WEB language based on HTML + CSS + JavaScript, and meanwhile, by extending a JavaScript object that the WEB itself does not have, interaction on the WEB of the extended object and Native language is opened, to implement functions such as authentication, audio and video playing that the standard WEB does not have.
On the set-top box, the Android system version commonly used is fixed, and the system source codes are customized and maintained by the set-top box, so that the source codes of a system bottom layer browser can be customized on the set-top box to customize the presentation of the EPG content.
However, in a television system, due to the fact that various television brands and television system versions are different, the television brands and television system versions cannot be unified through customizing a system bottom layer source code, the most effective solution is to use a unified API provided by Android for applications to be compatible with Android version differences, and a browser is required to be used on the Android APP to realize the display of WEB EPG content by means of a WebView component interface provided by the Android API.
However, the Android WebView component has the problem that the provided existing interface only supports the extension of a global JavaScript object, and thus does not support the extension of a local JavaScript object, but if the API interface of the extension WebView component supports the global extension, the modification of a java frame module, a JNI module and a Native module of the Android system is involved, which is not sufficient for realizing the compatibility of various differentiated television systems in a unified manner and realizing a unified mechanism.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method for processing a JavaScript extension object of an IPTV browser, which comprises the following steps:
step one, entering a JavaScript object initialization module, and entering a step two;
step two, locally injecting a JS module to realize the definition of a LocalObject prototype, and entering step three;
step three, page interception is carried out through the shouldoverurderload of webview, and whether the current page contains the object and the method for expanding the local expansion object or not is judged; if not, the page does not carry out any processing and jumps to the fourth step;
if yes, injecting a local JavaScript injection object prototype definition LocalObject, establishing an injected LocalObject original object definition and LocalFunA, and entering the step four;
step four, the browser executes the real-time analysis of the JS grammar and triggers the calling process from the WEB local expansion object to the JAVA global object;
step five, judging whether the local expansion object is analyzed; if the local extension object is analyzed, the WEB context environment establishes a mapping relation between the LocalObject and the original definition of the locally injected LocalObject, and when the browser calls the functional nA () of the locally injected LocalObject, the step six is carried out; if the local expansion object is not analyzed, no processing is carried out, and the step seven is carried out;
step six: further directly calling the method functionan () of javalocalObject in the functionan () of the locally injected object LocalObject; establishing mapping from a local injection object method to a JAVA global object method, and realizing the call from a WEB page local object method to a JAVA registered global JavaScript object method;
and step seven, completing the request loading and grammar parsing of the current page.
Further, the JavaScript object initialization module is: and initializing a method for creating a global Javascript object through an Android API addjavascript interface, wherein the method is used for mapping the global Javascript object defined in the local JS injection module.
Further, the local JS injection module is: the method comprises the steps of registering JS realization in real time when a video playing javascript page is called, and establishing mapping from WEB local expansion JS to WEB JS realization prototype definition injected by local JS; meanwhile, the WEB JS realizes prototype definition, and a mapping relation with a JavaScript object in the JavaScript object initialization module is established.
Further, the mapping from the WEB local extension object to the JAVA global object is as follows: and according to the kernel page of the browser, analyzing and executing the local object of the WEB extension, establishing a static mapping relation, and realizing the call from the JS local object function in the WEB page to the JAVA associated global object function.
Further, the entering JavaScript object initialization module in the first step is: after the system is started, establishing a local JavaScript injection module LocalObject realization prototype and a JavaocalObject object mapping calling relation of a JAVA layer through webview.
The invention has the beneficial effects that: the method is universal, can be compatible with the difference of Android system versions brought by different Android terminal systems, processes the difference in real time, injects a small amount of JS only in a local JS extension page, does not generate any influence on personal experience on the original performance, and realizes mechanism compatibility and user experience. The problem of user use cost is reduced.
Drawings
Fig. 1 is a flowchart of a processing method of an IPTV browser JavaScript extended object.
Detailed Description
The technical solutions of the present invention are further described in detail below with reference to the accompanying drawings, but the scope of the present invention is not limited to the following.
As shown in fig. 1, a method for processing a JavaScript extended object of an IPTV browser includes the following steps:
step one, entering a JavaScript object initialization module, and entering a step two;
step two, locally injecting a JS module to realize the definition of a LocalObject prototype, and entering step three;
step three, page interception is carried out through the shouldoverurderload of webview, and whether the current page contains the object and the method for expanding the local expansion object or not is judged; if not, the page does not carry out any processing and jumps to the fourth step;
if yes, injecting a local JavaScript injection object prototype definition LocalObject, establishing an injected LocalObject original object definition and LocalFunA, and entering the step four;
step four, the browser executes the real-time analysis of the JS grammar and triggers the calling process from the WEB local expansion object to the JAVA global object;
step five, judging whether the local expansion object is analyzed; if the local extension object is analyzed, the WEB context environment establishes a mapping relation between the LocalObject and the original definition of the locally injected LocalObject, and when the browser calls the functional nA () of the locally injected LocalObject, the step six is carried out; if the local expansion object is not analyzed, no processing is carried out, and the step seven is carried out;
step six: further directly calling the method functionan () of javalocalObject in the functionan () of the locally injected object LocalObject; establishing mapping from a local injection object method to a JAVA global object method, and realizing the call from a WEB page local object method to a JAVA registered global JavaScript object method;
and step seven, completing the request loading and grammar parsing of the current page.
The JavaScript object initialization module is as follows: and initializing a method for creating a global Javascript object through an Android API addjavascript interface, wherein the method is used for mapping the global Javascript object defined in the local JS injection module.
The local JS injection module is as follows: the method comprises the steps of registering JS realization in real time when a video playing javascript page is called, and establishing mapping from WEB local expansion JS to WEB JS realization prototype definition injected by local JS; meanwhile, the web JS realizes prototype definition, and a mapping relation with a JavaScript object in the JavaScript object initialization module is established.
The mapping from the WEB local extension object to the JAVA global object is as follows: and according to the kernel page of the browser, analyzing and executing the local object of the WEB extension, establishing a static mapping relation, and realizing the call from the JS local object function in the WEB page to the JAVA associated global object function.
The JavaScript object entering initialization module in the first step is as follows: after the system is started, establishing a local JavaScript injection module LocalObject realization prototype and a JavaocalObject object mapping calling relation of a JAVA layer through webview.
Specifically, in order to realize a local extension mode, the invention provides a mechanism, a bridge which is created by passing through a local object to a global object supported by webview is created, a customized local object extension script is created to realize a local object creation realization entrance, a local JS extension script is injected when a video page is loaded, when the video page calls JS to create a local extension object, the locally injected creation extension object realization entrance is called first, and then the local JS entrance is called to further call a global object interface supported by webview extension.
In order to establish a mapping call relation from a WEB page local extension object to a JAVA API on an Android system, the method is realized by the following method and steps through an enumerated core module, and comprises the following steps:
step S101, entering a JavaScript object initialization module, and entering step S201;
after the system is started, establishing a local JavaScript injection module LocalObject realization prototype and a JavaocalObject object mapping calling relationship of a JAVA layer through webview.
Parameter 1: java defined object, parameter 2: variable name in local injection module JS
Step S201, local JavaScript injection module
A LocalObject required for the WEB page is called new LocalObject (); localfufina ();
the definition of the localiobject prototype is realized in the local injection JS module, and the process goes to step S202;
step S202, page interception is carried out through the shouldOververderUrlLoading of webview, and whether the current page contains the object and the method of local expansion object expansion is judged;
step S203, if the page does not exist, the page does not carry out any processing, and the step S301 is skipped to;
step S204, if yes, injecting a local JavaScript injection object prototype definition, where the injection object definition needs to ensure that the name of the localiobject mlocalbject ═ new LocalObject required by the WEB page is consistent, that is, the LocalObject is obtained, establishing an injected LocalObject original object definition and localfena, and entering step S301;
step S301, the browser executes the real-time analysis of the JS grammar, and triggers the calling process from the WEB local extension object to the JAVA global object
Step S302, judging whether the local expansion object is analyzed
Step S303, if the local object is resolved into the local extension object, the local object is new local object, the WEB context establishes a mapping relationship between the local object and the locally injected local object original definition, and when the browser resolves to the local object. That is, the function () of the local injection object localiobject is called, and the process proceeds to step S305;
step S304, no analysis is carried out, and the process enters S306;
step S305: since JAVAlocalObject itself has already created a global object through the Java layer, method functionan () of JAVAlocalObject is further called directly in functionan () of the locally injected object localcobject; and establishing the mapping from the local injection object method to the JAVA global object method. Further, the local object method of the WEB page is called to the global JavaScript object method registered in JAVA;
and step S306, finishing the request loading and grammar parsing of the current page.
The avaScript object initialization module comprises:
method for creating global Javascript object through Android API addjavascript interface initialization, and used for mapping global Javascript object defined in local JS injection module
Local JS injection module
And the method is used for registering JS realization in real time when calling a video playing javascript page, and establishing mapping from local WEB expansion JS to local WEB JS injected to realize prototype definition. Meanwhile, the web JS implementation prototype definition further establishes a mapping relation with the JavaScript object in the JavaScript object initialization module.
Mapping of WEB local extension objects to JAVA global objects:
and according to the fact that a local object of WEB extension is analyzed and executed by a kernel page of the browser, calling from a JS local object function to a JAVA associated global object function in the WEB page is achieved through the established static mapping relation.
The foregoing is illustrative of the preferred embodiments of this invention, and it is to be understood that the invention is not limited to the precise form disclosed herein and that various other combinations, modifications, and environments may be resorted to, falling within the scope of the concept as disclosed herein, either as described above or as apparent to those skilled in the relevant art. And that modifications and variations may be effected by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (5)

1. A processing method for a JavaScript extension object of an IPTV browser is characterized by comprising the following steps:
step one, entering a JavaScript object initialization module, and entering a step two;
step two, locally injecting a JS module to realize the definition of a LocalObject prototype, and entering step three;
step three, page interception is carried out through the shouldoverurderload of webview, and whether the current page contains the object and the method for expanding the local expansion object or not is judged; if not, the page does not carry out any processing and jumps to the fourth step;
if yes, injecting a local JavaScript injection object prototype definition LocalObject, establishing an injected LocalObject original object definition and LocalFunA, and entering the step four;
step four, the browser executes the real-time analysis of the JS grammar and triggers the calling process from the WEB local expansion object to the JAVA global object;
step five, judging whether the local expansion object is analyzed; if the local extension object is analyzed, the WEB context environment establishes a mapping relation between the LocalObject and the original definition of the locally injected LocalObject, and when the browser calls the functional nA () of the locally injected LocalObject, the step six is carried out; if the local expansion object is not analyzed, no processing is carried out, and the step seven is carried out;
step six: further directly calling the method functionan () of javalocalObject in the functionan () of the locally injected object LocalObject; establishing mapping from a local injection object method to a JAVA global object method, and realizing the call from a WEB page local object method to a JAVA registered global JavaScript object method;
and step seven, completing the request loading and grammar parsing of the current page.
2. The method for processing the JavaScript extension object of the IPTV browser of claim 1, wherein the JavaScript object initialization module is: and initializing a method for creating a global Javascript object through an Android API addjavascript interface, wherein the method is used for mapping the global Javascript object defined in the local JS injection module.
3. The method for processing the JavaScript extension object of the IPTV browser of claim 1, wherein the local JS injection module is: the method comprises the steps that when a video playing JavaScript page is called, JS realization is registered in real time, and mapping defined by a WEB local expansion JS to WEB JS realization prototype injected by local JS is established; meanwhile, the WEB JS realizes prototype definition, and a mapping relation with a JavaScript object in the JavaScript object initialization module is established.
4. The method for processing the JavaScript extended object of the IPTV browser of claim 1, wherein the mapping from the WEB local extended object to the JAVA global object is: and according to the kernel page of the browser, analyzing and executing the local object of the WEB extension, establishing a static mapping relation, and realizing the call from the JS local object function in the WEB page to the JAVA associated global object function.
5. The method for processing the JavaScript extension object of the IPTV browser of claim 1, wherein the JavaScript object initialization module entering in the step one is: after the system is started, establishing a local JavaScript injection module LocalObject realization prototype and a JavaocalObject object mapping calling relation of a JAVA layer through webview.
CN202011126874.3A 2020-10-20 2020-10-20 Processing method and system for JavaScript extension object of IPTV browser Pending CN112559121A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011126874.3A CN112559121A (en) 2020-10-20 2020-10-20 Processing method and system for JavaScript extension object of IPTV browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011126874.3A CN112559121A (en) 2020-10-20 2020-10-20 Processing method and system for JavaScript extension object of IPTV browser

Publications (1)

Publication Number Publication Date
CN112559121A true CN112559121A (en) 2021-03-26

Family

ID=75041466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011126874.3A Pending CN112559121A (en) 2020-10-20 2020-10-20 Processing method and system for JavaScript extension object of IPTV browser

Country Status (1)

Country Link
CN (1) CN112559121A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693280A (en) * 2012-04-28 2012-09-26 广州市动景计算机科技有限公司 Webpage browsing method, WebApp framework, method and device for executing JavaScript, and mobile terminal
CN104267972A (en) * 2014-10-20 2015-01-07 中国科学院声学研究所 Brower local interface expansion method and device
CN106815055A (en) * 2017-02-15 2017-06-09 深圳创维-Rgb电子有限公司 The method and system of Mobile solution Dynamic Distribution
CN110650352A (en) * 2019-09-06 2020-01-03 四川天邑康和通信股份有限公司 Video processing method of IPTV browser

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693280A (en) * 2012-04-28 2012-09-26 广州市动景计算机科技有限公司 Webpage browsing method, WebApp framework, method and device for executing JavaScript, and mobile terminal
US20150074513A1 (en) * 2012-04-28 2015-03-12 Guangzhou Ucweb Computer Technology Co., Ltd. Webpage Browsing Method, Webapp Framework, Method and Device for Executing Javascript and Mobile Terminal
CN104267972A (en) * 2014-10-20 2015-01-07 中国科学院声学研究所 Brower local interface expansion method and device
CN106815055A (en) * 2017-02-15 2017-06-09 深圳创维-Rgb电子有限公司 The method and system of Mobile solution Dynamic Distribution
CN110650352A (en) * 2019-09-06 2020-01-03 四川天邑康和通信股份有限公司 Video processing method of IPTV browser

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MANIMANIHO: "使用addJavaScriptInterface()方法在WebView中绑定Java对象", 《HTTPS://WWW.JIANSHU.COM/P/ED0846A16659》 *

Similar Documents

Publication Publication Date Title
CN108536524B (en) Resource updating method, device, terminal and storage medium
CN101930366B (en) Browser-based mobile phone run time system
CN109240697B (en) Call processing method and device and storage medium
KR20070106691A (en) A method of automatically building a customised software application for a specific type of wireless computing device
CN110874217A (en) Interface display method and device for fast application and storage medium
CN111580879A (en) Applet running method and device, electronic equipment and computer storage medium
CN110609964B (en) IPTV browser page implementation method and IPTV browser
CN109347916B (en) Game interaction method and device and computer readable storage medium
CN112882709A (en) Rendering method, device and equipment based on container engine system and storage medium
CN111427622A (en) Method and device for executing script codes in application program
CN110764805A (en) Method, device, terminal and storage medium for noninductive upgrade of client
CN108170430B (en) Interface display method and system
CN103514924A (en) Method and device for playing videos in mobile terminal Widget, and player
US20100287267A1 (en) Method and server for widget communication
US20060080474A1 (en) Information processor
CN106843975B (en) Method and device for extending HTML5 application function
CN105138399A (en) Cross-platform mobile Web application runtime engine
KR20110065804A (en) Mobile terminal and method for operating web application the mobile terminal
US20220292141A1 (en) Quick Application Startup Method and Related Apparatus
CN105955786B (en) A kind of implementation method of the point of sales terminal based on HTML5
CN112559121A (en) Processing method and system for JavaScript extension object of IPTV browser
CN108804082A (en) A kind of implementation method of plug-in unit JSBridge
CN109918598B (en) Web page rendering method based on Android television browser
US20210064394A1 (en) Information display method, terminal and storage medium
CN110806856A (en) Data loading method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210326