Preloading method and device of media file, electronic equipment and storage medium

By obtaining the playback address and header size of the media file, a preloading task is created and preloading is performed based on the file offset. This solves the problem of insufficient flexibility in media file playback, achieves efficient loading at any point in time, avoids performance waste and bandwidth consumption, and improves the user experience.

CN116600169BActive Publication Date: 2026-05-29DOUYIN VISION CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DOUYIN VISION CO LTD
Filing Date
2023-05-29
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing technologies, it is impossible to preload enough media data at any point in time when playing media files, resulting in low playback flexibility, wasted performance and bandwidth consumption, and negatively impacting user experience.

Method used

By obtaining the playback address and header size of the media file, a preloading task is created, and preloading is performed based on the file offset to ensure that enough media data can be loaded when the user starts playback at any time.

Benefits of technology

It improves the flexibility of media file playback, avoids performance waste and unnecessary data consumption, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116600169B_ABST
    Figure CN116600169B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a preloading method and device of a media file, an electronic device and a storage medium. The method is applied to a media player and includes: obtaining media information of a media file to be played, wherein the media information includes a playing address and a file header size of the media file to be played; creating a preloading task of the media file to be played based on the file header size, wherein the preloading task carries a preloading strategy, and the preloading strategy is used to indicate a preloading size of the media file to be played; obtaining a file offset of the media file to be played based on the playing address, and preloading the media file to be played based on the preloading size and the file offset. The present disclosure can ensure that enough media data can be preloaded when the user starts playing the media file at any time point, thereby improving the flexibility of media file playing, avoiding the waste of performance and unnecessary traffic consumption, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of media playback technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for preloading media files. Background Technology

[0002] With the rapid development of internet and multimedia technologies, a wide variety of multimedia applications have emerged. Currently, during media file playback, to ensure that users can quickly start playback without experiencing stuttering or buffering, media data is typically preloaded from the beginning for several seconds based on the user's playback behavior. However, in some cases, users do not want to start playback from second zero. Therefore, existing preloading methods cannot guarantee that sufficient media data will be preloaded when a user starts playback at any point in time, resulting in low flexibility in media file playback and consequently affecting the user experience.

[0003] Furthermore, since the file header size and the relationship between the start time and file offset are unknown before decoding the media file, the preload size of the media file cannot be accurately determined. Therefore, media data from the file header to the start time is usually preloaded. However, this part of the media data will not be played by the user, thus resulting in wasted performance and unnecessary bandwidth consumption. Summary of the Invention

[0004] In view of the above, embodiments of this disclosure provide a method, apparatus, electronic device, and computer-readable storage medium for preloading media files to solve the problems existing in the related art.

[0005] A first aspect of this disclosure provides a method for preloading media files, applied to a media player. The method includes: obtaining media information of a media file to be played, wherein the media information includes a playback address and a file header size of the media file to be played; creating a preloading task for the media file to be played based on the file header size, wherein the preloading task carries a preloading strategy, the preloading strategy being used to indicate the preload size of the media file to be played; obtaining a file offset of the media file to be played based on the playback address, and preloading the media file to be played based on the preload size and the file offset.

[0006] A second aspect of this disclosure provides a media file preloading apparatus applied to a media player. The apparatus includes: an acquisition module configured to acquire media information of a media file to be played, wherein the media information includes a playback address and a file header size of the media file to be played; a creation module configured to create a preloading task for the media file to be played based on the file header size, wherein the preloading task carries a preloading strategy, the preloading strategy indicating the preload size of the media file to be played; and a preloading module configured to acquire a file offset of the media file to be played based on the playback address, and preload the media file to be played based on the preload size and the file offset.

[0007] A third aspect of this disclosure provides an electronic device including at least one processor; a memory for storing at least one processor-executable instruction; wherein the at least one processor is used to execute the instruction to implement the steps of the method described above.

[0008] A fourth aspect of this disclosure provides a computer-readable storage medium that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the steps of the above-described method.

