Media file preloading method and apparatus, electronic device, and storage medium

By obtaining the playback address and file header size of the media file, a preloading task is created and preloading is performed based on the file offset. This solves the problems of low flexibility and performance waste in media file playback in existing technologies, enabling users to quickly start playback and optimize traffic at any time.

WO2024245234A1PCT designated stage expired Publication Date: 2024-12-05DOUYIN VISION CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/095764
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-05-29
Filing Date
2024-05-28
Publication Date
2024-12-05

AI Technical Summary

Technical Problem

In existing technologies, the preloading method of media files cannot guarantee that enough media data can be preloaded when the user starts playback at any time, resulting in low playback flexibility and wasted performance and bandwidth consumption.

Method used

By obtaining media information from the media file to be played, including the playback address and file header size, a preloading task is created, and preloading is performed based on the file offset to ensure that sufficient media data is preloaded when the user starts playback at any point in 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 CN2024095764_05122024_PF_FP_ABST
    Figure CN2024095764_05122024_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to a media file preloading method and apparatus, an electronic device, and a storage medium. The method is applied to a media player and comprises: obtaining media information of a media file to be played back, wherein the media information comprises a playback address and a file header size of said media file; creating a preloading task of said media file on the basis of the file header size, wherein the preloading task carries a preloading policy, and the preloading policy is used for indicating the preloading size of preloading said media file; and obtaining a file offset of said media file on the basis of the playback address, and preloading said media file on the basis of the preloading size and the file offset.
Need to check novelty before this filing date? Find Prior Art

Description

Media file preloading method, device, electronic device and storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is based on and claims priority to a Chinese application with application number 202310622661.7, filing date May 29, 2023, entitled “Method, device, electronic device and storage medium for preloading media files”. The disclosed content of the Chinese application is hereby introduced as a whole into this application. Technical Field

[0003] The present disclosure relates to the field of media playback technology, and in particular to a method and device for preloading a media file, an electronic device, and a computer-readable storage medium. Background Art

[0004] With the rapid development of Internet and multimedia technologies, a variety of multimedia applications have emerged. Currently, when playing media files, in order to ensure that users can quickly start the playback without lag or buffering, it is usually necessary to preload a few seconds of media data from the beginning based on the user's playback behavior.

[0005] Summary of the Invention

[0006] The embodiments of the present disclosure provide a method and apparatus for preloading a media file, an electronic device, and a computer-readable storage medium to solve problems existing in related technologies.

[0007] In a first aspect of an embodiment of the present disclosure, a method for preloading a media file is provided, which is 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, and the preloading strategy is used to indicate a preloading size for preloading 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 preloading size and the file offset.

[0008] According to a second aspect of an embodiment of the present disclosure, a media file preloading device is provided, which is applied to a media player. The device includes: an acquisition module, configured to acquire media information of a to-be-played media file, wherein the media information includes a playback address and a file header size of the to-be-played media file; a creation module, configured to create a preloading task for the to-be-played media file 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 for preloading the to-be-played media file; and a preloading module, configured to acquire a file offset of the to-be-played media file based on the playback address, and preload the to-be-played media file based on the preloading size and the file offset.

[0009] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising at least one processor; and a memory for storing instructions executable by at least one processor; wherein the at least one processor is configured to execute instructions to implement the steps of the above method.

[0010] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the steps of the above method. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0012] FIG1 is a schematic flow chart of a method for preloading a media file provided by an exemplary embodiment of the present disclosure.

[0013] FIG2 is a flow chart of another method for preloading media files provided by an exemplary embodiment of the present disclosure.

[0014] FIG3 is a flow chart of yet another method for preloading a media file provided by an exemplary embodiment of the present disclosure.

[0015] FIG4 is a schematic structural diagram of a media file preloading device provided by an exemplary embodiment of the present disclosure.

[0016] FIG5 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure.

[0017] FIG6 is a schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0018] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

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

[0020] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0021] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0023] When playing a media file, to ensure fast playback without lag or buffering, several seconds of media data are typically preloaded based on the user's playback behavior. However, in some cases, users don't want to start playing a media file from the zeroth second. Therefore, existing preloading methods cannot guarantee that sufficient media data will be preloaded when the user starts playing the media file at any time, resulting in limited flexibility in media file playback and a negative impact on the user experience.

