File playing method and device, electronic equipment, storage medium and product
By grouping and selecting files and pre-downloading file attribute information, the problem of insufficient storage space or memory overflow in file playback from NAS to mobile devices is solved, achieving stable and smooth file playback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies are prone to crashing due to insufficient storage space or memory overflow when downloading photos from a NAS to a mobile device, making it impossible to play files stably.
By selecting file attribute information in groups, the system pre-downloads and plays the files to be played in the current file attribute information group, and switches to the next group when a file is deleted, until all files have been played.
It solves the problems of insufficient storage space or memory overflow, achieves stable file playback, saves network resources, avoids excessive memory usage, and provides a smooth playback process.
Smart Images

Figure CN115509998B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the mobile Internet technology field, and particularly relates to a file playing method and device, electronic equipment, storage medium and product. BACKGROUND
[0002] With the development of the Internet, more and more attention is paid to stored data. Since the stored data contains a lot of personal privacy, users who pay more attention to privacy often choose a home network attached storage (NAS) to save some photos, videos, audio data and the like, instead of using a cloud disk. Thus, the personal data in the NAS will be more and more, and when the user needs to review the past photos and the like from the NAS and play them on a mobile device such as a mobile phone or a tablet, the problem of obtaining a large number of photos from the NAS and playing them on the mobile device is involved.
[0003] In the prior art, the method for obtaining photos from the NAS to the mobile device has been realized, and all the photos are obtained from the NAS and downloaded to the mobile device using a supported transmission protocol, but one point is ignored: due to the performance limitation of the mobile device such as the mobile phone or the tablet, when the size of all the photo data in the NAS exceeds the storage capacity of the mobile device, all the photos are downloaded to the mobile device according to the prior art, and the implementation method will cause the out of memory (OOM) program crash due to insufficient storage space or insufficient memory space, or the memory space is too large, and a large amount of memory resources are occupied. SUMMARY
[0004] Therefore, the present application provides a file playing method and device, electronic equipment, storage medium and product, which can solve the problem of unable to download or OOM caused by insufficient storage space or insufficient memory space, make the running more stable, realize the grouping of the to-be-played files for downloading, do not occupy a large amount of memory resources, and can be interrupted at any time, and save network resources.
[0005] According to an aspect of the present application, an embodiment of the present application provides a file playing method, which comprises:
[0006] selecting at least two file attribute information according to a target selection mode to generate a corresponding current file attribute information group;
[0007] pre-downloading and playing a to-be-played file corresponding to the current file attribute information group; wherein the to-be-played file is one-to-one corresponding to the file attribute information;
[0008] In response to a file deletion operation, the deletion module deletes the to-be-played file corresponding to the current file attribute information group, and sets the next file attribute information group as the current file attribute information group, and returns to execute the playing of the to-be-played file corresponding to the current file attribute information group until the playing of all to-be-played files corresponding to the file attribute information is completed.
[0009] According to another aspect of the present application, the embodiments of the present application further provide a file playing device, which comprises:
[0010] The generating module is configured to select at least two file attribute information according to a target selection manner, and generate a corresponding current file attribute information group.
[0011] The downloading and playing module is configured to pre-download and play the to-be-played file corresponding to the current file attribute information group; wherein the to-be-played file and the file attribute information are in one-to-one correspondence.
[0012] The deletion module is configured to, in response to a file deletion operation, delete the to-be-played file corresponding to the current file attribute information group, and set the next file attribute information group as the current file attribute information group, and return to execute the playing of the to-be-played file corresponding to the current file attribute information group until the playing of all to-be-played files corresponding to the file attribute information is completed.
[0013] According to another aspect of the present application, the embodiments of the present application further provide an electronic device, which comprises:
[0014] at least one processor; and
[0015] a memory connected with the at least one processor; wherein
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the file playing method according to any one of the embodiments of the present application.
[0017] According to another aspect of the present application, the embodiments of the present application further provide a computer readable storage medium, which stores computer instructions for enabling a processor to execute the file playing method according to any one of the embodiments of the present application.
[0018] According to another aspect of the present application, the embodiments of the present application further provide a computer program product, which comprises a computer program, and the computer program, when executed by a processor, implements the file playing method according to any one of the embodiments of the present application.
[0019] The technical scheme of the embodiment of the present application can solve the problem of unable to download or memory OOM caused by insufficient storage space or insufficient memory space by pre-downloading and playing the to-be-played file corresponding to the current file attribute information group, deleting the to-be-played file corresponding to the current file attribute information group in response to a file deletion operation, taking the next file attribute information group as the current file attribute information group, returning to play the to-be-played file corresponding to the current file attribute information group until the playing of all to-be-played files corresponding to file attribute information is completed, realizing the downloading of to-be-played files in groups, not occupying a large amount of memory resources, the overall process being smooth and interruptible at any time, saving network resources, and making the operation more stable.
[0020] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0022] Figure 1 A flowchart of a file playing method provided by an embodiment of the present application is shown in FIG. 1.
[0023] Figure 2 A flowchart of another file playing method provided by an embodiment of the present application is shown in FIG. 2.
[0024] Figure 3 A flowchart of still another file playing method provided by an embodiment of the present application is shown in FIG. 3.
[0025] Figure 4 A flowchart of still another file playing method provided by an embodiment of the present application is shown in FIG. 4.
[0026] Figure 5 A structural block diagram of a file playing device provided by an embodiment of the present application is shown in FIG. 5.
[0027] Figure 6 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 6. DETAILED DESCRIPTION
[0028] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application in order to make the technical personnel in the technical field better understand the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by the ordinary technical personnel in the technical field without creative labor should belong to the protection scope of the present application.
[0029] It should be noted that the terms "target", "current", "next" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to the clearly listed steps or units, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0030] The acquisition, storage, use, processing and the like of data in the technical solutions of the present application comply with the relevant provisions of national laws and regulations.
[0031] In an embodiment, Figure 1 A flowchart of a file playing method provided by an embodiment of the present application, the embodiment can be applicable to the case of playing a file in a terminal device, the method can be executed by a file playing device, the file playing device can be realized in the form of hardware and / or software, and the file playing device can be configured in a client built in an electronic device. Illustratively, the client can be an independent application program (APP), or a third-party application applet attached to other APP. Illustratively, the electronic device can include but is not limited to a smart phone, an iPad, a computer and the like mobile terminal. As shown in the figure, the method includes: Figure 1
[0032] S110, selecting at least two file attribute information according to a target selection mode to generate a corresponding current file attribute information group.
[0033] The target selection mode can be understood as a mode of selecting file attribute information, which can be a random mode to select file attribute information, or a sequential mode to select file attribute information, and the embodiment does not limit the mode of selecting file attribute information.
[0034] In the embodiment, each file corresponds to corresponding file attribute information. It can be understood that each audio file, video file, and photo file of different types corresponds to corresponding file attribute information. The file attribute information corresponding to each file at least includes at least one of a file access path, a file name, a file type, and a file memory size. The file type can be an audio file, a video file, or a photo file, which is not limited in the embodiment.
[0035] In the embodiment, the current file attribute information group refers to a set of file attribute information composed of the selected file attribute information. Each current file attribute information group can include at least two file attribute information. Of course, the number of current file attribute information groups in the embodiment can be one group or multiple groups, for example, 5 groups, 10 groups, and the like. The number of current file attribute information groups is not limited in the embodiment. In order to facilitate the grouping of file attribute information and improve the grouping efficiency, the number of file attribute information included in each current file attribute information group can be the same.
[0036] In the embodiment, at least two file attribute information can be selected according to a target selection mode to generate a current file attribute information group composed of at least two file attribute information. Specifically, at least two file attribute information can be selected according to a random selection mode to generate a corresponding current file attribute information group. At least two file attribute information can also be selected according to a sequential selection mode to generate a corresponding current file attribute information group.
[0037] In an embodiment, the file attribute information at least includes one of the following: a file access path; a file name; a file type; and a file memory size.
[0038] The file type includes one of the following: an audio file; a video file; and a photo file.
[0039] The file access path refers to a storage path corresponding to each file. The file memory size can be understood as the memory size of the file.
[0040] In the embodiment, the file types corresponding to each file attribute information in the same file attribute information group can be the same or different. The file memory size is related to the file type. Generally, the video file has a larger file memory size than the audio file and the photo file, and the audio file has a larger file memory size than the photo file. For example, the file memory size of the audio file can be 36kb, 50kb, or 20M, 36M, etc.; the file memory size of the video file can be 100M, etc.; and the file memory size of the photo file can be 20kb, etc.
[0041] In the embodiment, in order to ensure that the download time of the to-be-played file corresponding to each file attribute information in the same file attribute information group is close, the file types in the same file attribute information group can be the same.
[0042] S120, pre-download and play the to-be-played file corresponding to the current file attribute information group; wherein the to-be-played file is one-to-one corresponding to the file attribute information.
[0043] The to-be-played file refers to the file ready to be played. It should be noted that the to-be-played file corresponding to the current file attribute information group is at least two, and each to-be-played file in the current file attribute information group has corresponding file attribute information, which can be understood as that the to-be-played file is one-to-one corresponding to the corresponding file attribute information.
[0044] In the embodiment, the execution order of pre-downloading and playing includes two implementation manners: one is to pre-download the to-be-played file while playing the to-be-played file that has been successfully downloaded; the other is to play the to-be-played file after completing the downloading of all to-be-played files.
[0045] Specifically, the to-be-played file can be played after the downloading of all to-be-played files corresponding to the current file attribute information group is completed; or the to-be-played file that has been successfully downloaded can be played during the pre-downloading of the to-be-played file corresponding to the current file attribute information group.
[0046] S130, in response to a file deletion operation, deleting the to-be-played file corresponding to the current file attribute information group, and taking the next file attribute information group as the current file attribute information group.
[0047] The file deletion operation can be understood as an operation of deleting the to-be-played file when the corresponding deletion trigger condition is met.
[0048] In an embodiment, the file deletion operation satisfies the following trigger condition: the to-be-played file corresponding to the current file attribute information group is played, and the to-be-played file corresponding to the next file attribute information group is pre-downloaded.
[0049] In the embodiment, when the to-be-played file corresponding to the current file attribute information group is played and the to-be-played file corresponding to the next file attribute information group is pre-downloaded, the to-be-played file corresponding to the current file attribute information group is deleted, the to-be-played file corresponding to the next file attribute information group is played, and the next file attribute information group is taken as the current file attribute information group. Then, the to-be-played file corresponding to the current file attribute information group is played until the to-be-played file corresponding to all file attribute information groups is played. It should be noted that, after the to-be-played file corresponding to the next file attribute information group is pre-downloaded and the play queue is switched to the to-be-played file corresponding to the new file attribute information group, the storage data in the storage card is deleted according to the file access path, the file name, the file type, and the like of the current file attribute information group, so that the current play is not affected, thereby ensuring the smoothness of the current play, and the problems of insufficient storage space and memory OOM caused by the limitation of the performance of the mobile device are avoided, and the operation is relatively stable.
[0050] The technical solution of the embodiment of the application can pre-download and play the to-be-played file corresponding to the current file attribute information group, delete the to-be-played file corresponding to the current file attribute information group in response to the file deletion operation, take the next file attribute information group as the current file attribute information group, and play the to-be-played file corresponding to the current file attribute information group until the to-be-played file corresponding to all file attribute information groups is played. Therefore, the problems of unable to download or memory OOM caused by insufficient storage space or insufficient memory space are solved, the to-be-played file is downloaded in groups, a large amount of memory resources is not occupied, the network resources are saved, and the operation is relatively stable.
[0051] In an embodiment, Figure 2 The flowchart of another file playing method provided by an embodiment of the application is based on the above embodiments and is further refined. In order to better understand the flow of the entire file playing method, the embodiment is described by taking the example of logging in and checking a username and a password first, then selecting a to-be-played file from a shareable file, and playing the to-be-played file. Figure 2 As shown in the figure, the file playing method in the embodiment can include the following steps.
[0052] S210, in response to the received login instruction, a communication connection is established with the associated network storage.
[0053] The login instruction refers to an instruction that a user inputs corresponding information by clicking or touching to log in. The network storage can also be referred to as network attached storage, and refers to a terminal device connected to a network and having a data storage function. It is a dedicated data storage server that is data-centric, completely separates storage devices from servers, centrally manages data, thereby releasing bandwidth, improving performance, reducing total cost of ownership, and protecting investment. Its cost is much lower than that of using server storage, and its efficiency is much higher than that of the latter. Exemplarily, the network storage can be a NAS device.
[0054] In this embodiment, the user can input corresponding Internet Protocol (IP), username, password, and verification code, and the like, to establish a communication connection with the associated network storage to perform relevant verification of the username and password. In an embodiment, the process of establishing a communication connection between the mobile terminal to which the client belongs (i.e., the client is installed on the mobile terminal) and the network storage can be understood as the process of establishing a communication connection between the mobile terminal and the network storage in the same local area network.
[0055] S220, in response to the verification success instruction, obtaining and displaying the shareable files from the network storage; wherein the to-be-played files are a subset of the shareable files.
[0056] The shareable files refer to files that can be shared with other access devices (such as mobile terminals) through a network. Exemplarily, the shareable files can include audio files, video files, and photo files, and the like. It should be noted that the to-be-played files are a subset of the shareable files, which can be understood as that the to-be-played files are obtained by selecting from the shareable files.
[0057] In this embodiment, after establishing a communication connection with the associated network storage according to the login instruction, the username and password are verified. In the case where the verification of the username and password is passed, in response to the verification success instruction, the corresponding shareable files are obtained and displayed from the network storage. It should be noted that when the verification of the username and password is performed, if the verification of the username and password fails, the IP, username, password, and verification code, and the like can be input again to perform the verification of the username and password until the verification is successful.
[0058] S230, in response to the received file selection instruction, obtaining file attribute information of the to-be-played file corresponding to the file selection instruction.
[0059] The file selection instruction refers to an operation of selecting a file by the user in a touch or click manner.
[0060] In the embodiment, on the interface of displaying the files, there is a corresponding option box on each file, and there is a corresponding full selection box for all files. The client receives the selection of files by the user through touch or click, of course, the user can select the files by touch or click, or can check the selected files by touch or click. For example, 10 photos are displayed on the display interface, the user can select all the 10 photo files at a time, or can check one photo file at a time, which is not limited in the embodiment.
[0061] In the embodiment, in the case of receiving the file selection instruction, the file attribute information of the to-be-played file corresponding to the file selection instruction is obtained. For example, the user selects 30 files by clicking, wherein the 30 files can include one or more of audio files, video files and photo files, and the file attribute information of the to-be-played file corresponding to each of the 30 files is obtained.
[0062] S240, store the file attribute information to the target memory space.
[0063] The target memory space refers to a storage space for storing the file attribute information of the to-be-played file. The target storage space is a running memory space, which can be a hash map (i.e. HashMap). It should be noted that the HashMap is a data structure commonly used in JAVA, which is composed of array + linked list + red-black tree combination. The data stored in the HashMap is stored in the memory, which can also be a hash table (i.e. Hashtable), which is not limited in the embodiment.
[0064] In the embodiment, the selected to-be-played file is traversed, and the file attribute information corresponding to the to-be-played file can be stored in the target memory space in the form of key-value pair. For example, the to-be-played file is 10 photo files, and the file attribute information corresponding to the 10 photo files, such as the access path, name and memory size of the 10 photo files, is stored in the target memory space. The to-be-played file is 3 photo files and 7 video files, and the file attribute information corresponding to the 3 photo files and 7 video files, such as the access path, name and memory size of the 3 photo files and 7 video files, is stored in the target memory space.
[0065] In an embodiment, storing the file attribute information to the target memory space comprises:
[0066] Storing the file attribute information to the target memory space in the form of key-value pair.
[0067] In the embodiment, the file attribute information of the to-be-played file can be stored in the target memory space in the form of key-value pairs.
[0068] It should be noted that in the key-value pairs, each key corresponds to a value, the key refers to the number of stored values, and the value refers to the data to be stored. In the embodiment, the file name and the file access path in the file attribute information can be used as a key, the file information corresponding to the to-be-played file, the file type corresponding to the to-be-played file, and the memory size occupied by the to-be-played file can be used as a value, and the corresponding file can be found according to the file name and the file access path.
[0069] S250, determining a target playing type according to the file attribute information of the to-be-played file and / or the association between the to-be-played files.
[0070] The target playing type refers to the type of content playing of the to-be-played file.
[0071] In some embodiments, the target playing type can include one of the following: sequential playing and random playing.
[0072] In the embodiment, the sequential playing can be playing in a regular order. For example, the to-be-played files can be played in the order of the memory size from small to large, or in the order of the shooting or recording time, or in the order of the successful downloading sequence. The embodiment does not limit this. When the random playing is used, the to-be-played files can be played according to a pre-configured random algorithm and a non-repeated playing strategy.
[0073] In the embodiment, the target playing type can be determined according to the file attribute information of the to-be-played file and / or the association between the to-be-played files. For example, when the to-be-played files are a set of photographed photos, the playing type of the photographed photos can be determined according to the file attribute information of each photo in the set of photographed photos and / or the association between the set of photographed photos, and the playing type of the photographed photos is determined to be playing the photo content in sequence.
[0074] S260, determining a target selection mode of the file attribute information according to the target playing type.
[0075] In the embodiment, the target selection manner of the file attribute information is determined according to the target play type of the to-be-played file. For example, if the target play type of the to-be-played file is random play, the target selection manner of the file attribute information can be to select the current file attribute information in random or in a certain order; if the target play type of the to-be-played file is sequential play, the target selection manner of the file attribute information is to select the current file attribute information in a certain order or in random.
[0076] S270, selecting at least two file attribute information according to the target selection manner to generate a corresponding current file attribute information group.
[0077] S280, pre-downloading and playing the to-be-played file corresponding to the current file attribute information group; wherein the to-be-played file and the file attribute information are one-to-one.
[0078] S290, in response to a file deletion operation, deleting the to-be-played file corresponding to the current file attribute information group, and taking the next file attribute information group as the current file attribute information group.
[0079] The above technical solution of the embodiment of the application can quickly and accurately determine the target play type according to the received login instruction, the verification success instruction, the file selection instruction, the file attribute information, the target memory space, the file attribute information, and the association between the to-be-played files, so that the user can select the corresponding target play type, and the user experience is improved to a certain extent.
[0080] In an embodiment, Figure 3 The flowchart of another file play method provided by the embodiment of the application is further refined on the basis of the above embodiments, for example, Figure 3 As shown in the figure, the file play method in the embodiment can include the following steps:
[0081] S310, selecting at least two file attribute information according to the target selection manner to generate a corresponding current file attribute information group.
[0082] In an implementation mode, S310 comprises S3101 or S3102.
[0083] S3101, selecting at least two file attribute information from the target memory space in a random selection manner to generate a corresponding current file attribute information group.
[0084] In the embodiment, at least two file attribute information can be selected from the target memory space in a random selection manner to generate a corresponding current file attribute information group. Of course, the random selection manner can be a manner that a user randomly selects at least two file attribute information according to needs, preferences or habits. For example, the user randomly selects the second, fourth and sixth file attribute information from the target memory space according to habits to generate a corresponding current file attribute information group containing three pictures.
[0085] S3102, selecting at least two file attribute information from the target memory space in a sequential selection manner to generate a corresponding current file attribute information group.
[0086] In the embodiment, at least two file attribute information can be selected from the target memory space in a sequential selection manner to generate a corresponding current file attribute information group. Of course, the sequential selection manner can be a manner that at least two file attribute information are sequentially selected according to the order of files, the size order of memory occupied by files, etc. For example, the first, second, … and tenth file attribute information are sequentially selected from the target memory space according to the order of files to generate a corresponding current file attribute information group containing ten pictures.
[0087] S320, pre-downloading a to-be-played file corresponding to the current file attribute information group.
[0088] In the embodiment, the current file attribute information group generated by the at least two file attribute information is obtained, and a download thread is started to download the current file attribute information group into the mobile terminal device.
[0089] S330, in response to that a pre-download duration reaches a preset duration threshold, playing the to-be-played file corresponding to the current file attribute information group according to a pre-determined target playing type.
[0090] In the embodiment, the preset duration threshold can be understood as a pre-set pre-download duration threshold. The preset duration threshold can be set according to user needs or according to experience, which is not limited in the embodiment. For example, the preset duration threshold can be 20s or 30s, which is not limited in the embodiment.
[0091] It should be noted that the preset duration threshold corresponding to the file type of the to-be-played file is different. Specifically, when the file type corresponding to the to-be-played file is a photo file, the corresponding preset duration threshold is relatively short, and when the file type corresponding to the to-be-played file is a video file and / or an audio file, the corresponding preset duration threshold is relatively long. For example, when 8 file attribute information corresponding to 8 photo files are included in the current file attribute information group, the preset duration threshold can be set to 15s; when 8 video files are included in the current file attribute information group, the preset duration threshold can be set to 1min, which is not limited in the embodiment.
[0092] In the embodiment, when the pre-download duration reaches the preset duration threshold, the to-be-played file corresponding to the current file attribute information group is played according to the predetermined target playing type. It should be noted that the to-be-played file in the embodiment is a file that has been downloaded within the pre-download duration. For example, the preset duration threshold is 25s, the to-be-played file corresponding to the current file attribute information group is a group of 10 pictures, and within 25s, the to-be-played file corresponding to the current file attribute information group that has been pre-downloaded is a group of 8 pictures. Then, the to-be-played file that has been downloaded is played according to the predetermined target playing type, which is a group of 8 pictures.
[0093] In an embodiment, in response to the pre-download duration reaching the preset duration threshold, the to-be-played file corresponding to the current file attribute information group is played according to the predetermined target playing type, comprising:
[0094] In response to the pre-download duration reaching the preset duration threshold, the to-be-played file corresponding to the current file attribute information group is played according to the predetermined target playing type; wherein the to-be-played file is a subset of the to-be-played file.
[0095] In the embodiment, when the pre-download duration reaches the preset duration threshold, the to-be-played file corresponding to the current file attribute information group is played according to the predetermined target playing type; wherein the to-be-played file is a subset of the to-be-played file, which can be understood as a part or all of the to-be-played file.
[0096] S340, downloading the to-be-played file to a preset storage space.
[0097] The preset storage space refers to the local memory corresponding to the mobile terminal, for example, the storage space corresponding to the SD card of the mobile terminal device.
[0098] In the embodiment, the to-be-played file is downloaded to the preset storage space to be saved in the preset storage space. It should be noted that the to-be-played file can be downloaded to the mobile terminal device for playing by using a supported shareable transmission protocol, for example, a file transfer protocol (FTP), a server message block (SMB), a network file system (NFS), or the like.
[0099] It should be noted that the to-be-played file in the embodiment is a downloaded to-be-played file. After the to-be-played file is downloaded to the preset storage space, the to-be-played file corresponding to the current file attribute information group is deleted from the preset storage space when the to-be-played file corresponding to the next file attribute information group is pre-downloaded.
[0100] S350, in response to the file deletion operation, deleting the to-be-played file corresponding to the current file attribute information group and taking the next file attribute information group as the current file attribute information group.
[0101] The above technical solution of the embodiment of the application can further solve the problem of unable to download or memory OOM caused by insufficient storage space or insufficient memory space, realize downloading of the to-be-played file in groups, do not occupy a large amount of memory resources, make the overall process smooth and interruptable at any time, save network resources, and make the operation more stable.
[0102] In an embodiment, in order to better understand the file playing method, the embodiment can be used as a preferred embodiment to further describe the file playing method. Figure 4A flow chart of another file playing method is provided in an embodiment of the present application. The embodiment takes a photo file as an example of file type, and takes sequentially selecting at least two file attribute information as an example of target selection mode, and is described in detail. Exemplarily, the number of a group of photo files is 10, and each photo file has corresponding file attribute of photo access path, photo name, and photo memory. In the embodiment, HashMap represents the target memory space in the above embodiment. The SD card represents the preset storage space in the above embodiment.
[0103] In the embodiment, the photo access path, photo, and photo memory of the photo file are recorded and saved into the HashMap by traversing the network memory. After the traversal is completed, the photo access path, photo name, and photo memory of 10 photos are taken from the HashMap in sequence each time to generate a corresponding current file attribute information group. The corresponding 10 photo files are downloaded onto the mobile device for playing using a supported shareable transmission protocol, such as FTP, SMB, NFS, etc. The pre-download of 10 photo files in the next file attribute information group is started. After the 10 photos are played, the to-be-played photo files corresponding to the current file attribute information group are deleted, so as to solve the situation of not being able to download or memory OOM caused by insufficient storage space or insufficient memory space of the mobile device due to too many photo files.
[0104] As shown in FIG. 6, the specific file playing method includes the following steps: Figure 4
[0105] S410, inputting IP, username, and password.
[0106] S420, in response to the received login instruction, establishing a communication connection with the associated HashMap.
[0107] S430, verifying whether the username and user password are passed, if yes, performing S4440, otherwise, performing S410 until the username and user password are verified to be passed.
[0108] S440, in response to the verification success instruction, obtaining and displaying the shareable photo file from the network memory.
[0109] S450, selecting the photo file according to the displayed shareable photo file.
[0110] S460, in response to the received file selection instruction, obtaining the file attribute information of the to-be-played photo file corresponding to the file selection instruction.
[0111] S470, storing the file attribute information into the HashMap.
[0112] S480, obtaining N groups of data corresponding to file attribute information of the photo file to be played.
[0113] S490, pre-downloading the current file attribute information group to the SD card.
[0114] S4100, whether the pre-downloading of the current file attribute information group is completed, if yes, executing S4110, if not, executing S4120.
[0115] S4110, determining the target playing type according to the file attribute information of the file to be played and / or the association between the files to be played.
[0116] S4120, preparing to play.
[0117] S4130, playing the file to be played.
[0118] S4140, whether the file to be played is played, if not, executing S4140, if yes, executing S4150.
[0119] S4150, playing the file to be played corresponding to the current file attribute information group is completed, and the file to be played corresponding to the next file attribute information group is pre-downloaded, deleting the file to be played corresponding to the current file attribute information group.
[0120] S4160, playing the file to be played corresponding to the next file attribute information group, taking the next file attribute information group as the current file attribute information group, and returning to execute S4140 until the playing of all the files to be played corresponding to the file attribute information is completed.
[0121] S4170, completing the playing of all the files to be played corresponding to the file attribute information.
[0122] S4180, the user actively exits.
[0123] In the embodiment, the file attribute information corresponding to the photo file is saved into the HashMap by traversing the network storage, the file attribute information corresponding to the photo file is taken out from the HashMap in sequence, the photo is downloaded to the mobile device by starting the downloading thread, the current file attribute information group is played, and the next file attribute information group is pre-downloaded; after the photo of the current file attribute information group is played, the photo is deleted, and the photo of the next file attribute information group is played.
[0124] In an embodiment, Figure 5A structural block diagram of a file playing device is provided for an embodiment of the present application, which is applicable to the case of playing a file in a terminal device, and can be realized by hardware / software. Figure 5 As shown in the figure, the device comprises a generating module 510, a downloading playing module 520 and a deleting playing module 530.
[0125] The generating module 510 is configured to select at least two file attribute information according to a target selection mode, and generate a corresponding current file attribute information group.
[0126] The downloading playing module 520 is configured to pre-download and play a to-be-played file corresponding to the current file attribute information group; the to-be-played file and the file attribute information are in one-to-one correspondence.
[0127] The deleting playing module 530 is configured to delete the to-be-played file corresponding to the current file attribute information group in response to a file deletion operation, and take the next file attribute information group as the current file attribute information group, and return to execute the playing of the to-be-played file corresponding to the current file attribute information group until the playing of all to-be-played files corresponding to the file attribute information is completed.
[0128] In the embodiment of the present application, the downloading playing module pre-downloads and plays the to-be-played file corresponding to the current file attribute information group; the deleting playing module deletes the to-be-played file corresponding to the current file attribute information group in response to a file deletion operation, takes the next file attribute information group as the current file attribute information group, and returns to execute the playing of the to-be-played file corresponding to the current file attribute information group until the playing of all to-be-played files corresponding to the file attribute information is completed, which can solve the problem of unable to download or memory OOM caused by insufficient storage space or insufficient memory space, realize the downloading of to-be-played files in groups, occupy less memory resources, make the overall process smooth and interruptable at any time, save network resources, and make the running more stable.
[0129] In an embodiment, the file deletion operation satisfies the following trigger condition: the to-be-played file corresponding to the current file attribute information group is played completely, and the to-be-played file corresponding to the next file attribute information group is pre-downloaded completely.
[0130] In an embodiment, the file playing device further comprises:
[0131] The information obtaining module is configured to, before the at least two file attribute information is selected according to the target selection mode and the corresponding current file attribute information group is generated, obtain the file attribute information of a to-be-played file corresponding to a received file selection instruction in response to the file selection instruction.
[0132] a storage module, configured to store the file attribute information to a target memory space.
[0133] In an embodiment, the storage module further comprises:
[0134] a storage unit, configured to store the file attribute information to the target memory space in a key-value pair manner.
[0135] In an embodiment, the file playing device further comprises:
[0136] a connection establishing module, configured to, before the at least two file attribute information is selected according to the target selection manner and the corresponding current file attribute information group is generated, establish a communication connection with the associated network storage in response to a received login instruction;
[0137] a file display module, configured to, in response to a verification success instruction, acquire and display shareable files from the network storage; wherein the files to be played are a subset of the shareable files.
[0138] In an embodiment, the file playing device comprises:
[0139] a type determining module, configured to, before the at least two file attribute information is selected according to the target selection manner and the corresponding current file attribute information group is generated, further comprise determining a corresponding target playing type according to the file attribute information of the files to be played and / or the association between the files to be played;
[0140] a manner determining module, configured to determine the target selection manner of the file attribute information according to the target playing type.
[0141] In an embodiment, the generating module 510 comprises:
[0142] a first generating unit, configured to select at least two file attribute information from the target memory space according to a random selection manner and generate a corresponding current file attribute information group;
[0143] or, a second generating unit, configured to select at least two file attribute information from the target memory space according to a sequential selection manner and generate a corresponding current file attribute information group.
[0144] In an embodiment, the downloading and playing module 520 comprises:
[0145] a pre-downloading unit, configured to pre-download the files to be played corresponding to the current file attribute information group;
[0146] a file playing unit, configured to, in response to a pre-download duration reaching a preset duration threshold, play the files to be played corresponding to the current file attribute information group according to a pre-determined target playing type.
[0147] In an embodiment, the file playing unit is further configured to:
[0148] In response to the pre-download duration reaching a preset duration threshold, playing the downloaded file corresponding to the current file attribute information group according to the predetermined target playing type, wherein the downloaded file is a subset of the to-be-played file.
[0149] In an embodiment, the downloading and playing module 520 further comprises:
[0150] a space downloading unit configured to download the to-be-played file to a preset storage space.
[0151] In an embodiment, the file attribute information comprises at least one of the following: a file access path; a file name; a file type; a file memory occupation;
[0152] The file type comprises at least one of the following: an audio file; a video file; a photo file.
[0153] The file playing device provided by the embodiments of the present application can execute the file playing method provided by any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0154] In an embodiment, Figure 6 A structural schematic diagram of an electronic device is provided for the embodiments of the present application. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0155] As Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication. The memory stores a computer program executable by the at least one processor 11, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0156] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0157] The processor 11 can be various general and / or special-purpose processing components having processing and computing capabilities. Some examples of the processor 11 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 processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the file playing method.
[0158] In some embodiments, the file playing method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the file playing method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the file playing method by any other appropriate means, such as by means of firmware.
[0159] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0160] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.
[0161] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0162] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0163] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0164] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0165] In an embodiment, the present application also includes a computer program product, which comprises a computer program, wherein the computer program is executed by a processor to implement the file playing method of any embodiment of the present application.
[0166] It should be understood that various forms of flow shown above can be used, with steps reordered, added, or removed. For example, the steps recited in the present application can be performed in parallel, in series, or in a different order, without limitation herein, as long as the desired results of the technical solutions of the present application can be achieved.
[0167] The above detailed description does not limit the scope of the application. Various modifications, combinations, sub-combinations and alternatives can be made to the detailed description. Any modification, equivalent replacement and improvement etc. made within the spirit and principle of the application shall be included in the scope of the application.
Claims
1. A method for playing a file, characterized in that, include: Select at least two file attribute information according to the target selection method, and generate the corresponding current file attribute information group; Download and play the file to be played corresponding to the current file attribute information group; wherein, the file to be played corresponds one-to-one with the file attribute information; In response to a file deletion operation, the file to be played corresponding to the current file attribute information group is deleted, and the next file attribute information group is set as the current file attribute information group. The process then returns to playing the file to be played corresponding to the current file attribute information group until all files corresponding to all file attribute information groups have finished playing. The file deletion operation is performed when certain deletion trigger conditions are met. These conditions are: the file to be played corresponding to the current file attribute information group has finished playing, and the file to be played corresponding to the next file attribute information group has finished pre-downloading. The step of selecting at least two file attribute information according to the target selection method and generating a corresponding current file attribute information group includes: At least two file attribute information pieces are selected from the target memory space in a random selection manner to generate the corresponding current file attribute information group; Alternatively, at least two file attribute information items can be selected from the target memory space in a sequential selection manner to generate a corresponding current file attribute information group; wherein, the current file attribute information group is a collection of file attribute information items composed of the currently selected file attribute information items.
2. The method according to claim 1, characterized in that, Before selecting at least two file attribute information according to the target selection method and generating the corresponding current file attribute information group, the method further includes: In response to a received file selection instruction, obtain the file attribute information of the file to be played corresponding to the file selection instruction; The file attribute information is stored in the target memory space.
3. The method according to claim 2, characterized in that, The step of storing the file attribute information into the target memory space includes: The file attribute information is stored in the target memory space in a key-value pair manner.
4. The method according to claim 1, characterized in that, Before selecting at least two file attribute information according to the target selection method and generating the corresponding current file attribute information group, the method further includes: In response to the received login command, a communication connection is established with the associated network storage. In response to a successful verification command, the system retrieves and displays shareable files from the network storage; wherein the files to be played are a subset of the shareable files.
5. The method according to claim 1, characterized in that, Before selecting at least two file attribute information according to the target selection method and generating the corresponding current file attribute information group, the process also includes: The corresponding target playback type is determined based on the file attribute information of the file to be played and / or the correlation between the files to be played; The target selection method for the file attribute information is determined based on the target playback type.
6. The method according to any one of claims 1-5, characterized in that, The pre-downloading and playback of the file to be played corresponding to the current file attribute information group includes: Pre-download the file to be played corresponding to the current file attribute information group; In response to the pre-download duration reaching a preset duration threshold, the file to be played corresponding to the current file attribute information group is played according to the predetermined target playback type.
7. The method according to claim 6, characterized in that, The step of responding to the pre-download duration reaching a preset duration threshold and playing the file to be played corresponding to the current file attribute information group according to a pre-determined target playback type includes: In response to the pre-download duration reaching a preset duration threshold, the downloaded files corresponding to the current file attribute information group are played according to a pre-determined target playback type; wherein, the downloaded files are a subset of the files to be played.
8. The method according to claim 6, characterized in that, The pre-downloading and playback of the file to be played corresponding to the current file attribute information group also includes: Download the file to be played to the preset storage space.
9. The method according to any one of claims 1-5, characterized in that, The file attribute information includes at least one of the following: file access path; file name; file type; memory occupied by the file; The file types include one of the following: audio files; video files; photo files.
10. A file playback device, characterized in that, include: The generation module is used to select at least two file attribute information according to the target selection method and generate the corresponding current file attribute information group. The download and playback module is used to pre-download and play the files to be played corresponding to the current file attribute information group; wherein, the files to be played correspond one-to-one with the file attribute information; The deletion playback module is used to respond to a file deletion operation by deleting the file to be played corresponding to the current file attribute information group, taking the next file attribute information group as the current file attribute information group, and returning to execute the playback of the file to be played corresponding to the current file attribute information group until the playback of all files corresponding to all file attribute information groups is completed; wherein, the file deletion operation satisfies the following triggering conditions: the file to be played corresponding to the current file attribute information group has been completed, and the file to be played corresponding to the next file attribute information group has been pre-downloaded; The generation module includes: The first generation unit is used to select at least two file attribute information from the target memory space in a random selection manner and generate the corresponding current file attribute information group. Alternatively, the second generation unit is used to select at least two file attribute information from the target memory space in a sequential selection manner to generate a corresponding current file attribute information group; wherein, the current file attribute information group is a collection of file attribute information composed of the currently selected file attribute information.
11. The apparatus according to claim 10, characterized in that, The device further includes: The information acquisition module is used to, in response to the received file selection instruction, acquire the file attribute information of the file to be played corresponding to the file selection instruction before selecting at least two file attribute information according to the target selection method and generating the corresponding current file attribute information group; A storage module is used to store the file attribute information into the target memory space.
12. The apparatus according to claim 10, characterized in that, The device further includes: The type determination module is used to determine the corresponding target playback type based on the file attribute information of the file to be played and / or the correlation between the files to be played before selecting at least two file attribute information according to the target selection method and generating the corresponding current file attribute information group. The method determination module is used to determine the target selection method of the file attribute information based on the target playback type.
13. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the file playback method according to any one of claims 1-9.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the file playback method according to any one of claims 1-9.
15. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the file playback method according to any one of claims 1-9.
Citation Information
Patent Citations
Playing method and system of multimedia file
CN105338401A
Caching method and caching device
CN114650433A