[0009] The above-mentioned at least one technical solution adopted in the embodiments of this disclosure can achieve the following beneficial effects: by obtaining the media information of the media file to be played, which includes the playback address and file header size of the media file to be played; creating a preloading task for the media file to be played based on the file header size, the preloading task carrying a preloading strategy for indicating the preloading size of the media file to be played; obtaining the file offset of the media file to be played based on the playback address, and preloading the media file to be played based on the preloading size and the file offset, it can be ensured that sufficient media data can be preloaded when the user starts playing the media file at any time. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is enhanced. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a flowchart illustrating a media file preloading method provided as an exemplary embodiment of the present disclosure.

[0012] Figure 2This is a flowchart illustrating another method for preloading media files provided as an exemplary embodiment of the present disclosure.

[0013] Figure 3 This is a flowchart illustrating another method for preloading media files provided as an exemplary embodiment of the present disclosure.

[0014] Figure 4 This is a schematic diagram of the structure of a media file preloading device provided as an exemplary embodiment of the present disclosure.

[0015] Figure 5 A schematic diagram of the structure of an electronic device provided for an exemplary embodiment of this disclosure.

[0016] Figure 6 This is a schematic diagram of the structure of a computer system provided for an exemplary embodiment of the present disclosure. Detailed Implementation

[0017] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0018] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0019] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0020] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0021] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0022] A method and apparatus for preloading media files according to embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings.

[0023] Figure 1 A flowchart illustrating a media file preloading method provided as an exemplary embodiment of this disclosure. Figure 1 The method for preloading media files can be executed by the media player. For example... Figure 1 As shown, the preloading method for this media file includes:

[0024] S101, Obtain the media information of the media file to be played, wherein the media information includes the playback address and file header size of the media file to be played;

[0025] S102, create a preloading task for the media file to be played based on the file header size, wherein the preloading task carries a preloading strategy, which is used to indicate the preloading size of the media file to be played;

[0026] S103: Obtain the file offset of the media file to be played based on the playback address, and preload the media file to be played based on the preload size and the file offset.

[0027] Specifically, after obtaining the media information of the media file to be played, the media player can create a preloading task for the media file to be played based on the file header size of the media file to be played included in the media information. The preloading task carries a preloading strategy for indicating the preloading size of the media file to be played. Further, the media player obtains the file offset of the media file to be played based on the playback address, and preloads the media file to be played based on the preloading size and the file offset.

[0028] Here, a media file refers to a file that stores encoded media data (e.g., at least one of audio and video data) in a container (Box), which also includes metadata (i.e., data describing the media data) that carries media information to ensure that the media data is correctly decoded.

[0029] A container, also known as a box, is an object-oriented component defined by a unique type identifier and length. It includes a container header and container data, which are filled with binary data used to express various information. The container header includes a size and a type. The size characterizes the amount of storage space occupied by the container (also referred to as size or length in this disclosure), and the type characterizes the type of the container. The container data portion can store specific data or further encapsulate other types of containers.

[0030] Taking Moving Picture Experts Group 4 (MP4) media files as an example, the basic container types involved in MP4 files include file type containers (ftyp boxes), metadata containers (moov boxes), and media data containers (mdat boxes). A file type container is a container in a media file used to store the file's capacity (i.e., the length in bytes) and type. A metadata container is a container in a media file used to store metadata (i.e., data describing the media data stored in the media data container). The information expressed by the binary data stored in the metadata container of an MP4 file is called media information. A media data container is a container in a media file used to store media data.

[0031] In practical applications, media information may include information such as offset, size, index, and timestamp of video frames and / or audio frames in the media file, as well as information such as playback address, playback order, playback position, and playback progress of the media file. This disclosure does not limit this information.

[0032] The file header is located at the beginning of a media file and is used to describe information such as the size (i.e., capacity) and type of the media file so that applications can parse and open it. It's important to note that the header size of an MP4 file is positively correlated with the duration of the media file; that is, the longer the media file, the larger the header; and the shorter the media file, the smaller the header.

[0033] The media file to be played can be an internet video file, such as movies, TV series, sports programs, variety shows, etc. on video websites; it can also be a music file, such as free music, paid music, etc. on music websites; or it can be other types of files that can be played by a media player, and this disclosure does not limit this. Furthermore, the media file to be played can adopt a non-streaming media format. A non-streaming media format is a packaging technology that encapsulates media data into a media file, and this media file must be completely downloaded before it can be decoded and played. Non-streaming media format files can include, but are not limited to, MP4 files, MKV file format, Windows Media Video (WMV) files, Advanced Streaming Format (ASF) files, etc. A streaming media format is a file that encapsulates media data into a streaming media format. The media file does not need to be completely downloaded or additionally transcoded to be decoded and played; that is, it natively supports downloading and playing simultaneously. Streaming media format files can include, but are not limited to, TS media file segments based on HTTP Live Streaming (HLS) technology, FLV (Flash Video) files, etc.

