A method for customizing the UI style of the video tag

By adding video tag style files and modifying the UI elements and Element classes of the Crosswalk core, the problem that the video tag UI style on smart terminal devices cannot meet the needs has been solved, custom UI styles have been implemented, and the interactive experience has been improved.

CN114020247BActive Publication Date: 2024-10-01SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111349703.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-15
Publication Date
2024-10-01
Estimated Expiration
2041-11-15

AI Technical Summary

Technical Problem

On a variety of smart terminal devices, the native UI style of the video tag cannot meet the needs of various interactive scenarios, especially on small-screen devices. Interaction is inconvenient, and customers need to customize the UI style but cannot modify the front-end page, making customization impossible. UI style.

Method used

By adding a video tag style file, modifying the style of UI elements and the initialization sequence of the Element class, removing the custom broadcast control UI on the front end, and setting the controls attribute and extended interface in the Crosswalk kernel, it is decided to use the native or customized UI style process. .

Benefits of technology

Implemented a method of customizing the video tag UI style on smart terminal devices to meet user design needs, and provided a switch to use native or custom UI styles to improve the interactive experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114020247B_ABST
    Figure CN114020247B_ABST
Patent Text Reader

Abstract

The invention discloses a method for customizing UI styles of video tags. By setting the implementation mode of native video tag UI styles in Crosswalk kernel, a set of methods for customizing UI styles of video tags is expanded, and a switch for using native video tag styles or customizing video tag styles is set to meet the needs of users to design video tag styles by themselves.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of browser technology, and in particular to a method for customizing a UI style of a video tag. Background Art

[0002] With the popularity of Android system, various smart terminals based on Android system have appeared in the market. The display screens of these smart terminals are large and small, and the UI interaction methods are also diverse. The popularity of smart terminals based on Android system and the development of Internet technology have also promoted the further popularization of HTML5 technology. As an important member of HTML5 family, video tag carries the functions of parsing and playing videos, and is particularly commonly used in various industries.

[0003] On such a wide variety of smart terminal devices, the native UI style of the video tag cannot fully meet the needs of various interactive scenarios. For example, on small-screen terminal devices, the native UI of the video tag is too small, and the interaction is not very smooth whether through touch or physical button interaction. At the same time, some customers will also propose customized video tag UI styles based on their own product style needs. However, we cannot modify the front-end pages that use the video tag on the network. Therefore, it is necessary to provide a method for customizing the UI style of the video tag to solve the above problems. Summary of the invention

[0004] In the prior art, it is not possible to achieve the effect of customizing the video tag UI style by customizing the native video style parsing process of the Crosswalk kernel; the present invention adopts a new video tag style file, modifies the style of a specific UI element in the new style file, modifies the initialization order of the Element class corresponding to the specific UI element, and removes the front-end customized broadcast control UI by modifying the controls attribute corresponding to the video tag to solve the problem of customizing the video tag UI style.

[0005] Definition of noun:

[0006] Front-end: The front-end part of the website, which runs on the browser and displays the web pages to users.

[0007] HTML5: HTML5 is the latest HTML standard and is specially designed to carry rich web content.

[0008] Crosswalk: Crosswalk is an open source project that provides a runtime environment for HTML applications.

[0009] Video tag: The video tag is a new tag in HTML5 and is used to define videos, such as movie clips or other video streams.

[0010] Customized UI style: The Crosswalk kernel customizes a set of default UI styles for the video tag. Customized UI styles refer to extending a set of UI styles that meet user needs.

[0011] Rendering engine: Blink, also known as the typesetting engine, is responsible for parsing and rendering web pages developed with the front-end language.

[0012] The present invention achieves the above-mentioned purpose through the following technical solutions:

[0013] A method for customizing a UI style of a video tag includes the following steps:

[0014] Step s1, add a new video tag style sheet file: expand the native mediaControls.css and medaControlsAndroid.css style sheets in the Crosswalk kernel to create custom video tag UI style sheets mediaControlsBs.css and mediaControlsAndroidBs.css;