[0024] Furthermore, because the file header size and the correspondence between the start time and the file offset are unknown before decoding the media file, it's impossible to accurately determine the preload size of the media file. Consequently, media data from the file header to the start time is typically preloaded. However, this portion of media data is never played by the user, resulting in performance waste and unnecessary bandwidth consumption.

[0025] In view of this, the embodiments of the present disclosure provide a method, device, electronic device and computer-readable storage medium for preloading media files to solve the problems existing in the related art. At least one technical solution adopted by the embodiments of the present disclosure can achieve the following beneficial effects: by obtaining the media information of the media file to be played, the media information 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 carries 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 file offset, which can ensure that the user can preload enough media data when starting to play the media file at any time point, thereby improving the flexibility of media file playback, avoiding performance waste and unnecessary traffic consumption, and improving user experience.

[0026] A method and apparatus for preloading media files according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0027] FIG1 is a flow chart of a method for preloading a media file provided by an exemplary embodiment of the present disclosure. The method for preloading a media file in FIG1 can be executed by a media player. As shown in FIG1 , the method for preloading a media file includes:

[0028] S101, 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;

[0029] S102: 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, and the preloading strategy is used to indicate a preloading size for preloading the media file to be played;

[0030] S103: Acquire a file offset of the to-be-played media file based on the playback address, and preload the to-be-played media file based on the preload size and the file offset.

[0031] 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.

[0032] Here, a media file refers to a file that stores encoded media data (for example, at least one of audio data and video data) in a container (Box), which also includes metadata (that is, data describing the media data). The metadata carries media information that ensures that the media data is correctly decoded.

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

[0034] Taking a Moving Picture Experts Group 4 (MP4) file as an example, the basic container types involved in an MP4 file include a file type container (ftyp box), a metadata container (moov box), and a media data container (mdat box). A file type container refers to a container used in a media file to store the capacity (i.e., the length of the bytes occupied) and type of the file. A metadata container refers to a container used in a media file 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 in an MP4 file is called media information. A media data container refers to a container used in a media file to store media data.

[0035] In actual applications, media information may include information such as the offset, capacity, index, timestamp, etc. of the video frame and / or audio frame in the media file, and may also include information such as the playback address, playback order, playback position, playback progress, etc. of the media file. The embodiments of the present disclosure do not limit this.

[0036] The file header is located at the beginning of a media file and describes information such as the file size (i.e., capacity) and type, making it easier for applications to parse and open the media file. It's important to note that the header size of an MP4 file is positively correlated with the duration of the media file: longer files have larger headers, while shorter files have smaller headers.

[0037] The media file to be played can be an Internet video file, such as a movie, TV series, sports program, variety show, etc. on a video website; it can also be a music file, such as free music, paid music, etc. on a music website; or it can also be other types of files that can be played on a media player, and the embodiments of the present disclosure are not limited to this. Furthermore, the media file to be played can be in a non-streaming media format. The non-streaming media format is an encapsulation technology that encapsulates media data into a media file and the media file must be completely downloaded before it can be decoded and played. Files in a non-streaming media format may include but are not limited to MP4 files, MKV file format (MKV file format), Windows Media Video (WMV) files, Advanced Streaming Format (ASF) files, etc. The streaming media format is a file that encapsulates media data into streaming media, and the media file does not need to be completely downloaded or require additional transcoding before it can be decoded and played, that is, it natively supports encapsulation technology that downloads and plays at the same time. Files in a streaming media format may include but are not limited to TS media file fragments based on HTTP Live Streaming (HLS) technology, FLV (Flash Video) files, etc.

[0038] It should be noted that MP4 files do not natively support streaming media playback. However, the technical effect of downloading and playing at the same time can be achieved by online transcoding and then transmitting the transcoded media stream to the player, or filling the missing parts of the partially downloaded MP4 file with invalid binary data (for example, when the ftyp box and moov box are downloaded completely, the missing parts of the mdat box are replaced with invalid binary data). This disclosure refers to the encapsulation format of files that do not natively support streaming media playback as non-streaming media formats.