[0034] It should be noted that MP4 files do not natively support streaming media playback. However, by transcoding the media stream online and then transcoding it to the player, or by filling the missing parts of a partially downloaded MP4 file with invalid binary data (for example, in the case of a complete download of the ftyp box and moov box, the missing parts of the mdat box are filled with invalid binary data), it is possible to achieve the technical effect of downloading and playing simultaneously. This disclosure refers to the encapsulation format of such files that do not natively support streaming media playback as a non-streaming media format.

[0035] A media player refers to software that plays video or audio files stored in digital signal form, or a device with the function of playing video or audio files. In the embodiments of this disclosure, the media player is an electronic device used by a user that can play audio and / or video files. This electronic device may include, but is not limited to, smartphones, tablets, laptops, desktop computers, personal digital assistants (PDAs), smart TVs, smartwatches, smart glasses, smart bracelets, etc.

[0036] Preloading refers to downloading a media file of a certain length in advance. When a user clicks to play the media file, playback can begin immediately without waiting for network loading. The preloading task loads subsequent media files and carries a preloading strategy, which can be used to limit the preload size of the media file to be played. Generally, if the preload is too small, the effect of instant playback (instant playback means seeing the playback screen within one second after clicking play) cannot be achieved; if the preload is too large, it is a waste of bandwidth. Therefore, the preload size can be set according to actual needs. For example, the preload size can be any value within the range of 500 kilobytes (KB) to 1 megabyte (MB). Preferably, in this embodiment of the disclosure, the preload size is 800KB.

[0037] File offset refers to the number of bytes moved forward or backward from a specified position to locate the required data within a file. Generally, offsets can include three types: first, moving several bytes backward from the beginning of the file to find the target; second, moving several bytes forward from the end of the file to find the target; and third, moving forward or backward from the current position in the file to find the target. In this embodiment of the disclosure, all file offsets are the first type, i.e., from the beginning of the file to the position where the required data is needed.

[0038] According to the technical solution provided in this disclosure, by obtaining media information of the media file to be played, including the playback address and file header size of the media file; creating a preloading task for the media file to be played based on the file header size, the preloading task carrying a preloading strategy for indicating the preloading size of the media file to be played; obtaining the file offset of the media file to be played based on the playback address, and preloading the media file to be played based on the preloading size and the file offset, it can be ensured that sufficient media data can be preloaded when the user starts playing the media file at any time. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is enhanced.

[0039] In some embodiments, obtaining media information of a media file to be played includes: sending a media file playback request to a media server, wherein the media file playback request carries a file identifier of the media file to be played; and receiving media information of the media file to be played corresponding to the file identifier sent by the media server.

[0040] Specifically, the media player integrates a media playback component corresponding to the media server, namely a Software Development Kit (SDK). This component acts as a bridge for communication between the media player and the media server and is used to play media files obtained from a Content Delivery Network (CDN). After successfully logging into the media server with an account, the media player can send a media file playback request to the media server, carrying the file identifier of the media file to be played. Upon receiving the media file playback request, the media server will send the media information of the media file to be played, which corresponds to the file identifier, from its media database or CDN, to the media player.

[0041] Here, a media server refers to a server that can provide various media services to media playback applications within a media player. These various media services may include, but are not limited to, data storage services and interactive information sending and receiving services. Data storage services refer to services that store various types of data (e.g., multimedia data, interactive information), while interactive information sending and receiving services refer to services that receive interactive information and send interactive information to media playback applications.

[0042] The media server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. This disclosure does not limit the scope of the disclosure.

[0043] A media file playback request is used to request the media server to play a media file to be played, and includes the file identifier (ID) of the media file to be played. The file identifier is a unique identifier used to represent the media file, including but not limited to letters, numbers, symbols, etc.