[0015] Step s2, load the newly added style sheet file: modify the module part of the Crosswalk kernel that specifies the path to load the css file, and define the specific path of the mediaControlsBs.css and mediaControlsAnroidBs.css style sheet files in it;

[0016] Step s3, modify the style of the UI element in the newly added style sheet file: modify the specific style of the UI element in the mediaControlsBs.css and mediaControlsAndroidBs.css style sheets;

[0017] Step s4, modify the initialization process of the Element class corresponding to the specific UI element: according to the layout order of the video tag UI style elements and the relationship of inclusion and inclusion, modify the initialization order and subordinate relationship of the corresponding Element class in the Crosswalk kernel;

[0018] Step s5, modifying the controls attribute corresponding to the video tag: determining whether the front-end web page using the video tag has the controls attribute set, if not, modifying the Crosswalk kernel parsing module for the video tag, and when detecting that the name attribute is controls and the value is false, forcibly changing the value to true;

[0019] Step s6, removing the front-end customized playback control UI: when the front-end page uses the video tag but does not set the controls attribute of the video tag, it means that the front-end page needs to set the playback control UI style of the video tag by using the CSS language;

[0020] Step s7, extending the interface for using the native video tag or the custom video tag UI style: by extending an interface function in the XWalkSettingsInternal class, the interface function calls layer by layer to pass the parameter value and save it to a variable in the Crosswalk kernel; the relevant class that processes the video tag UI style in the Crosswalk kernel determines whether to use the video tag native UI style process or the custom UI style process by judging the variable value.

[0021] A further solution is that in step s6, the characteristics of the video playback control UI style set by the front-end page are analyzed, and the html.css file in the Crosswalk kernel is modified to cancel the playback control UI style set by the front-end page itself.

[0022] A further solution is that in step s2, an extension is made to the location where the original mediaControls.css and mediaControlsAndroid.css style sheet files are loaded, that is, when the video tag needs to be used to customize the UI style, the mediaControlsBs.css and mediaControlsAndroidBs.css style sheet files are loaded.

[0023] A further solution is that in step s3, the video tag is composed of multiple UI elements, specifically play / pause, current duration / total duration, sound, full screen, settings, and progress bar in the order from left to right and from top to bottom; the specific style definitions of these UI elements are placed in the mediaControlsBs.css and mediaControlsAndroidBs.css style sheet files.

[0024] The beneficial effects of the present invention are:

[0025] The method for customizing UI styles of a video tag of the present invention extends a set of methods for customizing UI styles of video tags by setting the implementation mode of the native video tag UI styles in the Crosswalk kernel, and sets a switch for using the native video tag styles or the custom video tag styles, thereby meeting the needs of users to design video tag styles by themselves. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 A flowchart of setting the video tag UI style according to an embodiment of the present invention; DETAILED DESCRIPTION

[0028] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0029] In any embodiment, if Figure 1 As shown, a method for customizing a UI style of a video tag of the present invention comprises the following steps:

[0030] Step s1, add a new video tag style sheet file: expand the native mediaControls.css and medaControlsAndroid.css style sheets in the Crosswalk kernel to create custom video tag UI style sheets mediaControlsBs.css and mediaControlsAndroidBs.css;

[0031] Step s2, load the newly added style sheet file: modify the module part of the Crosswalk kernel that specifies the path to load the css file, and define the specific path of the mediaControlsBs.css and mediaControlsAnroidBs.css style sheet files in it;

[0032] Step s3, modify the style of the UI element in the newly added style sheet file: modify the specific style of the UI element in the mediaControlsBs.css and mediaControlsAndroidBs.css style sheets;

[0033] Step s4, modify the initialization process of the Element class corresponding to the specific UI element: according to the layout order of the video tag UI style elements and the relationship of inclusion and inclusion, modify the initialization order and subordinate relationship of the corresponding Element class in the Crosswalk kernel;

[0034] Step s5, modifying the controls attribute corresponding to the video tag: determining whether the front-end web page using the video tag has the controls attribute set, if not, modifying the Crosswalk kernel parsing module for the video tag, and when detecting that the name attribute is controls and the value is false, forcibly changing the value to true;