[0039] A media player is software that plays video or audio files stored in the form of digital signals, or a device that has the function of playing video or audio files. In the embodiments of the present disclosure, a media player is an electronic device used by a user that can play audio and / or video files. The electronic device may include but is not limited to a smartphone, tablet computer, laptop computer, desktop computer, personal digital assistant (PDA), smart TV, smart watch, smart glasses, smart bracelet, etc.

[0040] Preloading refers to pre-downloading a media file of a certain length. When the user clicks on the media file to play, the media file can be played directly without waiting for the network to load. The preloading task is used to load subsequent media files and carries a preloading strategy. The preloading strategy can be used to limit the preloading size of the media files to be played. Generally speaking, if the preloading is too little, the effect of opening in seconds (opening in seconds means that after clicking play, you can see the playback screen within one second) cannot be achieved; if the preloading is too much, it is a waste of bandwidth. Therefore, the preloading size can be set according to actual needs. For example, the preloading size can be any value in the range of 500 kilobytes (KB) to 1 megabyte (MB). Preferably, in the embodiment of the present disclosure, the preloading size is 800KB.

[0041] A file offset is the number of bytes moved forward or backward from a specified location to locate the desired data within a file. Generally speaking, there are three types of file offsets: the first is to find the target by moving a certain number of bytes backward from the beginning of the file; the second is to find the target by moving a certain number of bytes forward from the end of the file; and the third is to find the target by moving forward or backward from the current position in the file. In the disclosed embodiments, all file offsets are of the first type, i.e., from the beginning of the file to the location of the desired data.

[0042] According to the technical solution provided by the embodiments of the present disclosure, by obtaining media information of the media file to be played, the media information 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 carries 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 point. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is improved.

[0043] 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.

[0044] Specifically, the media player integrates a media playback component corresponding to the media server, namely, a software development kit (SDK). This media playback component can serve as a bridge for the media player to communicate with the media server and is used to play media files obtained from the content delivery network (CDN). After successfully logging into the media server through a login account, the media player can send a media file playback request to the media server containing the file identifier of the media file to be played. Upon receiving the media file playback request, the media server will find the media information of the media file to be played corresponding to the file identifier in the media database or content delivery network and send it to the media player.

[0045] Here, a media server refers to a server that can provide various media services to the media playback application in the 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 data (e.g., multimedia data, interactive information, etc.), and interactive information sending and receiving services refer to services that receive interactive information and send it to the media playback application.

[0046] The media server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, as well as big data and artificial intelligence platforms. The embodiments of the present disclosure do not limit this.

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

[0048] According to the technical solution provided by the embodiment of the present disclosure, the file header size of the to-be-played media file can be obtained from the received media information, and a preloading task for the to-be-played media file can be created based on the file header size, thereby avoiding performance waste and unnecessary traffic consumption.

[0049] In some embodiments, the preloading strategy is also used to indicate the start time of the preloaded media file to be played, and 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.

[0050] Specifically, the preloading strategy can be used to limit the start time of the media file to be played. For example, when sending a media file playback request to the media server, the user can specify to start playback from any time point of the media file to be played through the media player; further, 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 key frame in the mdat corresponding to the time point by analyzing the index of the key frame (i.e., audio and video frame) in the metadata encapsulated in the moov box.

[0051] Here, the key frame refers to the frame where the key action of the character or object is moving or changing. When decoding the media file to be played, the media server can obtain I-frames. I-frames are also called intra-frame coded frames. They are independent frames with all their own information. They can be decoded independently without referring to other images. Based on this, the media server can determine the I-frames obtained by decoding as key frames to form a key frame sequence for the media file to be played. In the embodiment of the present disclosure, a key frame can be set every 5000ms. For example, the start time of key frame 0 is 0ms, and the corresponding file offset is 0; the start time of key frame 1 is 0ms, and the corresponding file offset is 322852; the start time of key frame 2 is 5000ms, and the corresponding file offset is 2548831; the start time of key frame 3 is 10000ms, and the corresponding file offset is 4885774.