[0044] According to the technical solution provided in the embodiments of this disclosure, the file header size of the media file to be played can be obtained from the received media information, and a preloading task of the media file to be played can be created based on the file header size. Therefore, performance waste and unnecessary traffic consumption are avoided.

[0045] In some embodiments, the preloading strategy is further used to indicate the start time of the preloaded media file to be played, and to obtain the file offset of the media file to be played based on the playback address, including: downloading the file header data of the media file to be played based on the playback address; parsing the file header data to obtain the file offset corresponding to the start time.

[0046] Specifically, the preloading strategy can be used to limit the start time of media files to be played. For example, when sending a media file playback request to the media server, the user can specify the start time of playback from any point in time of the media file to be played through the media player. Furthermore, after successfully downloading the file header data of the media file to be played based on the obtained playback address, the CDN server parses the file header data and locates the starting file offset of the keyframe in the mdat corresponding to that point in time by analyzing the index of the keyframe (i.e., audio and video frames) in the metadata encapsulated in the moov box.

[0047] Here, a keyframe refers to the frame containing a crucial action in the movement or change of a character or object. When decoding a media file to be played, the media server can obtain I-frames, also known as intra-coded frames. An I-frame is an independent frame containing all its own information and can be decoded independently without referencing other images. Based on this, the media server can determine the decoded I-frames as keyframes, forming a keyframe sequence for the media file to be played. In this embodiment, a keyframe can be set every 5000ms. For example, the start time of keyframe 0 is 0ms, with a corresponding file offset of 0; the start time of keyframe 1 is 0ms, with a corresponding file offset of 322852; the start time of keyframe 2 is 5000ms, with a corresponding file offset of 2548831; and the start time of keyframe 3 is 10000ms, with a corresponding file offset of 4885774.

[0048] Optionally, when a media player experiences buffering, playback can be paused to stop data consumption. Simultaneously, playback can resume after the download thread loads more data into the buffer, reducing the probability of subsequent buffering. The pause duration can be determined by a more sophisticated preloading strategy, which is related to the objective: is reducing the number of buffering occurrences more important, or reducing the duration of buffering?

[0049] For example, a three-level preloading strategy can be designed: a first-level preloading strategy, a second-level preloading strategy, and a third-level preloading strategy. The buffer durations for the three levels of preloading strategies can be set to 500ms, 1000ms, and 5000ms, respectively. The first-level preloading strategy determines how much media data the media player loads before starting playback. To speed up the initial playback startup, this value is usually set relatively low, for example, 500ms as mentioned above. The second-level preloading strategy determines how much media data the media player loads before starting playback after a stutter, for example, 1000ms as mentioned above. The third-level preloading strategy determines the maximum amount of media data the media player loads before starting playback after a stutter, for example, 5000ms as mentioned above.

[0050] Furthermore, a progressive escalation strategy can be implemented between the second-level and third-level preloading strategies. For example, after the first stutter, playback can begin after buffering 1000ms of media data; after the second stutter, playback can begin after buffering 2 × 1000ms = 2000ms of media data; after the third stutter, playback can begin after buffering 2 × 2000ms = 4000ms of media data; after the fourth stutter, playback can begin after buffering min(2 × 4000ms = 8000ms, 5000ms) = 5000ms of media data; and subsequent stutters can be preceded by buffering 5000ms of media data before playback begins.

[0051] According to the technical solution provided in the embodiments of this disclosure, the preloaded media data can be determined based on the file offset corresponding to the start time, thus avoiding unnecessary traffic waste caused by preloading too much media data.

[0052] In some embodiments, preloading the media file to be played based on the preload size and file offset includes: preloading the media file to be played starting from the file offset corresponding to the start time, based on the preload size.

[0053] Specifically, after locating the file offset corresponding to the start time, the media player can preload the media file to be played starting from the file offset corresponding to the start time based on the preload size. This ensures that sufficient media data can be preloaded when the user starts playing the media file at any time, improving the flexibility of media file playback, avoiding excessively long waiting times for users, and further enhancing the user experience.

[0054] For example, suppose the start time of keyframe 1 is 0ms, and the corresponding file offset is 322852; the start time of keyframe 2 is 5000ms, and the corresponding file offset is 2548831; the start time of keyframe 3 is 10000ms, and the corresponding file offset is 4885774. If the user-specified start time is 5 seconds (equivalent to 5000ms), then the preloading of the media file to be played will begin from the position corresponding to the file offset of 2548831 at 5000ms.

