Method and Apparatus for Downloading Streaming Media File Fragment and Terminal
Abstract
A method, including determining a length of a to-be-downloaded streaming media file fragment, splitting the to-be-downloaded streaming media file fragment into at least two subfragments when the length of the to-be-downloaded streaming media file fragment is greater than a preset length, where a length of each subfragment is not greater than the preset length, and separately downloading each subfragment. The to-be-downloaded streaming media file fragment is split based on the preset length and the subfragments obtained after splitting are downloaded in parallel when a network environment is relatively poor and the to-be-downloaded streaming media file fragment is relatively long.
Claims
exact text as granted — not AI-modified1 . A method for downloading a streaming media file fragment, comprising:
determining a length of a to-be-downloaded streaming media file fragment; splitting the to-be-downloaded streaming media file fragment into at least two subfragments when the length of the to-be-downloaded streaming media file fragment is greater than a preset length, wherein a length of each subfragment is less than or equal to the preset length; and separately downloading each subfragment.
2 . The method of claim 1 , wherein determining the length of the to-be-downloaded streaming media file fragment comprises:
sending a fragment download request to a server; and receiving feedback information from the server, wherein the feedback information comprises the length of the to-be-downloaded streaming media file fragment.
3 . The method of claim 2 , wherein the preset length matches a transmission bandwidth between a terminal and the server.
4 . The method of claim 3 , wherein splitting the to-be-downloaded streaming media file fragment into the at least two subfragments comprises:
determining a maximum length of a subfragment; determining a field range of the to-be-downloaded streaming media file fragment; and dividing the field range into at least two subranges, wherein a length of each subrange is less than or equal to the maximum length.
5 . The method of claim 4 , wherein dividing the field range into the at least two subranges comprises dividing the field range into a first subrange and a second subrange, wherein the first subrange corresponds to a field range of the to-be-downloaded streaming media file fragment that is to be played first, and wherein a field length of the first subrange is less than a field length of the second subrange.
6 . The method of claim 4 , wherein separately downloading each subfragment comprises:
generating subfragment download requests, wherein each download request corresponds to a subrange and comprises a download address of the to-be-downloaded streaming media file fragment and the subrange corresponding to the download request; sending the subfragment download requests; and receiving subfragments from the server based on the subfragment download requests.
7 . The method of claim 6 , wherein sending the subfragment download requests comprises sending the download requests in parallel.
8 . The method of claim 1 , further comprising:
obtaining an address of a second streaming media file fragment, wherein the second streaming media file fragment is a next streaming media file fragment of the to-be-downloaded streaming media file fragment; determining, based on the address of the second streaming media file fragment, a server on which the second streaming media file fragment is located; and requesting to download the second streaming media file fragment when the server on which the second streaming media file fragment is located is different from that on which the to-be-downloaded streaming media file fragment is located.
9 . The method of claim 1 , further comprising:
collecting statistics on a transmission bandwidth between a terminal downloading the to-be-downloaded streaming media file fragment and a server after the to-be-downloaded streaming media file fragment is downloaded; and determining a second preset length based on the transmission bandwidth.
10 . An apparatus for downloading a streaming media file fragment, comprising:
a memory comprising instructions; and a processor coupled to the memory, wherein the instructions cause the processor to be configured to:
determine a length of a to-be-downloaded streaming media file fragment;
split the to-be-downloaded streaming media file fragment into at least two subfragments when the length of the to-be-downloaded streaming media file fragment is greater than a preset length matching a transmission bandwidth between a terminal and a server, wherein a length of each subfragment is less than or equal to the preset length; and
separately download each subfragment.
11 . The apparatus of claim 10 , wherein the instructions further cause the processor to be configured to:
send a fragment download request to the server; and receive feedback information from the server, wherein the feedback information comprises the length of the to-be-downloaded streaming media file fragment.
12 . The apparatus of claim 11 , wherein the instructions further cause the processor to be configured to:
determine a maximum length of a subfragment; determine a field range of the to-be-downloaded streaming media file fragment; and divide the field range into at least two subranges, wherein a length of each subrange is less than or equal to the maximum length.
13 . The apparatus of claim 12 , wherein the instructions further cause the processor to be configured to:
generate subfragment download requests, wherein each download request corresponds to a subrange and comprises a download address of the to-be-downloaded streaming media file fragment and the subrange corresponding to the download request; send the subfragment download requests; and receive subfragments from the server based on the subfragment download requests.
14 . The apparatus of claim 13 , wherein the instructions further cause the processor to be configured to send the subfragment download requests in parallel.
15 . The apparatus of claim 10 , wherein the instructions further cause the processor to be configured to:
obtain an address of a second streaming media file fragment, wherein the second streaming media file fragment is a next streaming media file fragment of the to-be-downloaded streaming media file fragment; determine, based on the address of the second streaming media file fragment, a server on which the second streaming media file fragment is located; and request to download the second streaming media file fragment when the server on which the second streaming media file fragment is located is different from that on which the to-be-downloaded streaming media file fragment is located.
16 . The apparatus of claim 10 , wherein the instructions further cause the processor to be configured to:
collect statistics on the transmission bandwidth between the terminal downloading the to-be-downloaded streaming media file fragment and the server after the to-be-downloaded streaming media file fragment is downloaded; and determine a second preset length based on the transmission bandwidth.
17 . A terminal, comprising:
a communications bus; a processor coupled to the communications bus and configured to:
determine a length of a to-be-downloaded streaming media file fragment; and
split the to-be-downloaded streaming media file fragment into at least two subfragments when the length of the to-be-downloaded streaming media file fragment is greater than a preset length matching a transmission bandwidth between the terminal and a server;
a communications interface coupled to the communications bus and configured to:
receive each subfragment from the server; and
transmit the subfragment to the processor using the communications bus; and
a memory coupled to the communications bus and configured to store each subfragment received by the communications interface.
18 . The terminal of claim 17 , wherein in a manner of splitting the to-be-downloaded streaming media file fragment into the at least two subfragments, the processor is further configured to:
determine a maximum length of a subfragment; determine a field range of the to-be-downloaded streaming media file fragment; and divide the field range into at least two subranges, wherein a length of each subrange is less than or equal to the maximum length.
19 . The terminal of claim 18 , wherein before receiving each subfragment, the processor is further configured to generate subfragment download requests, wherein each download request corresponds to a subrange and comprises a download address of the to-be-downloaded streaming media file fragment and the subrange corresponding to the download request, and wherein the communications interface is further configured to:
send the subfragment download requests; and receive subfragments from the server based on the subfragment download requests.
20 . The terminal of claim 19 , wherein in a manner of sending the subfragment download requests, the communications interface is further configured to send the download requests in parallel.Join the waitlist — get patent alerts
Track US2019158936A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.