[0052] Optionally, when a media player experiences a freeze, it can pause playback to stop data consumption. Meanwhile, it can wait for the download thread to load more data into the buffer before restarting playback to reduce the probability of subsequent freezes. The pause duration can be determined by designing a more detailed preloading strategy, which depends on the goal: whether reducing the number of freezes or reducing the duration of freezes is more important.

[0053] For example, a three-level preloading strategy can be designed, namely, a first-level preloading strategy, a second-level preloading strategy and a third-level preloading strategy, and the buffering time of the three-level preloading strategy can be set to 500ms, 1000ms and 5000ms respectively. The first-level preloading strategy refers to how much media data the media player loads for the first time before starting to play. In order to speed up the initial playback, this value is usually set relatively low, for example, 500ms as mentioned above. The second-level preloading strategy refers to how much media data the media player must load before starting to play after a freeze occurs, for example, 1000ms as mentioned above. The third-level preloading strategy refers to how much media data the media player must load at most before starting to play after a freeze occurs, for example, 5000ms as mentioned above.

[0054] Furthermore, there can be a gradual upgrade strategy between the second-level preloading strategy and the third-level preloading strategy. For example, after the first jam, 1000ms of media data is buffered before playback begins; after the second jam, 2×1000ms=2000ms of media data is buffered before playback begins; after the third jam, 2×2000ms=4000ms of media data is buffered before playback begins; after the fourth jam, min(2×4000ms=8000ms, 5000ms)=5000ms of media data is buffered before playback begins; and after each subsequent jam, 5000ms of media data is buffered before playback begins.

[0055] According to the technical solution provided by the embodiment of the present disclosure, the preloaded media data can be determined based on the file offset corresponding to the start time, thereby avoiding unnecessary traffic waste caused by preloading too much multimedia data.

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

[0057] 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, ensuring that sufficient media data can be preloaded when the user starts playing the media file at any time point, improving the flexibility of media file playback, avoiding the user waiting for too long, and further improving the user experience.

[0058] For example, assuming that the start time of key frame 1 is 0ms, the corresponding file offset is 322852; the start time of key frame 2 is 5000ms, the corresponding file offset is 2548831; the start time of key frame 3 is 10000ms, the corresponding file offset is 4885774. If the user specifies a start time of 5 seconds (equivalent to 5000ms), the media file to be played will be preloaded starting from the file offset 2548831 corresponding to 5000ms.

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

[0060] Specifically, when the start time is between the first time and the second time, the media player may preload the to-be-played media file starting from the file offset corresponding to the first time based on the preload size. Here, neither the first time nor the second time is a time point at which the media file starts to be played, and the first time is earlier than the second time.

[0061] Still taking the example of key frame 1 with a start time of 0ms and a corresponding file offset of 322852, key frame 2 with a start time of 5000ms and a corresponding file offset of 2548831, and key frame 3 with a start time of 10000ms and a corresponding file offset of 4885774, as an example, assuming that the user specifies a start time of 8 seconds (equivalent to 8000ms), which is between 5000ms and 10000ms, if the to-be-played media file is preloaded starting from the position of 4885774, which corresponds to the file offset of 10000ms, the to-be-played media file between 8000ms and 10000ms cannot be preloaded, and the user will not be able to see the file content corresponding to this part of the to-be-played media file. Therefore, in order to ensure that the user can see the complete file content, the to-be-played media file is still preloaded starting from the position of 2548831, which corresponds to the file offset of 5000ms.

[0062] In some embodiments, the method further includes: detecting a 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.

[0063] Specifically, the media player can detect the current network status in real time. When the network quality corresponding to the current network status is the best, that is, the current network is normal and there is no network congestion, the size of the media file to be played required by the preloading task can be set to be smaller (for example, 800KB), so that the subsequent media files can be played instantly and without lag using the smaller size of the media file to be played required by the preloading task; when the network quality corresponding to the current network status is the worst, that is, the current network is abnormal and there may be a network crash, the size of the media file to be played required by the preloading task can be set to be larger (for example, 1200KB), so that the subsequent videos can be played instantly and without lag using the larger size of the media file to be loaded by the preloading task.