[0035] Step s6, removing the front-end customized playback control UI: when the front-end page uses the video tag but does not set the controls attribute of the video tag, it means that the front-end page needs to set the playback control UI style of the video tag by using the CSS language;

[0036] Step s7, extending the interface for using the native video tag or the custom video tag UI style: by extending an interface function in the XWalkSettingsInternal class, the interface function calls layer by layer to pass the parameter value and save it to a variable in the Crosswalk kernel; the relevant class that processes the video tag UI style in the Crosswalk kernel determines whether to use the video tag native UI style process or the custom UI style process by judging the variable value.

[0037] In a specific embodiment, Figure 1 As shown, a method for customizing a UI style of a video tag of the present invention comprises the following steps:

[0038] Added video tag style sheet file.

[0039] The css syntax can define the specific style of the html tag. The style of the native UI of the video tag in the Crosswalk kernel is determined by the two style files mediaControls.css and mediaControlsAndroid.css defined in the kernel. When the rendering engine in the Crosswalk kernel parses the video tag, there will be a process of parsing the video tag style. The specific process is to convert the two style sheet files mediaControls.css and mediaControlsAndrid.css into ASCII-encoded String type data, and then the Crosswalk kernel parses the String type data, and parses out the specific styles defined in mediaControls.css and mediaControlsAndroid.css for layout rendering. In order not to destroy the style of the native UI of the video tag in the Crosswalk kernel, it is necessary to expand a mediaControls.css and mediaControlsAndroid.css style sheet file. Here we rename the expanded style sheet files to mediaControlsBs.css and mediaControlsAndroidBs.css.

[0040] Load the newly added style sheet file.

[0041] In order for the Crosswalk kernel rendering engine module to correctly load these two newly extended style sheet files, it is necessary to make an extension at the original location where the mediaControls.css and mediaControlsAndroid.css style sheet files are loaded, that is, when the video tag needs to be used to customize the UI style, the mediaControlsBs.css and mediaControlsAndroidBs.css style sheet files are loaded. At the same time, in order for the Crosswalk kernel to correctly identify the mediaControlsAndroidBs.css and mediaControlsBs.css style sheet files, it is necessary to customize the module part of the Crosswalk kernel that specifies the css file path and write the specific path of the mediaControlsAndroidBs.css and mediaControlsBs.css style sheet files in it.

[0042] Modify the styles of UI elements in the newly added style sheet file.

[0043] A video tag is composed of multiple UI elements, which are play / pause, current duration / total duration, sound, full screen, settings, and progress bar from left to right and from top to bottom. The specific styles of these UI elements are defined in the mediaControlsBs.css and mediaControlsAndroidBs.css style sheet files. The styles of these UI elements are customized based on the specific needs of users. The modification of the style sheet needs to follow the CSS syntax rules.

[0044] Modify the initialization process of the Element class corresponding to the specific UI element.

[0045] In order to correctly render the UI style of the video tag, some container Element classes will be defined in the Crosswalk kernel, and corresponding Element classes will be created for the UI elements described in 3.2.3. According to the layout order of the video tag UI style elements and the relationship between inclusion and inclusion, these Element classes will have a sequence and subordinate relationship when initialized, which is similar to the DOM node tree structure.

[0046] Modify the controls attribute corresponding to the video tag.

[0047] The front-end page that uses the video tag sometimes does not use the native UI style of the video tag, that is, the controls attribute of the video tag is set to false or the controls attribute is not added. The above-mentioned customized modification of the UI style of the video tag is based on the setting of the controls attribute of the video tag. At this time, you first need to set the controls attribute to the video tag through customized modification of the Crosswalk kernel. The video tag is an Element element in the Crosswalk kernel. When parsing the video tag, the kernel will perform a check on the setting of its attributes. When it detects that the name attribute is controls and the value is false, you can force its value to be changed to true. At this time, the front-end web page that uses the video tag but does not set the controls attribute can display the native UI style of the video tag normally.

[0048] Remove the customized playback control UI on the front end.

