CN116431233B - Resource loading method, device, equipment and storage medium - Google Patents

Resource loading method, device, equipment and storage medium Download PDF

Info

Publication number
CN116431233B
CN116431233B CN202310212713.3A CN202310212713A CN116431233B CN 116431233 B CN116431233 B CN 116431233B CN 202310212713 A CN202310212713 A CN 202310212713A CN 116431233 B CN116431233 B CN 116431233B
Authority
CN
China
Prior art keywords
resource
scene
resources
teaching scene
screen
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.)
Active
Application number
CN202310212713.3A
Other languages
Chinese (zh)
Other versions
CN116431233A (en
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.)
Beijing Siming Qichuang Technology Co ltd
Original Assignee
Beijing Siming Qichuang Technology 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 Beijing Siming Qichuang Technology Co ltd filed Critical Beijing Siming Qichuang Technology Co ltd
Priority to CN202310212713.3A priority Critical patent/CN116431233B/en
Publication of CN116431233A publication Critical patent/CN116431233A/en
Application granted granted Critical
Publication of CN116431233B publication Critical patent/CN116431233B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • 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/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Electrically Operated Instructional Devices (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a resource loading method, a device, equipment and a storage medium, wherein the method comprises the following steps: determining a first screen resource required by loading a first teaching scene according to the first teaching scene, and loading the first screen resource; after the first screen resource required by the first teaching scene is loaded, loading a first interactive resource of the first teaching scene and preloading a second first screen resource required by a second teaching scene; and under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene. The problem of the card when the resource is loaded is solved, and when two scenes use the same resource, the repeated release and repeated loading of the resource are realized, so that the time consumption from the beginning of loading to the entering of the corresponding reading state or the watching state when the teaching scene is switched is reduced, and the effect that the user can read or watch the corresponding content without waiting for a long time is realized.

Description

Resource loading method, device, equipment and storage medium
Technical Field
Embodiments of the present invention relate to data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for loading resources.
Background
Along with the development of communication technology, the use frequency of intelligent terminal devices such as mobile phones and tablet computers in daily life of people is higher and higher, and more users receive information through the intelligent terminal devices, for example, reading courseware through a computer to perform online learning.
When the client runs courseware, the courseware is divided into one scene, and each scene has a large number of animation, pictures and other resources which need to be loaded into the memory. If all scenes are loaded into the equipment memory at the same time, the memory occupation is too large to operate, one scene needs to be loaded, a new scene needs to be entered, an old scene needs to be released, the new scene needs to be loaded, and if all resources of the scenes are processed at the same time to display the scenes, so that the scenes can not be used for a short time when the scenes are switched.
In the prior art, the problem is solved by two schemes, one scheme is to enter a new scene and directly load the resources of the next scene, but at least the memory resources of two scenes exist at the same time, because the memory release has a slight delay, and the situation can not be consumed when switching the scenes; another solution is dynamic loading, which resources are used to load which resources immediately, when switching scenes, the resources of the old scenes are released, but there is a defect that when switching scenes, a large amount of resources may need to be loaded for the first round of picture display of the scenes, and the first round of picture display of the scenes may cause a jam.
Disclosure of Invention
The invention provides a loading method, a loading device, loading equipment and a storage medium, which are used for solving the problem of blocking during resource loading and the problem of repeated release and repeated loading of resources when two scenes use the same resources.
In a first aspect, an embodiment of the present invention provides a resource loading method, where the method includes:
determining a first screen resource required by loading a first teaching scene according to the first teaching scene, and loading the first screen resource;
after the first screen resource required by the first teaching scene is loaded, loading a first interactive resource of the first teaching scene and preloading a second first screen resource required by a second teaching scene;
and under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene.
Optionally, the releasing the resource of the first teaching scene includes:
if any resource only has the first scene mark corresponding to the first teaching scene, releasing the resource;
if any resource has a first scene mark corresponding to a first teaching scene and a second scene mark corresponding to a second teaching scene, reserving the resource and deleting the first scene mark of the resource.
Optionally, preloading the second first screen resource required by the second teaching scene includes:
and comparing the second first screen resource required by the second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain unloaded resources in the second first screen resource, and preloading unloaded resources in the second first screen resource.
The scene mark of the next scene is added to the simplest resources required for the next scene.
Optionally, comparing the second first screen resource required by the second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain an unloaded resource in the second first screen resource, including:
according to the comparison result, determining resources which are different from the loaded resources of the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which are different as unloaded resources in the second first screen resources; or,
and determining resources which do not have an association relationship with the loaded resources of the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which do not have the association relationship as unloaded resources in the second first screen resources.
Optionally, the determining, according to the first teaching scene, the first screen resource required for loading the first teaching scene includes:
determining a scene mark of a first teaching scene;
determining a resource array corresponding to the first teaching scene according to the scene mark based on the association relation between the predetermined candidate scene mark and the candidate resource; the resource array comprises at least two resources;
judging whether the resource is a first screen resource or not according to the attribute value of each resource in the resource array.
Optionally, before releasing the resources of the first teaching scene, the method includes:
judging that the second first screen resource required by the second teaching scene exists in the loaded resources of the first teaching scene, and if not, reloading the second first screen resource required by the second teaching scene.
In a second aspect, an embodiment of the present invention further provides a resource loading device, where the device includes:
the first loading module is used for determining a first screen resource required by loading the first teaching scene according to the first teaching scene and loading the first screen resource;
the second loading module is used for loading the first interactive resources of the first teaching scene and preloading the second first screen resources required by the second teaching scene after the first screen resources required by the first teaching scene are determined to be loaded;
the scene switching module is used for releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene under the condition that the first teaching scene is switched to the second teaching scene.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the resource loading method as described in any of the embodiments of the present application.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a resource loading method according to any of the embodiments of the present application.
According to the method, first screen resources required by loading a first teaching scene are determined according to the first teaching scene, and the first screen resources are loaded; after the first screen resource required by the first teaching scene is loaded, loading a first interactive resource of the first teaching scene and preloading a second first screen resource required by a second teaching scene; under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene, loading the second interactive resources of the second teaching scene, solving the problem of blocking during resource loading, and repeatedly releasing and loading the resources when the two scenes use the same resources, so as to reduce the time consumption from starting loading to entering the corresponding reading state or watching state during switching the teaching scenes, and enabling a user to read or watch the corresponding content without waiting for a long time.
Drawings
FIG. 1 is a flowchart of a resource loading method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a resource loading method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a resource loading device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a resource loading method according to an embodiment of the present invention, where the embodiment is applicable to a case of loading a reading object, the method may be performed by a loading device, and the device may be implemented in a software and/or hardware manner. The device can be configured in an electronic apparatus, and the method specifically comprises the following steps:
s110, determining a first screen resource required by loading a first teaching scene according to the first teaching scene, and loading the first screen resource;
the first teaching scene may refer to a current reading scene of a reading object, where the reading object may include courseware, cartoon, book, and the like, and the teaching scene may be divided according to chapter content of the reading object, for example, pages of the courseware, the cartoon, chapters of the book, and the like. The first screen may specifically be content that the reading device such as a smart phone enters into the first teaching scene to be displayed first, for example, a certain page of a courseware currently displayed on the screen of the smart phone.
The reading object includes various resources, for example, may refer to an image, a video, music, etc. in the reading object, and the first screen resource required by the first teaching scene may refer to a resource that needs to be displayed first when entering the first teaching scene, for example, when a certain page of a courseware is read through a smart phone, a picture, a video, music, etc. that needs to be displayed first after entering the page. The method comprises the steps that various attribute values of resources are set in an editor of a reading object in advance, a configuration file of the reading object is generated, wherein the attribute values of the resources can comprise an ID of the resources, a scene using the resources, a type of the resources, a storage address of the resources, whether the resources are first screen resources of a certain teaching scene or not, and the like.
Optionally, the determining, according to the first teaching scene, the first screen resource required for loading the first teaching scene includes:
determining a scene mark of a first teaching scene;
determining a resource array corresponding to the first teaching scene according to the scene mark based on the association relation between the predetermined candidate scene mark and the candidate resource; the resource array comprises at least two resources;
judging whether the resource is a first screen resource or not according to the attribute value of each resource in the resource array.
The scene mark of the first teaching scene may be a unique mark such as an ID number of the first teaching scene.
The association relation between the candidate scene mark and the candidate resource can be added into the configuration file of the reading object, a resource array corresponding to the first teaching scene is determined from the configuration file of the reading object according to the obtained scene mark, the resource array corresponding to the first teaching scene can be a set of all resources included in the first teaching scene, the set can include a file for recording attribute information of all the resources of the first teaching scene, the resource array comprises at least two resources, whether the resources are first screen resources or not is judged by reading attribute values of each resource in the resource array, and attribute information such as a storage address of the resources can be obtained to load the first screen resources.
Based on the above, when the reading object is loaded through the reading device such as the smart phone, all the teaching scenes included in the reading object can be obtained by reading the configuration file of the reading object, the teaching scenes can be loaded in sequence according to the sequence of the teaching scenes predefined by the configuration file of the reading object, for example, the sequence of the numbers of the teaching scenes can be customized by the user, for example, after all the teaching scenes included in the reading object are obtained, the user selects part of the teaching scenes to read according to the customized sequence. After the first teaching scene to be read is determined, a first screen resource required by the first teaching scene can be obtained according to the configuration file of the reading object, namely, the resource required to be displayed first after entering the first teaching scene.
S120, loading first interactive resources of a first teaching scene and preloading second first screen resources of a second teaching scene after loading of the first screen resources required by the first teaching scene is determined to be completed;
the first interactive resource may be a resource other than the first interactive resource in the first teaching scene, and because the first screen may be specifically a content that is displayed first when the reading device such as the smart phone enters the first teaching scene, no user operation is required, the first interactive resource may be a content that is displayed first in a non-first teaching scene that needs to be operated to be displayed after entering the first teaching scene, and the operation may include clicking, long pressing, sliding, automatic control of a program, timing control, and the like.
During actual use, the loading progress of the first screen resource can be monitored through a monitoring process, so that whether the first screen resource is loaded is determined timely, the process of loading the first interactive resource of the first teaching scene is started according to the result of the monitoring process, then a second teaching scene after the first teaching scene is determined according to the monitoring result of the loading progress of the first interactive resource, and the second first screen resource required by the second teaching scene is preloaded.
The method for loading the second first screen resource required by the second teaching scene is similar to the method for loading the first screen resource, and will not be described herein.
S130, under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene.
The resources of the first teaching scene comprise first screen resources and first interactive resources of the first teaching scene, under the condition that the first teaching scene is switched to the second teaching scene, the resources of the first teaching scene need to be released when the first teaching scene is displayed, and although the memory release has a little delay, the memory occupation is not too high due to the delay of the memory release when the first teaching scene is displayed, because the second first screen resources of the second teaching scene are preloaded when the first teaching scene is switched to the second teaching scene.
According to the invention, the first screen resource of the first teaching scene is loaded firstly, so that the time consumption from the beginning of loading to the entering of the reading state can be shortened, the user experience is improved, and the second first screen resource required by the second teaching scene is preloaded when the resources of the first teaching scene are displayed, so that the user can complete the loading of the resources of the next teaching scene on the premise of not influencing the speed of entering the reading state when using the reading equipment such as a smart phone and the like to switch the reading state of the second teaching scene when switching the reading equipment from the first teaching scene to the second teaching scene, and the user can conveniently switch the browsing chapters when browsing.
According to the method, first screen resources required by loading a first teaching scene are determined according to the first teaching scene, and the first screen resources are loaded; after the first screen resource required by the first teaching scene is loaded, loading a first interactive resource of the first teaching scene and preloading a second first screen resource required by a second teaching scene; under the condition that the first teaching scene is switched to the second teaching scene, the resources of the first teaching scene are released, the second interactive resources of the second teaching scene are loaded, the problem of blocking during resource loading is solved, the time consumption from the beginning of loading to the entering of the corresponding reading state or the watching state is realized, and the user can read or watch the effect of the corresponding content without waiting for a long time.
Example two
Fig. 2 is a flowchart of a resource loading method according to a second embodiment of the present invention, where the present embodiment is applicable to a case of loading a reading object, the method may be performed by a loading device, and the device may be implemented in a software and/or hardware manner. The device can be configured in an electronic apparatus, and the method specifically comprises the following steps:
s210, determining a first screen resource required by loading a first teaching scene according to the first teaching scene, and loading the first screen resource;
for example, when entering courseware, a configuration file of a reading object is obtained, whether a resource is used as soon as a user is in a scene can be judged through a resource attribute, namely whether the resource is a first screen resource is judged, after a first screen resource of a first teaching scene is determined, an ID value of the first screen resource is obtained, the ID value of the first teaching scene and a storage address of the first screen resource are loaded, for example, the ID value is 999-scene 1, wherein '999' is the ID value of the first screen resource, and 'scene 1' is the ID value of the first teaching scene.
S220, loading a first interactive resource of the first teaching scene after the first screen resource required by the first teaching scene is determined to be loaded;
the first interactive resource may be content that is displayed first in a non-first teaching scene that needs to be operated to be displayed after entering the first teaching scene, where the operation may include clicking, long pressing, sliding, automatic control of a program, timing control, and the like.
In actual use, a monitoring process can be set in the memory management system to monitor the loading progress of the first screen resource, so as to timely determine whether the first screen resource is loaded, start the process of loading the first interactive resource of the first teaching scene according to the result of the monitoring process, then determine the second teaching scene after the first teaching scene according to the monitoring result of the first interactive resource loading progress, preload the second first screen resource required by the second teaching scene, and execute step S230.
Optionally, the loading the first interactive resource of the first teaching scene includes:
determining a scene mark of a first teaching scene;
determining a resource array corresponding to the first teaching scene according to the scene mark based on the association relation between the predetermined candidate scene mark and the candidate resource; the resource array comprises at least two resources;
judging whether the resource is a first interactive resource according to the attribute value of each resource in the resource array.
The scene mark of the first teaching scene may be a unique mark such as an ID number of the first teaching scene.
Optionally, a two-classification method may be further adopted, where when the first screen resource is determined in step S210, all other resources in the resource array corresponding to the first teaching scene that are not the first screen resource are determined as first interactive resources, and after the process of loading the first interactive resources of the first teaching scene is started, the first interactive resources of the first teaching scene are loaded.
S230, comparing a second first screen resource required by a second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain unloaded resources in the second first screen resource, and preloading unloaded resources in the second first screen resource;
specifically, the association relationship between the candidate scene mark and the candidate resource may be pre-determined and added to the configuration file of the reading object, and the resource array corresponding to the second teaching scene is determined from the configuration file of the reading object according to the obtained second scene mark, where the resource array corresponding to the second teaching scene may be a set of all resources included in the second teaching scene, and a file recording attribute information of all resources of the second teaching scene may be included in the set, and a method for determining the second first screen resource required by the second teaching scene is similar to the method for determining the first screen resource required by the first teaching scene and is not repeated herein.
After determining the second first screen resource required by the second teaching scene, comparing attribute information of any resource of the second first screen resource with attribute information of any resource of the first teaching scene, if the attribute information is consistent, determining that the resource is loaded in the first teaching scene, and when loading the second first screen resource, without loading the resource, removing unloaded resources in the second first screen resource from the second first screen resource when loading the resource, and preloading unloaded resources in the second first screen resource.
Optionally, comparing the second first screen resource required by the second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain an unloaded resource in the second first screen resource, including:
according to the comparison result, determining resources which are different from the first screen resources and the first interaction resources loaded by the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which are different as unloaded resources in the second first screen resources; or,
and determining resources which do not have an association relationship with the first screen resources loaded in the first teaching scene and the first interactive resources in the second first screen resources required by the second teaching scene, and taking the resources which do not have the association relationship as unloaded resources in the second first screen resources.
The resources may have an association relationship, where the association relationship includes a first relationship, and the first relationship may refer to that any one of a first screen resource and a first interaction resource loaded in a first teaching scene includes any one of a second first screen resource, for example, a resource a of the first teaching scene includes a resource B of a second teaching scene.
For example, for any resource in the second first screen resource, compared with the resource loaded by the first teaching scene, only part of attribute information can be compared to determine whether the resource is the same resource, for example, an ID value of the resource, a storage address of the resource, and the like, and all attribute information can be compared to determine whether the resource is the resource with the association relationship. For example, if the ID values of the resources are the same, it may be determined that the resources are the same, and the resources that are not the same are used as unloaded resources in the second first screen resource; if the ID values of the resources are different, further acquiring attribute information to further determine, if the attribute information of the resource a includes attribute information of the resource B, and if the attribute information of the resource a and the attribute information of the resource B both include attribute information of the resource C, it may be determined that there is an association relationship between the two resources, and the resource that does not have the association relationship is used as an unloaded resource in the second first screen resource.
Optionally, the association relationship further includes a second relationship, where the second relationship may mean that any resource in the second first screen resource includes any resource in the first screen resource and the first interaction resource that have been loaded by the first teaching scene. For example, resource B of the second teaching scene includes resource a of the first teaching scene. For example, resource A of the second teaching scene includes resource B of the first teaching scene. Optionally, the association relationship further includes a third relationship, where the third relationship may refer to a resource that any one of the first screen resource and the first interaction resource loaded in the first teaching scene and any one of the second first screen resource has a partial same resource. For example, resource a of the first teaching scene exists with resource B of the second teaching scene in the same resource C.
At this time, the comparing the second first screen resource required by the second teaching scene with the first screen resource loaded by the first teaching scene and the first interactive resource, so as to obtain an unloaded resource in the second first screen resource, which may be a resource having an association relationship with the first screen resource loaded by the first teaching scene and the first interactive resource in the second first screen resource required by the second teaching scene, to obtain at least two new resources, where the at least two new resources include at least one resource with the same portion and at least one resource with different portion in the two resources with the association relationship; comparing the at least two new resources with the loaded first screen resource and the loaded first interactive resource of the first teaching scene to obtain a comparison result, determining resources which are different from the loaded first screen resource and the loaded first interactive resource of the first teaching scene in the at least two new resources according to the comparison result, and taking the resources which are different as unloaded resources in the second first screen resource; or determining the resources which do not have the first relation with the first screen resource and the first interaction resource loaded in the first teaching scene in the at least two new resources, and taking the resources which do not have the first relation as the resources which are not loaded in the second first screen resource.
S240, under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene.
Optionally, the releasing the resource of the first teaching scene includes:
if any resource only has the first scene mark corresponding to the first teaching scene, releasing the resource;
if any resource has a first scene mark corresponding to a first teaching scene and a second scene mark corresponding to a second teaching scene, reserving the resource and deleting the first scene mark of the resource.
The first scene mark may be a unique mark such as an ID number of the first teaching scene.
Optionally, when the first screen resource of the first teaching scene is loaded in step S210, a first scene mark is added to any resource in the loaded first screen resource, when the first interactive resource of the first teaching scene is loaded in step S220, a first scene mark is added to any resource in the loaded first interactive resource, when the second first screen resource of the second teaching scene is loaded in step S230, a scene mark of the second first screen resource is added to any resource in the loaded second teaching scene, and if any resource of the second first screen resource is loaded in the first teaching scene, a scene mark of the second teaching scene is still added to the resource, and the scene mark of the first teaching scene and the scene mark of the second teaching scene exist simultaneously. Further, when loading the second interactive resource of the second teaching scene in step S240, adding a scene tag of the second teaching scene to any resource of the loaded second interactive resource, since the memory release has a certain postponement, it can be determined that any resource of the second interactive resource is loaded in the first teaching scene by using the postponement period, if so, still adding a scene tag of the second teaching scene to the resource, where the scene tag of the first teaching scene and the scene tag of the second teaching scene exist at the same time.
Optionally, the operation of adding the scene mark may be further determined according to a predetermined association relationship between the candidate scene mark and the candidate resource, and the resource array corresponding to the teaching scene may be a set of all resources included in the teaching scene, where a resource in the resource array corresponding to the teaching scene has a scene mark of the teaching scene corresponding to the resource array, for example, a resource in the resource array corresponding to the first teaching scene has a scene mark of the first teaching scene, a resource in the resource array corresponding to the second teaching scene has a scene mark of the second teaching scene, and when the resource of the corresponding teaching scene is loaded, the scene mark of the resource may be obtained, and if a certain resource has scene marks of a plurality of teaching scenes at the same time, it indicates that the resource has been loaded in a previous teaching scene, for example, a certain resource has a scene mark of the first teaching scene and a scene mark of the second teaching scene at the same time, and it indicates that the resource has been loaded in the first teaching scene, and when the first teaching scene is switched from the first teaching scene to the second teaching scene, it is not necessary to reload the resource. The disadvantage of this operation is that since the scene markers of the resources are pre-added and the first teaching scene precedes the second teaching scene, the scene markers of the first teaching scene and the scene markers of the second teaching scene can only be added simultaneously to the same resources or resources having the first relationship.
Alternatively, the number of references of the resource may be counted, for example, if a certain resource has two scene marks, the number of references is 2, when a certain resource newly adds a scene mark, the number of references is increased by one, when the teaching scene is switched, the number of references is decreased by one, and if the number of references is zero, the resource is released. The problem of reloading of the same resource can be solved by scene marking of the resource and the reference times of the resource. Optionally, the operation of all scenes is finished, all scene marks of the resources are deleted, the reference times are zeroed, all the resources are released, and the problem that some resources are released in a missing way due to process reference errors, for example, the reference times are increased by one due to the fact that the resources are not loaded successfully, is avoided.
According to the method, first screen resources required by loading a first teaching scene are determined according to the first teaching scene, and the first screen resources are loaded; after the fact that loading of the first screen resource required by the first teaching scene is completed is determined, loading a first interactive resource of the first teaching scene; comparing a second first screen resource required by a second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain unloaded resources in the second first screen resource, and preloading unloaded resources in the second first screen resource; under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene, loading the second interactive resources of the second teaching scene, and solving the problem of repeated release and repeated loading of the resources when the two scenes use the same resources.
On the basis of the foregoing embodiments, before releasing the resources of the first teaching scene, the method includes:
judging that the second first screen resource required by the second teaching scene exists in the loaded resources of the first teaching scene, and if not, reloading the second first screen resource required by the second teaching scene.
For example, when the scene is switched, a resource array corresponding to the second teaching scene is obtained, a second first screen resource required by the second teaching scene is determined and loaded, the memory management bottom layer can determine whether the second first screen resource is reloaded, for example, the memory management bottom layer can reload the second first screen resource required by the second teaching scene according to whether the attribute field in the log is reloaded or not, if not, the memory management bottom layer can reload the second first screen resource required by the second teaching scene.
Example III
Fig. 3 is a schematic structural diagram of a resource loading device according to a third embodiment of the present invention, where the embodiment is applicable to loading a reading object, and the specific structure of the device is as follows:
including a first loading module 310, a second loading module 320, and a scene switching module 330.
The first loading module 310 is configured to determine, according to a first teaching scene, a first screen resource required for loading the first teaching scene, and load the first screen resource;
the second loading module 320 is configured to load a first interactive resource of the first teaching scene and preload a second first screen resource of the second teaching scene after determining that loading of the first screen resource required by the first teaching scene is completed;
the scene switching module 330 is configured to release the resources of the first teaching scene and load the second interactive resources of the second teaching scene when the first teaching scene is switched to the second teaching scene.
According to the method, first screen resources required by loading a first teaching scene are determined according to the first teaching scene, and the first screen resources are loaded; after the first screen resource required by the first teaching scene is loaded, loading a first interactive resource of the first teaching scene and preloading a second first screen resource required by a second teaching scene; under the condition that a first teaching scene is switched to a second teaching scene, releasing resources of the first teaching scene, loading second interactive resources of the second teaching scene, solving the problem of blocking during resource loading, and realizing time consumption from starting loading to entering a corresponding reading state or a viewing state, so that a user can read or view effects of corresponding contents without waiting for a long time
On the basis of the technical scheme, the scene switching module comprises a resource releasing unit, wherein the resource releasing unit is used for:
if any resource only has the first scene mark corresponding to the first teaching scene, releasing the resource; if any resource has a first scene mark corresponding to a first teaching scene and a second scene mark corresponding to a second teaching scene, reserving the resource and deleting the first scene mark of the resource.
On the basis of the technical scheme, the second loading module comprises a preloading unit, and the preloading unit is used for:
and comparing the second first screen resource required by the second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain unloaded resources in the second first screen resource, and preloading unloaded resources in the second first screen resource.
On the basis of the technical scheme, the preloading unit is specifically used for:
according to the comparison result, determining resources which are different from the loaded resources of the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which are different as unloaded resources in the second first screen resources; or,
and determining resources which do not have an association relationship with the loaded resources of the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which do not have the association relationship as unloaded resources in the second first screen resources.
On the basis of the technical scheme, the first loading module comprises a first screen resource determining unit, and the first screen resource determining unit is used for:
determining a scene mark of a first teaching scene;
determining a resource array corresponding to the first teaching scene according to the scene mark based on the association relation between the predetermined candidate scene mark and the candidate resource; the resource array comprises at least two resources;
judging whether the resource is a first screen resource or not according to the attribute value of each resource in the resource array.
On the basis of the technical scheme, the scene switching module comprises a reloading unit, wherein the reloading unit is used for: before releasing the resources of the first teaching scene, judging that the second first screen resources required by the second teaching scene exist in the loaded resources of the first teaching scene, and if not, reloading the second first screen resources required by the second teaching scene.
The resource loading device provided by the embodiment of the invention can execute the resource loading method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention, and as shown in fig. 4, the electronic device includes a processor 410, a memory 420, an input device 430 and an output device 440; the number of processors 410 in the electronic device may be one or more, one processor 410 being taken as an example in fig. 4; the processor 410, memory 420, input device 430, and output device 440 in the electronic device may be connected by a bus or other means, for example in fig. 4.
The memory 420 is used as a computer readable storage medium for storing software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the resource loading method in the embodiment of the present invention (for example, the first loading module 310, the second loading module 320, and the scene switching module 330 in the resource loading device). The processor 410 executes various functional applications of the device/terminal/server and data processing by running software programs, instructions and modules stored in the memory 420, i.e., implements the resource loading method described above.
Memory 420 may include primarily a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required for functionality; the storage data area may store data created according to the use of the terminal, etc. In addition, memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 420 may further include memory remotely located with respect to processor 410, which may be connected to the device/terminal/server via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 430 may be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the electronic device. The output 440 may include a display device such as a display screen.
Example five
The fifth embodiment of the present invention further provides a computer readable storage medium, on which a computer program is stored, where the program is executed by a processor to implement a resource loading method according to any one of the embodiments of the present application.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform the related operations in the resource loading method provided in any embodiment of the present invention.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.
It should be noted that, in the above-mentioned embodiments of the search apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above-mentioned division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (9)

1. A method for loading resources, comprising:
determining a first screen resource required by loading a first teaching scene according to the first teaching scene, and loading the first screen resource;
after the first screen resource required by the first teaching scene is loaded, loading a first interactive resource of the first teaching scene and preloading a second first screen resource required by a second teaching scene;
under the condition that the first teaching scene is switched to the second teaching scene, releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene;
the determining, according to the first teaching scene, a first screen resource required for loading the first teaching scene includes:
determining a scene mark of a first teaching scene;
determining a resource array corresponding to the first teaching scene according to the scene mark based on the association relation between the predetermined candidate scene mark and the candidate resource; the resource array comprises at least two resources;
judging whether the resource is a first screen resource or not according to the attribute value of each resource in the resource array;
and counting the reference times of the resources, deleting all scene marks of the resources when all scene operations are finished, zeroing the reference times, and releasing all the resources.
2. The method of claim 1, wherein releasing the resources of the first teaching scene comprises:
if any resource only has the first scene mark corresponding to the first teaching scene, releasing the resource;
if any resource has a first scene mark corresponding to a first teaching scene and a second scene mark corresponding to a second teaching scene, reserving the resource and deleting the first scene mark of the resource.
3. The method of claim 1, wherein preloading the second first screen resources required for the second teaching scene comprises:
and comparing the second first screen resource required by the second teaching scene with the loaded first screen resource and the first interactive resource of the first teaching scene to obtain unloaded resources in the second first screen resource, and preloading unloaded resources in the second first screen resource.
4. The method of claim 3, wherein comparing the second first screen resource required by the second teaching scene with the first screen resource loaded by the first teaching scene and the first interactive resource to obtain the unloaded resource in the second first screen resource comprises:
according to the comparison result, determining resources which are different from the loaded resources of the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which are different as unloaded resources in the second first screen resources; or,
and determining resources which do not have an association relationship with the loaded resources of the first teaching scene in the second first screen resources required by the second teaching scene, and taking the resources which do not have the association relationship as unloaded resources in the second first screen resources.
5. The method of claim 1, wherein before releasing the resources of the first teaching scene, comprising:
judging that the second first screen resource required by the second teaching scene exists in the loaded resources of the first teaching scene, and if not, reloading the second first screen resource required by the second teaching scene.
6. A resource loading device, comprising:
the first loading module is used for determining a first screen resource required by loading the first teaching scene according to the first teaching scene and loading the first screen resource;
the second loading module is used for loading the first interactive resources of the first teaching scene and preloading the second first screen resources required by the second teaching scene after the first screen resources required by the first teaching scene are determined to be loaded;
the scene switching module is used for releasing the resources of the first teaching scene and loading the second interactive resources of the second teaching scene under the condition that the first teaching scene is switched to the second teaching scene;
the first loading module comprises a first screen resource determining unit, and the first screen resource determining unit is used for: determining a scene mark of a first teaching scene; determining a resource array corresponding to the first teaching scene according to the scene mark based on the association relation between the predetermined candidate scene mark and the candidate resource; the resource array comprises at least two resources; judging whether the resource is a first screen resource or not according to the attribute value of each resource in the resource array;
and counting the reference times of the resources, deleting all scene marks of the resources when all scene operations are finished, zeroing the reference times, and releasing all the resources.
7. The apparatus of claim 6, wherein the context switch module comprises a resource release unit to:
if any resource only has the first scene mark corresponding to the first teaching scene, releasing the resource; if any resource has a first scene mark corresponding to a first teaching scene and a second scene mark corresponding to a second teaching scene, reserving the resource and deleting the first scene mark of the resource.
8. An electronic device, the electronic device comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the resource loading method of any of claims 1-6.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the resource loading method according to any of claims 1-6.
CN202310212713.3A 2023-02-28 2023-02-28 Resource loading method, device, equipment and storage medium Active CN116431233B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310212713.3A CN116431233B (en) 2023-02-28 2023-02-28 Resource loading method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310212713.3A CN116431233B (en) 2023-02-28 2023-02-28 Resource loading method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116431233A CN116431233A (en) 2023-07-14
CN116431233B true CN116431233B (en) 2024-04-09

Family

ID=87088037

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310212713.3A Active CN116431233B (en) 2023-02-28 2023-02-28 Resource loading method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116431233B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453484A (en) * 2007-11-28 2009-06-10 中兴通讯股份有限公司 Cache updating method in mobile stream media scenic service
CN103729558A (en) * 2013-12-26 2014-04-16 北京像素软件科技股份有限公司 Scene change method
CN104035921A (en) * 2013-03-04 2014-09-10 联想(北京)有限公司 Information processing method and electronic devices
CN104850415A (en) * 2014-02-13 2015-08-19 腾讯科技(深圳)有限公司 Method and apparatus for loading pages
CN105955766A (en) * 2016-04-22 2016-09-21 北京小米移动软件有限公司 Method and device for application preloading
CN112596820A (en) * 2020-12-30 2021-04-02 北京达佳互联信息技术有限公司 Resource loading method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453484A (en) * 2007-11-28 2009-06-10 中兴通讯股份有限公司 Cache updating method in mobile stream media scenic service
CN104035921A (en) * 2013-03-04 2014-09-10 联想(北京)有限公司 Information processing method and electronic devices
CN103729558A (en) * 2013-12-26 2014-04-16 北京像素软件科技股份有限公司 Scene change method
CN104850415A (en) * 2014-02-13 2015-08-19 腾讯科技(深圳)有限公司 Method and apparatus for loading pages
CN105955766A (en) * 2016-04-22 2016-09-21 北京小米移动软件有限公司 Method and device for application preloading
CN112596820A (en) * 2020-12-30 2021-04-02 北京达佳互联信息技术有限公司 Resource loading method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN116431233A (en) 2023-07-14

Similar Documents

Publication Publication Date Title
CN109766457B (en) Media content searching method, device and storage medium
CN108495185B (en) Video title generation method and device
CN111654749B (en) Video data production method and device, electronic equipment and computer readable medium
US20210160553A1 (en) Method and system of displaying a video
CN107748615B (en) Screen control method and device, storage medium and electronic equipment
CN112738633B (en) Video playing method, device, equipment and readable storage medium
CN109165052B (en) Interactive processing method and device of application scene, terminal, system and storage medium
CN108228776B (en) Data processing method, data processing device, storage medium and electronic equipment
CN111371953A (en) Tag data processing method, device and storage medium
CN111400633A (en) Page resource loading method and device
CN113938551B (en) Caching method and device, electronic equipment and storage medium
CN109116718B (en) Method and device for setting alarm clock
CN113076288A (en) File processing method and device, electronic equipment and storage medium
CN110798521B (en) File sharing method and device, electronic equipment and storage medium
CN111050217B (en) Video playing method and device
CN116431233B (en) Resource loading method, device, equipment and storage medium
CN113992784B (en) Audio and video call method, device, computer equipment and storage medium
CN112423099A (en) Video loading method and device and electronic equipment
CN114925285A (en) Book information processing method, device, equipment and storage medium
CN114860238A (en) Page generation method and device and electronic equipment
CN108647197B (en) Information processing method, device and storage medium
CN112988005A (en) Method for automatically loading captions
CN110888643A (en) Page processing method and device
CN111294641B (en) Video playing method, system, device, electronic equipment and readable storage medium
EP4344231A1 (en) Video processing method and apparatus, and device and storage medium

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
GR01 Patent grant
GR01 Patent grant