[0064] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present disclosure, and will not be described in detail here. In addition, the order of the sequence numbers of the steps in the above embodiments does not imply a specific order of execution. The order of execution of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.

[0065] FIG2 is a flow chart of another method for preloading media files provided by an exemplary embodiment of the present disclosure. The method for preloading media files in FIG2 can be executed by a media player. As shown in FIG2 , the method for preloading media files includes:

[0066] S201, sending a media file play request to a media server, wherein the media file play request carries a file identifier of a media file to be played;

[0067] S202, receiving media information of a to-be-played media file corresponding to the file identifier from a media server, wherein the media information includes a playback address and a file header size of the to-be-played media file;

[0068] S203: 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, and the preloading strategy is used to indicate a preloading size and a start time for preloading the media file to be played;

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

[0070] S205, parsing the file header data to obtain the file offset corresponding to the start time;

[0071] S206 : Based on the preload size, preload the to-be-played media file starting from the file offset corresponding to the start time.

[0072] According to the technical solution provided by the embodiments of the present disclosure, by preloading the file header data of the media file to be played based on the playback address, and preloading the media file to be played based on the file offset obtained by parsing the file header data, it is possible to achieve the effect of quickly starting playback at any starting time point while 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 improved.

[0073] FIG3 is a flow chart of another method for preloading media files provided by an exemplary embodiment of the present disclosure. The interactive entities involved in FIG3 are a media player and a media server. As shown in FIG3 , the method for preloading media files includes:

[0074] S301: A media player sends a media file play request to a media server. The media file play request carries a file identifier of a media file to be played.

[0075] S302: The media server searches for a to-be-played media file corresponding to the file identifier in response to the media file play request.

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

[0077] 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 indicates the preloading size and start time of the media file to be played.

[0078] S305: The media player downloads the file header data of the media file to be played based on the playback address;

[0079] S306: The media player parses the file header data to obtain a file offset corresponding to the start time.

[0080] S307: The media player starts preloading the to-be-played media file from the file offset corresponding to the start time based on the preload size.

[0081] According to the technical solution provided by the embodiments of the present disclosure, by preloading the file header data of the media file to be played based on the playback address, and 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 point. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is improved.

[0082] In the case of dividing each functional module into corresponding functional modules, an embodiment of the present disclosure provides a media file preloading device. The media file preloading device can be a server or a chip applied to a server. Figure 4 is a schematic structural diagram of a media file preloading device provided by an exemplary embodiment of the present disclosure. As shown in Figure 4, the media file preloading device 400 includes:

[0083] The acquisition module 401 is configured to acquire media information of the 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;

[0084] A creation module 402 is configured to create a preloading task for the to-be-played media file 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 for preloading the to-be-played media file;

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

[0086] According to the technical solution provided by the embodiments of the present disclosure, by obtaining media information of the media file to be played, the media information 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 carries 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 point. Therefore, the flexibility of media file playback is improved, performance waste and unnecessary traffic consumption are avoided, and the user experience is improved.

[0087] In some embodiments, the acquisition module 401 of Figure 4 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.

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

[0089] In some embodiments, the preloading module 403 of FIG. 4 preloads the to-be-played media file starting from the file offset corresponding to the start time based on the preload size.

[0090] In some embodiments, when the start time is between the first time and the second time, the preloading module 403 of Figure 4 starts preloading the to-be-played media file from the file offset corresponding to the first time based on the preload size, wherein the first time is earlier than the second time.

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

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

[0093] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0094] An embodiment of the present disclosure further provides an electronic device, comprising: at least one processor; a memory for storing instructions executable by at least one processor; wherein the at least one processor is configured to execute instructions to implement the steps of the above-mentioned media file preloading method disclosed in the embodiment of the present disclosure.

[0095] Figure 5 is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure. As shown in Figure 5, the electronic device 500 includes at least one processor 501 and a memory 502 coupled to the processor 501. The processor 501 can execute the corresponding steps of the above method disclosed in the embodiment of the present disclosure.