[0049] Usually, if the front-end web page uses the video tag but does not set the controls attribute of the video tag, it means that the front-end web page needs to set the video tag's playback control UI style by using the CSS language. At this time, the playback control UI style set by the front-end website needs to be removed. The Crosswalk kernel provides an html.css style sheet file. By specifically analyzing the front-end page to find out the characteristics of setting the video playback control UI style, the customized playback control UI of the front-end page can be removed by modifying the html.css file. The usual practice is: div[id="xxx"i]{display:none;}.

[0050] Expand the interface to use native video tags or customize the video tag UI style.

[0051] Through the above steps, the UI style of the video tag has been successfully customized, and the effect of displaying the customized video tag UI style has been achieved. Usually, it is necessary to give users a chance to choose, that is, users can decide in some way whether to use the native video tag style or the customized video tag UI style. This can be achieved by extending a function setBsMediaControlsMode in the XWalkSettingsInternal class. The setBsMediaControlsMode function is called down layer by layer and the parameter value is passed and saved to a certain location; the related classes that process the video tag UI style in the Crosswalk kernel obtain the saved value to distinguish whether to follow the video tag native UI style process or the customized UI style process.

[0052] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims. It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further explain various possible combinations. In addition, the various different embodiments of the present invention can also be combined arbitrarily, as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.

Claims

1. A method for customizing the UI style of a video tag, characterized in that: The following steps are involved: Step s1, add a new video tag style sheet file: expand the native mediaControls.css and mediaControlsAndroid.css style sheets in the Crosswalk kernel to create custom video tag UI style sheets mediaControlsBs.css and mediaControlsAndroidBs.css; Step s2, load the newly added style sheet file: modify the module part of the Crosswalk kernel that specifies the path to load the css file, and define the specific path of the mediaControlsBs.css and mediaControlsAnroidBs.css style sheet files in it; Step s3, modify the style of the UI element in the newly added style sheet file: modify the specific style of the UI element in the mediaControlsBs.css and mediaControlsAndroidBs.css style sheets; Step s4, modify the initialization process of the Element class corresponding to the specific UI element: according to the layout order of the video tag UI style elements and the relationship of inclusion and inclusion, modify the initialization order and subordinate relationship of the corresponding Element class in the Crosswalk kernel; Step s5, modifying the controls attribute corresponding to the video tag: determining whether the front-end web page using the video tag has the controls attribute set, if not, modifying the Crosswalk kernel parsing module for the video tag, and when detecting that the name attribute is controls and the value is false, forcibly changing the value to true; Step s6, removing the front-end customized playback control UI: when the front-end page uses the video tag but does not set the controls attribute of the video tag, it means that the front-end page needs to set the playback control UI style of the video tag by using the CSS language; Step s7, extending the interface for using the native video tag or the custom video tag UI style: by extending an interface function in the XWalkSettingsInternal class, the interface function calls layer by layer to pass the parameter value and save it to a variable in the Crosswalk kernel; the relevant class that processes the video tag UI style in the Crosswalk kernel determines whether to use the video tag native UI style process or the custom UI style process by judging the variable value.

2. A method for customizing a UI style of a video tag as claimed in claim 1, characterized in that: In step s6, the characteristics of the video playback control UI style set by the front-end page are found out by analyzing the front-end page, and the html.css file in the Crosswalk kernel is modified to cancel the playback control UI style set by the front-end page itself.

3. A method for customizing a UI style of a video tag as claimed in claim 1, characterized in that: In the step s2, an extension is made to the original location where the mediaControls.css and mediaControlsAndroid.css style sheet files are loaded, that is, when the video tag needs to be used to customize the UI style, the mediaControlsBs.css and mediaControlsAndroidBs.css style sheet files are loaded.

4. A method for customizing a UI style of a video tag as claimed in claim 1, characterized in that: In step s3, the video tag is composed of multiple UI elements, which are play / pause, current duration / total duration, sound, full screen, settings, and progress bar in order from left to right and from top to bottom; the specific style definitions of these UI elements are placed in the mediaControlsBs.css and mediaControlsAndroidBs.css style sheet files.