Live function plug-in loading method, device, equipment and storage medium
By determining the running environment of the front-end scaffolding program in network live broadcast technology and dynamically loading the live broadcast function plug-in, the problem of program bloat is solved, and the loading performance and scalability are improved.
Patent Information
- Application Number
- CN202110768648.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-07
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2041-07-07
AI Technical Summary
In the existing online live broadcast technology, front-end scaffolding programs need to constantly modify and add content when expanding live broadcast business, resulting in bloated programs, which is not conducive to loading, maintenance and expansion.
By determining the global or local operating environment of the front-end scaffolding program, obtaining the corresponding dependency directory path, dynamically loading the live broadcast function plug-in, decoupling core functions and business functions, and realizing plug-in management.
Improves the loading performance, maintainability and scalability of front-end scaffolding programs, reduces program size, and facilitates loading, maintenance and expansion.
Smart Images

Figure CN113448650B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network live broadcast, and in particular to a method, device, equipment and storage medium for loading live broadcast function plugins. Background Art
[0002] Currently, in the development projects in the technical field of network live broadcast, a front-end scaffolding program is used to improve the development efficiency. The front-end scaffolding program is a development tool that has functions such as compiling code, generating an initial project, and providing common development functions.
[0003] However, the inventor has found in practice that with the expansion of the live broadcast business, any changes or additions to the requirements of the live broadcast function require continuous modification and addition of new content to the front-end scaffolding, making the front-end scaffolding program increasingly bloated and not conducive to loading, maintenance, and expansion, etc. Summary of the Invention
[0004] Based on this, the purpose of the present application is to provide a method, device, equipment and storage medium for loading live broadcast function plugins, which has the advantages of being able to dynamically load plugins to run in different operating environments of the program, improving the loading performance, maintainability and scalability of the front-end scaffolding program.
[0005] According to the first aspect of the embodiments of the present application, a method for loading a live broadcast function plugin is provided. The method for loading a live broadcast function plugin includes:
[0006] Determine the operating environment of the front-end scaffolding program, where the operating environment includes global operation and local operation;
[0007] If the operating environment of the front-end scaffolding program is global operation, obtain the first dependency directory path corresponding to global operation. If the operating environment of the front-end scaffolding program is local operation, obtain the second dependency directory path corresponding to local operation;
[0008] Determine the plugin directory where the corresponding live broadcast function plugin is located according to the first dependency directory path or the second dependency directory path;
[0009] Cause the front-end scaffolding program to execute the corresponding plugin entry file in the plugin directory to load the corresponding live broadcast function plugin.
[0010] According to the second aspect of the embodiments of the present application, a device for loading a live broadcast function plugin is provided. The device for loading a live broadcast function plugin includes:
[0011] A first determination module, configured to determine the operating environment of the front-end scaffolding program, where the operating environment includes global operation and local operation;
[0012] An acquisition module, configured to obtain a first dependent directory path corresponding to global operation if the running environment of the front-end scaffolding program is global operation, and obtain a second dependent directory path corresponding to local operation if the running environment of the front-end scaffolding program is local operation;
[0013] A second determination module, configured to determine a plug-in directory where a corresponding live broadcast function plug-in is located according to the first dependent directory path or the second dependent directory path;
[0014] A loading module, configured to cause the front-end scaffolding program to execute a corresponding plug-in entry file in the plug-in directory and load the live broadcast function plug-in.
[0015] According to a third aspect of the embodiments of the present application, there is provided an electronic device, including: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to perform any one of the live broadcast function plug-in loading methods.
[0016] According to a fourth aspect of the embodiments of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements any one of the live broadcast function plug-in loading methods.
[0017] In the present application, the running environment of the front-end scaffolding program can be determined, where the running environment includes global operation and local operation; if the running environment of the front-end scaffolding program is global operation, obtain a first dependent directory path corresponding to global operation, and if the running environment of the front-end scaffolding program is local operation, obtain a second dependent directory path corresponding to local operation; determine a plug-in directory where a corresponding live broadcast function plug-in is located according to the first dependent directory path or the second dependent directory path; cause the front-end scaffolding program to execute a corresponding plug-in entry file in the plug-in directory and load the corresponding live broadcast function plug-in. It can dynamically load plug-ins to run as the program is in different running environments. At the same time, by dynamically loading different live broadcast function plug-ins in specific business scenarios, there is no need to add or modify other functions in the front-end scaffolding program, solving the problem that the front-end scaffolding program becomes more and more bloated due to business requirements, reducing the volume of the front-end scaffolding program, and making the front-end scaffolding easy to load, maintain and expand, that is, improving the loading performance, maintainability and scalability of the front-end scaffolding program.
[0018] It should be understood that the above general description and subsequent detailed description are only exemplary and explanatory, and cannot limit the present application.
[0019] For better understanding and implementation, the present application will be described in detail below with reference to the accompanying drawings. Description of the Drawings
[0020] Figure 1 A schematic diagram of an application scenario of a live function plug-in loading method provided by an embodiment of the present application;
[0021] Figure 2 A flowchart of a live function plug-in loading method provided by an embodiment of the present application;
[0022] Figure 3 A schematic structural diagram of a live function plug-in loading device provided by an embodiment of the present application;
[0023] Figure 4 A schematic block diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0024] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0025] It should be clear that the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0026] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0027] In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances. The singular forms of "a", "the", and "said" used in the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. The word "if" / "when" used herein can be interpreted as "when" or "while" or "in response to a determination". In addition, in the description of the present application, unless otherwise specified, "a plurality of" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0028] Please refer to Figure 1 , Figure 1 , which is a schematic diagram of an application scenario of a live function plugin loading method provided by an embodiment of the present application. The application scenario includes a live client 10 and a server 20. The live client 10 interacts with the server 20.
[0029] The hardware pointed to by the live client 10 essentially refers to a computer device. Specifically, it can be a computer device such as a smart phone, a smart interactive tablet, and a personal computer. The live client 10 can access the Internet through a well-known network access method and establish a data communication link with the server 20.
[0030] As a service server, the server 20 can be responsible for further connecting relevant audio data servers, video stream servers, and other servers providing relevant support, etc., to form a logically related service cluster to provide services for relevant terminal devices, such as Figure 1 the live client 10 shown in
[0031] Among them, the live function plugin loading method can run on the above-mentioned live client 10 and / or server 20. The live client 10 and / or server 20 determine the running environment of the front-end scaffolding program. Among them, the running environment includes global running and local running; if the running environment of the front-end scaffolding program is global running, obtain the first dependency directory path corresponding to global running, if the running environment of the front-end scaffolding program is local running, obtain the second dependency directory path corresponding to local running; according to the first dependency directory path or the second dependency directory path, determine the plugin directory where the corresponding live function plugin is located; make the front-end scaffolding program execute the corresponding plugin entry file in the plugin directory to load the corresponding live function plugin.
[0032] Embodiment 1:
[0033] The embodiment of the present application discloses a live function plugin loading method.
[0034] Next, a live function plugin loading method provided by an embodiment of the present application will be introduced in detail in combination with the attached Figure 2 ,
[0035] Please refer to Figure 2 , the embodiment of the present application provides a live function plugin loading method, including the following steps:
[0036] S101: Determine the running environment of the front-end scaffolding program, where the running environment includes global running and local running.
[0037] Among them, the front-end scaffolding program is a tool pre-developed by developers, which has functions such as compiling code, generating an initial project, and providing common development functions, and various functions of the front-end scaffolding program can be called through a preset command line.
[0038] The running environment of the front-end scaffolding program refers to whether the front-end scaffolding program runs globally or locally. When running globally, the front-end scaffolding program can be used by any local application module; when running locally, the front-end scaffolding program can only be used by application modules within a local range.
[0039] In one embodiment, determining the running environment of the front-end scaffolding program includes the following steps:
[0040] Obtain the front-end scaffolding directory path, where the front-end scaffolding directory path is the directory path of the file directory where the entry file of the front-end scaffolding program is located;
[0041] If the front-end scaffolding directory path includes the directory path of a preset global package management tool, determine that the running environment is global;
[0042] If the front-end scaffolding directory path includes the directory path of the dependency package of the current live business module and does not include the directory path of a preset global package management tool, determine that the running environment is local.
[0043] Among them, the directory path of the file directory where the entry file of the front-end scaffolding program is located, that is, the front-end scaffolding directory path, can be obtained by accessing the property value process.mainModule.path of Node.js.
[0044] Node.js is a cross-platform runtime environment for JavaScript that can run on the server side. JavaScript (JS) is a lightweight, interpreted or just-in-time compiled programming language with function-first priority, which is widely used in front-end projects. The process object is a global variable in Node.js that provides information about the current Node.js process and enables control over the current Node.js process. In Node.js, each file is regarded as a module. When Node.js directly runs a file, the file is loaded as the main module into process.mainModule, that is, process.mainModule points to the main module. At the same time, when the main module changes during runtime, process.mainModule also points to the new main module. When the entry file of the front-end scaffolding program is executed, the entry file of the front-end scaffolding program is loaded into process.mainModule. At this time, the directory path of the file directory where the entry file of the front-end scaffolding program is located can be obtained according to process.mainModule.path.
[0045] Among them, the global package management tool can be npm (node package manager), nrm (npm registry manager, the mirror management tool of npm), yarn (a new package management tool that makes up for some deficiencies of npm), pnpm (a package management tool derived from npm and yarn), etc.
[0046] If the front-end scaffolding directory path includes the directory path of a preset global package management tool, it indicates that the front-end scaffolding directory path belongs to the global dependency directory path, and it can be determined that the running environment of the front-end scaffolding program is global running.
[0047] If the front-end scaffolding directory path includes the directory path of the dependent packages of the current live business module and does not include the directory path of the preset global package management tool, it shows that the front-end scaffolding directory path is a local dependency directory path, and it can be determined that the running environment of the front-end scaffolding program is local running.
[0048] Among them, the directory path of the global package management tool is the path composed of all the file directories between the file directory where the global package management tool is located and the root directory. The current live business module is the live business function module currently running. For example, when the audience gives gifts, the current live business module is the function module for giving gifts. The dependent package is the file required by the current live business module, that is, the program block that needs to be called.
[0049] S102: If the running environment of the front-end scaffolding program is global, obtain the first dependency directory path corresponding to global running; if the running environment of the front-end scaffolding program is local, obtain the second dependency directory path corresponding to local running.
[0050] Among them, the first dependency directory path is the global dependency directory path, and the second dependency directory path is the local dependency directory path.
[0051] Among them, the global dependency directory path can be the directory paths of all global package management tools existing in the current operating system. The local dependency directory path can be the path composed of all file directories corresponding to the currently running local project module. Here, the project refers to the files involved in providing the live broadcast service, and the local project module refers to the files involved in a certain sub-service in providing the live broadcast service.
[0052] S103: Determine the plugin directory where the corresponding live broadcast function plugin is located according to the first dependency directory path or the second dependency directory path.
[0053] Among them, the live broadcast function plugin can be an extension function plugin of the front-end scaffolding program. Taking the micro front-end workspace plugin and the plugin for automatically updating the project version according to the git version as examples:
[0054] For the micro front-end workspace plugin, it is used to provide the function of pulling the declaration files of micro front-end dependencies in the corresponding environment and pulling the declaration files between local micro front-end projects. Use the command exposed by the plugin to define the plugin command "workspace", use the option to define the parameter "type" for declaration file pulling and the parameter "pullenv" for pushing the environment, use the description to define the function description of this plugin, and use the action to implement the specific function logic. Pull the declaration files of the micro front-end dependency projects in the corresponding environment, replace each dependency address in the corresponding environment in the current emp project configuration file with the declaration file address and then pull, that is, replace each " / emp.js" in the dependency address with " / index.d.ts" and then pull. For local micro front-end projects to pull declaration files from each other, configure the local absolute addresses for pushing and pulling respectively, and the plugin makes soft links according to the local absolute addresses. When this plugin is installed in the file directory under the local dependency directory path of a certain local project module or the file directory under the global dependency directory path, this plugin can be used in the front-end scaffolding program.
[0055] For the plugin that automatically updates the project version according to the git version, it is used to match the version obtained by executing "git rev-parse --abbrev-ref HEAD" after "git checkout", and will automatically modify the project version. Use the "command" exposed by the plugin system to define the plugin command "gitversionlint", use "option" to define the parameter regular expression "regexpname", use "description" to define the function description of this plugin, and use "action" to implement the specific function logic. After this plugin executes "git rev-parse --abbrev-ref HEAD" to obtain the current git version, it modifies the "version" field in the "package.json" file. This plugin can be installed in the file directory under the local dependency directory path of a certain local project module or in the file directory under the global dependency directory path, and then this plugin can be used in the front-end scaffolding program.
[0056] Both of the above-mentioned plugins can be installed in the file directory under the local dependency directory path or in the file directory under the global dependency directory path, that is, they can be dynamically loaded and run by the method for loading the live function plugin in the embodiments of the present application.
[0057] The present application improves the scalability of the front-end scaffolding program. The front-end scaffolding program can retain the core functions, pluginize various business functions, decouple the core functions and business functions of the front-end scaffolding program, improve the maintainability of the code, and at the same time can also provide more flexible function plugin support and customization for various projects.
[0058] In one embodiment, determining the plugin directory where the corresponding live function plugin is located according to the first dependency directory path or the second dependency directory path includes the following steps:
[0059] Search for the first target directory with a preset prefix name in the first dependency directory path;
[0060] Determine the first target directory as the plugin directory of the live function plugin;
[0061] Or,
[0062] Obtain the plugin manifest file of the current live service module;
[0063] Read the plugin manifest file and obtain the prefix name of the live function plugin;
[0064] Search for the second target directory with the prefix name of the live function plugin in the second dependency directory path;
[0065] Determine the second target directory as the plugin directory of the live function plugin.
[0066] Among them, the preset prefix name can be the project name of the live function plugin or some characters in the project name.
[0067] The current live service module is a local project module that is currently running. For example, when a viewer gives a gift, the current host service module is the project module related to implementing the gift-giving function. The prefix name of the live function plugin is all or some characters of the name of the live function plugin.
[0068] Among them, the first dependency directory path is the global dependency directory path, and the global dependency directory path includes the directory paths of all possible package management tools in the current operating system.
[0069] The first target directory can be the installation directory of the live function plugin, which is generally named according to the name of the live function plugin or according to a preset naming rule. The name of the first target directory is known and can be searched in the global dependency directory path to find the first target directory.
[0070] The plugin manifest file can refer to a file that stores information related to the live function plugin. Usually, in a development project, a file can be used to store information such as the names and versions of all installed software packages (i.e., plugins) and their installation locations. The name of the plugin manifest file can be predefined, such as named "package.json".
[0071] S104: Make the front-end scaffolding program execute the corresponding plugin entry file in the plugin directory to load the corresponding live function plugin.
[0072] Among them, the plugin entry file refers to the entry file of the live function plugin. A plugin is a program written according to a certain specification of the application programming interface, and the entry file is the entry of this program.
[0073] In one embodiment, the step of making the front-end scaffolding program execute the corresponding plugin entry file in the plugin directory to load the live function plugin includes the following steps:
[0074] Pass the object of the front-end scaffolding program to the live function plugin;
[0075] Execute the corresponding plugin entry file in the plugin directory to make the live function plugin load in the plugin runnable environment provided by the object of the front-end scaffolding program.
[0076] Among them, the object of the front-end scaffolding program is passed to the live broadcast function plug-in, and the methods provided in the live broadcast function plug-in can operate on the object of the front-end scaffolding program according to attributes such as a pre-defined command name, command description, options, parameters, processing functions, and version number, so as to use various functions provided by the front-end scaffolding program.
[0077] In one embodiment, the live broadcast function plug-in has a specific protocol to enable the live broadcast function plug-in to be effectively loaded and executed by the front-end scaffolding program.
[0078] commander.js is a complete node.js command-line solution. The development of the live broadcast function plug-in can be based on commander to formulate a plug-in protocol: the live broadcast function plug-in architecture uses the OCP (Open-Closed Principle) principle during runtime, exposing specific object extensions internally and closing the main program externally; the plug-in scope revolves around the commander object. The live broadcast function plug-in follows the project name prefix agreed upon by the front-end scaffolding program. During development, the command name, command description, options, parameters, processing functions, and version number of the front-end scaffolding program are set through command, description, option, arguments, action, and version respectively.
[0079] Among them, the plug-in operable environment refers to the front-end scaffolding program being able to compile the code of the live broadcast function plug-in, thereby providing a runnable environment for the live broadcast function plug-in. This environment includes the memory resources and CPU computing resources allocated by the front-end scaffolding program for the compilation of the live broadcast function plug-in, etc.
[0080] In the embodiments of the present application, the operating environment of the front-end scaffolding program can be determined, where the operating environment includes global operation and local operation; if the operating environment of the front-end scaffolding program is global operation, the first dependency directory path corresponding to the global operation is obtained, and if the operating environment of the front-end scaffolding program is local operation, the second dependency directory path corresponding to the local operation is obtained; according to the first dependency directory path or the second dependency directory path, the plugin directory where the corresponding live broadcast function plugin is located is determined; the front-end scaffolding program is caused to execute the corresponding plugin entry file in the plugin directory to load the corresponding live broadcast function plugin. It can dynamically load plugins to run as the program runs in different operating environments. At the same time, by dynamically loading different live broadcast function plugins in specific business scenarios, there is no need to add or modify other functions in the front-end scaffolding program, solving the problem that the front-end scaffolding program becomes increasingly bloated due to business requirements, reducing the volume of the front-end scaffolding program, making the front-end scaffolding easy to load, maintain, and expand, that is, improving the loading performance, maintainability, and scalability of the front-end scaffolding program.
[0081] Embodiment 2:
[0082] This embodiment provides a live broadcast function plugin loading device, which can be used to execute the live broadcast function plugin loading method of Embodiment 1 of the present application. For the details not disclosed in this embodiment, please refer to Embodiment 1 of the present application.
[0083] Please refer to Figure 3 , Figure 3 which is a schematic structural diagram of a live broadcast function plugin loading device disclosed in the embodiments of the present application. The live broadcast function plugin loading device can run in a server or a live broadcast client. The live broadcast function plugin loading device includes:
[0084] A first determination module 201, configured to determine the operating environment of the front-end scaffolding program, where the operating environment includes global operation and local operation;
[0085] An acquisition module 202, configured to, if the operating environment of the front-end scaffolding program is global operation, acquire the first dependency directory path corresponding to the global operation, and if the operating environment of the front-end scaffolding program is local operation, acquire the second dependency directory path corresponding to the local operation;
[0086] A second determination module 203, configured to determine the plugin directory where the corresponding live broadcast function plugin is located according to the first dependency directory path or the second dependency directory path;
[0087] A loading module 204, configured to cause the front-end scaffolding program to execute the corresponding plugin entry file in the plugin directory to load the live broadcast function plugin.
[0088] As an alternative implementation, the first determination module 201 obtains the front-end scaffolding directory path, where the front-end scaffolding directory path is the directory path of the file directory where the entry file of the front-end scaffolding program is located; if the front-end scaffolding directory path includes the directory path of a preset global package management tool, it is determined that the operating environment is global operation; if the front-end scaffolding directory path includes the directory path of the dependency packages of the current live business module and does not include the directory path of a preset global package management tool, it is determined that the operating environment is local operation.
[0089] As an alternative implementation, the second determination module 203 includes:
[0090] The first plugin directory determination module is configured to search for a first target directory with a preset prefix name in the first dependency directory path; and determine the first target directory as the plugin directory of the live function plugin;
[0091] The second plugin directory determination module is configured to obtain the plugin manifest file of the current live business module; read the plugin manifest file to obtain the prefix name of the live function plugin; search for a second target directory with the prefix name of the live function plugin in the second dependency directory path; and determine the second target directory as the plugin directory of the live function plugin.
[0092] As an alternative implementation, the loading module 204 causes the front-end scaffolding program to execute the corresponding plugin entry file in the plugin directory, and the specific way to load the live function plugin is as follows:
[0093] Pass the object of the front-end scaffolding program to the live function plugin;
[0094] Execute the corresponding plugin entry file in the plugin directory to cause the plugin to be loaded in the plugin operable environment provided by the object of the front-end scaffolding program.
[0095] In the live broadcast function plugin loading device according to the embodiment of the present application, the operating environment of the front-end scaffolding program can be determined, where the operating environment includes global operation and local operation; if the operating environment of the front-end scaffolding program is global operation, the first dependency directory path corresponding to the global operation is obtained, and if the operating environment of the front-end scaffolding program is local operation, the second dependency directory path corresponding to the local operation is obtained; according to the first dependency directory path or the second dependency directory path, the plugin directory where the corresponding live broadcast function plugin is located is determined; the front-end scaffolding program is enabled to execute the corresponding plugin entry file in the plugin directory to load the corresponding live broadcast function plugin. It can dynamically load plugins to run as the program is in different operating environments. At the same time, by dynamically loading different live broadcast function plugins in specific business scenarios, there is no need to add or modify other functions in the front-end scaffolding program, solving the problem that the front-end scaffolding program becomes more and more bloated due to business requirements, reducing the volume of the front-end scaffolding program, making the front-end scaffolding easy to load, maintain and expand, that is, improving the loading performance, maintainability and scalability of the front-end scaffolding program.
[0096] Embodiment III:
[0097] This embodiment provides an electronic device, which can be used to execute all or part of the steps of the live broadcast function plugin loading method according to Embodiment I of the present application. For the details not disclosed in this embodiment, please refer to Embodiment I of the present application.
[0098] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of the electronic device provided by the embodiment of the present application. The electronic device 900 can be, but is not limited to, a combination of one or more of various servers, personal computers, laptop computers, smart phones, tablet computers and other devices.
[0099] In a preferred embodiment of the present application, the electronic device 900 includes a memory 901, at least one processor 902, at least one communication bus 903 and a transceiver 904.
[0100] Those skilled in the art should understand that Figure 4 the structure of the electronic device shown does not constitute a limitation to the embodiment of the present application. It can be a bus structure or a star structure. The electronic device 900 may further include more or fewer other hardware or software than shown in the figure, or different component arrangements.
[0101] In some embodiments, the electronic device 900 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits, programmable gate arrays, digital signal processors, and embedded devices, etc. The electronic device 900 may also include a client device, which includes, but is not limited to, any electronic product that can interact with the client in a human-computer interaction manner through a keyboard, mouse, remote control, touchpad, or voice control device, etc. For example, personal computers, tablet computers, smart phones, digital cameras, etc.
[0102] It should be noted that the electronic device 900 is only an example. Other existing or future electronic products that can be adapted to this application should also be included within the protection scope of this application and are hereby incorporated by reference.
[0103] In some embodiments, a computer program is stored in the memory 901, and when the computer program is executed by the at least one processor 902, all or part of the steps in the live function plug-in loading method as described in Embodiment 1 are implemented. The memory 901 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electrically-erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc memories, magnetic disk memories, tape memories, or any other computer-readable medium capable of carrying or storing data.
[0104] In some embodiments, the at least one processor 902 is the control core of the electronic device 900. It connects various components of the entire electronic device 900 through various interfaces and circuits, and by running or executing programs or modules stored in the memory 901, as well as calling data stored in the memory 901, it performs various functions of the electronic device 900 and processes data. For example, when the at least one processor 902 executes the computer program stored in the memory, it implements all or part of the steps of the live function plugin loading method described in the embodiments of the present application; or implements all or part of the functions of the live function plugin loading device. The at least one processor 902 may be composed of integrated circuits. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips, etc.
[0105] In some embodiments, the at least one communication bus 903 is configured to implement connection communication between the memory 901 and the at least one processor 902, etc.
[0106] The electronic device 900 may also include various sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.
[0107] Embodiment 4:
[0108] This embodiment provides a computer-readable storage medium, on which a computer program is stored. The instructions are suitable for being loaded and executed by a processor to perform the live function plugin loading method of Embodiment 1 of the present application. The specific execution process can refer to the specific description of Embodiment 1 and will not be elaborated here.
[0109] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only illustrative. The components described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0110] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0111] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0112] The above are only the embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A method for loading a live broadcast function plugin, characterized in that, The method includes: Determine the running environment of the front-end scaffolding program, where the running environment includes global running and local running; If the running environment of the front-end scaffolding program is global running, obtain the first dependency directory path corresponding to global running. If the running environment of the front-end scaffolding program is local running, obtain the second dependency directory path corresponding to local running; Determine the plugin directory where the corresponding live broadcast function plugin is located according to the first dependency directory path or the second dependency directory path; Cause the front-end scaffolding program to execute the corresponding plugin entry file in the plugin directory to load the corresponding live broadcast function plugin; The determining the running environment of the front-end scaffolding program includes the following steps: Obtain the front-end scaffolding directory path, where the front-end scaffolding directory path is the directory path of the file directory where the entry file of the front-end scaffolding program is located; If the front-end scaffolding directory path includes the directory path of a preset global package management tool, determine that the running environment is global running; If the front-end scaffolding directory path includes the directory path of the dependency package of the current live broadcast service module and does not include the directory path of the preset global package management tool, determine that the running environment is local running.
2. The live broadcast function plug-in loading method according to claim 1, wherein The determining the plugin directory where the corresponding live broadcast function plugin is located according to the first dependency directory path or the second dependency directory path includes the following steps: Search for a first target directory with a preset prefix name in the first dependency directory path; Determine the first target directory as the plugin directory of the live broadcast function plugin; Or, Obtain the plugin manifest file of the current live broadcast service module; Read the plugin manifest file to obtain the prefix name of the live broadcast function plugin; Search for a second target directory with the prefix name of the live broadcast function plugin in the second dependency directory path; Determine the second target directory as the plugin directory of the live broadcast function plugin.
3. The live broadcast function plug-in loading method according to claim 2, wherein The causing the front-end scaffolding program to execute the corresponding plugin entry file in the plugin directory to load the live broadcast function plugin includes the following steps: Pass the object of the front-end scaffolding program to the live broadcast function plugin; Execute the corresponding plugin entry file in the plugin directory to cause the live broadcast function plugin to be loaded in the plugin runnable environment provided by the object of the front-end scaffolding program.
4. A live broadcast function plugin loading device, characterized in that, The live broadcast function plugin loading device includes: A first determination module for determining the running environment of the front-end scaffolding program, where the running environment includes global running and local running; An acquisition module for, if the running environment of the front-end scaffolding program is global running, obtaining the first dependency directory path corresponding to global running, and if the running environment of the front-end scaffolding program is local running, obtaining the second dependency directory path corresponding to local running; A second determination module for determining the plugin directory where the corresponding live broadcast function plugin is located according to the first dependency directory path or the second dependency directory path; A loading module for causing the front-end scaffolding program to execute the corresponding plugin entry file in the plugin directory to load the live broadcast function plugin; The first determination module obtains the front-end scaffolding directory path, where the front-end scaffolding directory path is the directory path of the file directory where the entry file of the front-end scaffolding program is located; if the front-end scaffolding directory path includes the directory path of a preset global package management tool, it is determined that the running environment is global running; if the front-end scaffolding directory path includes the directory path of the dependent packages of the current live business module and does not include the directory path of the preset global package management tool, it is determined that the running environment is local running.
5. The live broadcast function plug-in loading device according to claim 4, characterized in that, The second determination module includes: The first plug-in directory determination module is used to search for a first target directory with a preset prefix name in the first dependent directory path and determine the first target directory as the plug-in directory of the live function plug-in; The second plug-in directory determination module is used to obtain the plug-in manifest file of the current live business module, read the plug-in manifest file, obtain the prefix name of the live function plug-in, search for a second target directory with the prefix name of the live function plug-in in the second dependent directory path, and determine the second target directory as the plug-in directory of the live function plug-in.
6. The live broadcast function plug-in loading device according to claim 4, characterized in that, The loading module passes the object of the front-end scaffolding program to the live function plug-in and executes the corresponding plug-in entry file under the plug-in directory, so that the plug-in is loaded in the plug-in operable environment provided by the object of the front-end scaffolding program.
7. An electronic device, characterized in that, Includes: A processor and a memory, the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to perform the live function plug-in loading method according to any one of claims 1 to 3.
8. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the live function plug-in loading method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Video data storage system creation and file writing and reading method and device
CN107229421A
Front-end static resource management method, apparatus, computer device and storage medium
WO2020010724A1