[0055] In some embodiments, preloading the media file to be played starting from the file offset corresponding to the start time based on the preload size includes: when the start time is between a first time and a second time, preloading the media file to be played starting from the file offset corresponding to the first time based on the preload size, wherein the first time is earlier than the second time.

[0056] Specifically, when the start time falls between the first and second time points, the media player can begin preloading the media file to be played from the file offset corresponding to the first time point, based on the preload size. Here, neither the first nor the second time point is the start time for playing the media file, and the first time point is earlier than the second time point.

[0057] Taking keyframe 1 with a start time of 0ms and a corresponding file offset of 322852; keyframe 2 with a start time of 5000ms and a corresponding file offset of 2548831; and keyframe 3 with a start time of 10000ms and a corresponding file offset of 4885774 as examples. Assuming the user-specified start time is 8 seconds (equivalent to 8000ms), falling between 5000ms and 10000ms, if preloading the media file to be played starts from the file offset of 4885774 corresponding to 10000ms, the media file between 8000ms and 10000ms cannot be preloaded, thus preventing the user from seeing the content of this portion of the media file. Therefore, to ensure the user can see the complete file content, preloading the media file to be played still starts from the file offset of 2548831 corresponding to 5000ms.

[0058] In some embodiments, the method further includes: detecting the current network status; wherein, creating a preloading task for the media file to be played based on the file header size includes: creating a preloading task for the media file to be played based on the file header size and the current network status.

[0059] Specifically, the media player can detect the current network status in real time. When the network quality is at its best, i.e., the network is normal and there is no network congestion, the size of the media file to be played that needs to be loaded in the preloading task can be set to be smaller (e.g., 800KB). This smaller size of the media file to be played in the preloading task can ensure that subsequent media files play instantly without stuttering. When the network quality is at its worst, i.e., the network is abnormal and there is a possibility of network collapse, the size of the media file to be played in the preloading task can be set to be larger (e.g., 1200KB). This larger size of the media file to be played in the preloading task can ensure that subsequent videos play instantly without stuttering.

[0060] All the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this disclosure, and will not be described in detail here. In addition, the sequence number of each step in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.

[0061] Figure 2 This is a flowchart illustrating another method for preloading media files provided as an exemplary embodiment of the present disclosure. Figure 2 The method for preloading media files can be executed by the media player. For example... Figure 2 As shown, the preloading method for this media file includes:

[0062] S201, Send a media file playback request to the media server, wherein the media file playback request carries the file identifier of the media file to be played;

[0063] S202, Receive media information of the media file to be played, which corresponds to the file identifier, sent by the media server. The media information includes the playback address and file header size of the media file to be played.

[0064] S203, create a preloading task for the media file to be played based on the file header size. The preloading task carries a preloading strategy, which is used to indicate the preload size and start time of the media file to be played.

[0065] S204, based on the playback address, download the file header data of the media file to be played;

[0066] S205, parse the file header data to obtain the file offset corresponding to the start time;

[0067] S206, based on the preload size, preloads the media file to be played starting from the file offset corresponding to the start time.

[0068] According to the technical solution provided in this disclosure, by preloading the header data of the media file to be played based on the playback address, and by preloading the media file to be played based on the file offset obtained by parsing the header data, the effect of quickly starting playback at any start time can be achieved by preloading two segments of data. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is further enhanced.

[0069] Figure 3 This is a flowchart illustrating another method for preloading media files provided as an exemplary embodiment of the present disclosure. Figure 3 The main interacting entities involved are the media player and the media server. For example... Figure 3 As shown, the preloading method for this media file includes:

[0070] S301, The media player sends a media file playback request to the media server, and the media file playback request carries the file identifier of the media file to be played;

[0071] S302, the media server responds to the media file playback request by searching for the media file to be played that corresponds to the file identifier;

[0072] S303, The media server sends the playback address and file header size of the media file to be played to the media player;

[0073] S304, The media player creates a preloading task for the media file to be played based on the file header size. The preloading task carries a preloading strategy, which is used to indicate the preload size and start time of the media file to be played.

[0074] S305, the media player downloads the header data of the media file to be played based on the playback address;