[0096] The processor 501 can also be referred to as a central processing unit (CPU), which can be an integrated circuit chip with signal processing capabilities. Each step in the method disclosed in the embodiment of the present disclosure can be completed by hardware integrated logic circuits in the processor 501 or instructions in the form of software. The processor 501 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (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 the embodiment of the present disclosure can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in the memory 502, such as a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The processor 501 reads the information in the memory 502 and completes the steps of the method in combination with its hardware.

[0097] In addition, when various operations / processes according to the present disclosure are implemented via software and / or firmware, the programs constituting the software can be installed from a storage medium or a network to a computer system having a dedicated hardware structure, such as the computer system 600 shown in FIG6 . When the various programs are installed, the computer system can perform various functions, including those described above. FIG6 is a schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present disclosure.

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

[0099] As shown in FIG6 , a computer system 600 includes a computing unit 601, which can perform various appropriate actions and processes according to 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. Various programs and data required for the operation of the computer system 600 may also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0100] 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 that can input information to the computer system 600. The input unit 606 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device. The output unit 607 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator and / or a printer. The storage unit 608 can include but is not limited to a magnetic disk, an optical disk. The communication unit 609 allows the computer system 600 to exchange information / data with other devices over a network such as the Internet, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, for example, Bluetooth TM devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.

[0101] The computing unit 601 may be a variety of general and / or special 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 dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above. For example, in some embodiments, the above-mentioned method disclosed in the embodiments of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 600 via the ROM 602 and / or the communication unit 609. In some embodiments, the computing unit 601 may be configured to perform the above-mentioned method disclosed in the embodiments of the present disclosure by any other appropriate means (e.g., by means of firmware).

[0102] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the above method disclosed in the embodiment of the present disclosure.

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

[0104] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0105] The embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor, the method disclosed in the embodiments of the present disclosure is implemented.

[0106] In embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or combinations thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate 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 a remote computer, the remote computer may 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 may be connected to an external computer.

[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0108] The modules, components, or units described in the embodiments of the present disclosure may be implemented in software or hardware. The names of the modules, components, or units do not necessarily limit the modules, components, or units themselves.

[0109] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, and without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0110] The above descriptions are merely some embodiments of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the present disclosure.

[0111] Although some specific embodiments of the present disclosure have been described in detail by way of examples, those skilled in the art will appreciate that the above examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Those skilled in the art will appreciate that modifications may be made to the above embodiments without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.

Claims

1. A method for preloading a media file, applied to a media player, the method include: Acquire media information of the 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 to-be-played media file 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 for preloading the to-be-played media file; The file offset of the to-be-played media file is acquired based on the playback address, and the to-be-played media file is preloaded based on the preload size and the file offset.

2. The method according to claim 1, in, The step of obtaining media information of the media file to be played includes: Sending a media file playing request to a media server, wherein the media file playing request carries a file identifier of the media file to be played; The media information of the to-be-played media file corresponding to the file identifier is received and sent by the media server.

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

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

5. The method according to claim 4, in, The preloading of the to-be-played media file from the file offset corresponding to the start time based on the preload size includes: When the start time is between the first time and the second time, the to-be-played media file 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 any one of claims 1 to 5, in, The method further comprises: Detect the current network status; The step of creating the preloading task of the to-be-played media file based on the file header size includes: The preloading task of the to-be-played media file is created based on the file header size and the current network status.

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

8. A media file preloading device, applied to a media player, the device include: An acquisition module is configured to acquire media information of a to-be-played media file, wherein the media information includes a playback address and a file header size of the to-be-played media file; a creation module, configured to create a preloading task for the to-be-played media file 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 for preloading the to-be-played media file; The preloading module is configured to obtain a file offset of the to-be-played media file based on the playback address, and preload the to-be-played media file based on the preloading size and the file offset.

9. An electronic device, include: at least one processor; a 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 claimed in any one of claims 1 to 7. 10 . A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

12. A computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multimedia file downloading method and related device

    CN111031117A

  • Memory management method and device, computer equipment and storage medium

    CN111796941A

  • Video loading method and device

    CN112333476A

  • Resource loading method and device, electronic equipment and computer readable storage medium

    CN115700474A

  • Media file preloading method and device, electronic equipment and storage medium

    CN116600169A