[0075] S306, the media player parses the file header data to obtain the file offset corresponding to the start time;

[0076] S307, the media player preloads the media file to be played starting from the file offset corresponding to the start time, based on the preload size.

[0077] According to the technical solution provided in this disclosure, by preloading the file header data of the media file to be played based on the playback address, and by preloading the media file to be played based on the file offset obtained by parsing the file header data, it can be ensured that sufficient media data can be preloaded when the user starts playing the media file at any time. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is enhanced.

[0078] By dividing each function into modules corresponding to its respective functions, this disclosure provides a media file preloading device, which can be a server or a chip applied to a server. Figure 4 This is a schematic diagram of a media file preloading device provided as an exemplary embodiment of the present disclosure. Figure 4 As shown, the media file preloading device 400 includes:

[0079] The acquisition module 401 is configured to acquire media information of the media file to be played, wherein the media information includes the playback address and file header size of the media file to be played;

[0080] Module 402 is configured to create a preload task for a media file to be played based on the file header size. The preload task carries a preload strategy, which is used to indicate the preload size of the media file to be played.

[0081] The preloading module 403 is configured to obtain the file offset of the media file to be played based on the playback address, and preload the media file to be played based on the preload size and the file offset.

[0082] According to the technical solution provided in this disclosure, by obtaining media information of the media file to be played, including the playback address and file header size of the media file; creating a preloading task for the media file to be played based on the file header size, the preloading task carrying a preloading strategy for indicating the preloading size of the media file to be played; obtaining the file offset of the media file to be played based on the playback address, and preloading the media file to be played based on the preloading size and the file offset, it can be ensured that sufficient media data can be preloaded when the user starts playing the media file at any time. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is enhanced.

[0083] In some embodiments, Figure 4 The acquisition module 401 sends a media file playback request to the media server, wherein the media file playback request carries the file identifier of the media file to be played; and receives media information of the media file to be played corresponding to the file identifier sent by the media server.

[0084] In some embodiments, the preloading strategy is also used to indicate the start time for preloading media files to be played. Figure 4 The preloading module 403 downloads the header data of the media file to be played based on the playback address; it then parses the header data to obtain the file offset corresponding to the start time.

[0085] In some embodiments, Figure 4 The preloading module 403 preloads the media files to be played starting from the file offset corresponding to the start time, based on the preload size.

[0086] In some embodiments, when the start time is between the first time and the second time... Figure 4 The preloading module 403 preloads the media file to be played starting from the file offset corresponding to the first time based on the preload size, where the first time is earlier than the second time.

[0087] In some embodiments, Figure 4 The media file preloading device 400 further includes: a detection module 404 configured to detect the current network status, wherein, Figure 4 The creation module 402 creates a preloading task for the media file to be played based on the file header size and the current network status.

[0088] In some embodiments, the media file being played is in a non-streaming media format.

[0089] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0090] This disclosure also provides an electronic device, including: at least one processor; and a memory for storing at least one processor-executable instruction; wherein the at least one processor is used to execute the instruction to implement the steps of the media file preloading method disclosed in this disclosure.

[0091] Figure 5 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this disclosure. For example... Figure 5 As shown, the electronic device 500 includes at least one processor 501 and a memory 502 coupled to the processor 501, which can perform the corresponding steps in the methods disclosed in the embodiments of this disclosure.

[0092] The processor 501 described above can also be called a Central Processing Unit (CPU), which can be an integrated circuit chip with signal processing capabilities. Each step in the method disclosed in this embodiment can be implemented by the integrated logic circuitry in the processor 501 or by software instructions. The processor 501 can be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this embodiment can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in the memory 502, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The processor 501 reads information from the memory 502 and, in conjunction with its hardware, completes the steps of the method described above.

[0093] Furthermore, various operations / processes according to this disclosure, implemented via software and / or firmware, can be transmitted from a storage medium or network to a computer system with a dedicated hardware architecture, for example, Figure 6 The computer system 600 shown is equipped with the programs that constitute the software. When various programs are installed, the computer system is able to perform various functions, including functions such as those described above. Figure 6 This is a schematic diagram of the structure of a computer system provided for an exemplary embodiment of the present disclosure.

[0094] Computer system 600 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0095] like Figure 6As shown, the computer system 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the computer system 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0096] Multiple components in the computer system 600 are connected to the I / O interface 605, including: an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 can be any type of device capable of inputting information into the computer system 600. The input unit 606 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 607 can be any type of device capable of presenting information and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. The storage unit 608 may include, but is not limited to, a hard disk and an optical disk. The communication unit 609 allows the computer system 600 to exchange information / data with other devices via a network such as the Internet, and may include, but is not limited to, a modem, network card, infrared communication device, wireless communication transceiver, and / or chipset, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.

[0097] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above. For example, in some embodiments, the methods disclosed in this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. In some embodiments, the computing unit 601 can be configured to perform the methods disclosed in this disclosure by any other suitable means (e.g., by means of firmware).

[0098] This disclosure also provides a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the methods disclosed in this disclosure.

[0099] The computer-readable storage medium in this disclosure can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. The aforementioned computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specifically, the aforementioned computer-readable storage medium may include electrical connections based on one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0100] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0101] This disclosure also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, it implements the methods disclosed in the embodiments of this disclosure.

[0102] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)), or it can be connected to an external computer.

[0103] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0104] The modules, components, or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules, components, or units do not necessarily constitute a limitation on the module, component, or unit itself.

[0105] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that can be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0106] The above description is merely an embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0107] While specific embodiments of this disclosure have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. Those skilled in the art should understand that modifications can be made to the above embodiments without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.

Claims

1. A method for preloading media files, characterized in that, Applied to a media player, the method includes: Obtain the media information of the media file to be played, wherein the media information includes the playback address and file header size of the media file to be played; A preloading task for the media file to be played is created based on the file header size, wherein the preloading task carries a preloading strategy, and the preloading strategy is used to indicate the preload size of the media file to be played. The file offset of the media file to be played is obtained based on the playback address, and the media file to be played is preloaded based on the preload size and the file offset; The preloading strategy is further used to indicate the start time of preloading the media file to be played, and obtaining the file offset of the media file to be played based on the playback address includes: Based on the playback address, download the header data of the media file to be played; The file header data is parsed to obtain the file offset corresponding to the start time.

2. The method according to claim 1, characterized in that, The process of obtaining media information for the media file to be played includes: Send a media file playback request to the media server, wherein the media file playback request carries the file identifier of the media file to be played; Receive media information from the media server that corresponds to the file identifier of the media file to be played.

3. The method according to claim 1, characterized in that, The preloading strategy is also used to indicate the start time of preloading the media file to be played, and obtaining the file offset of the media file to be played based on the playback address includes: Based on the playback address, download the header data of the media file to be played; The file header data is parsed to obtain the file offset corresponding to the start time.

4. The method according to claim 3, characterized in that, The preloading of the media file to be played based on the preload size and the file offset includes: Based on the preload size, the media file to be played is preloaded starting from the file offset corresponding to the start time.

5. The method according to claim 4, characterized in that, The step of preloading the media file to be played, based on the preloaded size and starting from the file offset corresponding to the start time, includes: If the start time is between the first time and the second time, the media file to be played is preloaded starting from the file offset corresponding to the first time, based on the preload size, wherein the first time is earlier than the second time.

6. The method according to claim 1, characterized in that, The method further includes: Check the current network status; The step of creating the preloading task of the media file to be played based on the file header size includes: Based on the file header size and the current network status, the preloading task for the media file to be played is created.

7. The method according to any one of claims 1 to 6, characterized in that, The media file to be played is in a non-streaming media format.

8. A media file preloading device, characterized in that, Applied to a media player, the device includes: The acquisition module is configured to acquire media information of the media file to be played, wherein the media information includes the playback address and file header size of the media file to be played; A creation module is configured to create a preloading task for the media file to be played based on the file header size, wherein the preloading task carries a preloading strategy, the preloading strategy being used to indicate the preload size for preloading the media file to be played; The preloading module is configured to obtain the file offset of the media file to be played based on the playback address, and preload the media file to be played based on the preload size and the file offset; The preloading strategy is also used to indicate the start time of preloading the media file to be played. The preloading module is further configured to download the file header data of the media file to be played based on the playback address; and parse the file header data to obtain the file offset corresponding to the start time.

9. An electronic device, characterized in that, include: At least one processor; Memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 7.