Audio track switching method, device, equipment and storage medium
By synchronously playing embedded video and audio track data in streaming media and switching external audio tracks when the buffering reaches a threshold, the problem of high complexity of audio track replacement in the existing technology is solved, and smooth audio track switching and easily scalable audio track management are achieved.
Patent Information
- Application Number
- CN202111330963.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-10
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2041-11-10
AI Technical Summary
Existing streaming media technology requires replacing the entire media stream of the streaming media when replacing the audio track, resulting in high complexity in audio track switching and the need to pre-store the synthetic media stream of different audio tracks and other media information.
By obtaining the embedded video data and embedded audio track data links of the streaming media, the embedded audio track data is buffered when a switching instruction is received after synchronous playback, and the external audio track data is switched to be played when a preset threshold is reached. This achieves the goal of switching the audio track corresponding to the embedded audio track data link without modifying the content of the original playback link of the streaming media.
It reduces the complexity of audio track switching, improves the smoothness and scalability of switching, and reduces the client storage space requirements.
Smart Images

Figure CN116112717B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to streaming media technology in the computer field, and in particular to a track switching method, a track switching device, an electronic device, and a computer-readable storage medium. Background Art
[0002] Streaming media technology refers to the streaming transmission of multimedia information. This technology allows users to view multimedia content while downloading files, reducing client storage space and improving playback efficiency. Furthermore, with technological advancements, the ability to replace audio tracks in streaming media is becoming increasingly common, meeting varying user demands for audio.
[0003] In existing technical implementations, because audio and other media information in streaming media are multiplexed for streaming transmission, replacing an audio track in a stream typically involves replacing the entire media stream or modifying the link content. However, this track replacement requires pre-storing a composite media stream of different audio tracks and other media information on the server, which increases the complexity of track switching. Summary of the Invention
[0004] To solve the above technical problems, the embodiments of the present application provide a track switching method, a track switching device, an electronic device, a computer-readable storage medium, and a computer program product. There is no need to modify the content of the original playback link of the streaming media. Only the embedded track data corresponding to the independent embedded track data link is switched, thereby reducing the complexity of track switching and achieving the advantage of easy scalability.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.
[0006] According to one aspect of an embodiment of the present application, a track switching method is provided, comprising: obtaining embedded video data and embedded track data corresponding to the streaming media according to an embedded video data link and an embedded track data link corresponding to the streaming media; synchronously playing the embedded video data and the embedded track data; buffering the embedded track data according to a received first track data switching instruction; and when the amount of buffered embedded track data reaches a first preset threshold, switching to playing external track data corresponding to the embedded video data, so that the external track data and the embedded video data are played synchronously.
[0007] According to one aspect of an embodiment of the present application, a track switching device is provided, comprising: an acquisition module for acquiring embedded video data and embedded track data corresponding to the streaming media based on the embedded video data link and the embedded track data link corresponding to the streaming media; a playback module for synchronously playing the embedded video data and the embedded track data; a buffering module for buffering the embedded track data based on a received first track data switching instruction; and a switching module for switching to playing external track data corresponding to the embedded video data when the amount of buffered embedded track data reaches a first preset threshold, so that the external track data and the embedded video data are played synchronously.
[0008] In one embodiment of the present application, the audio track switching device also includes a determination module, which is used to obtain the external audio track data according to the external audio track data corresponding to the embedded video data during the buffering process of the embedded audio track data; and determine the target playback time point from the external audio track data that is consistent with when the amount of buffered embedded audio track data reaches the first preset threshold.
[0009] In one embodiment of the present application, the switching module is specifically used to stop buffering the embedded audio track data when the target playback time point is determined; determine the target audio track data frame corresponding to the target playback time point from the external audio track data, and start playing the external audio track data from the next frame of the target audio track data frame.
[0010] In one embodiment of the present application, the audio track switching device also includes a generation module, which is used to generate an audio track switching interface based on the embedded audio track data link and the external audio track data link corresponding to the external audio track data, and the audio track switching interface is used to receive the first audio track data switching instruction carrying an external audio track identifier, and the external audio track identifier corresponds to the external audio track data link.
[0011] In one embodiment of the present application, the buffer module is also used to buffer the external audio track data according to the received second audio track data switching instruction; the switching module is also used to switch to playing the embedded data audio track when the amount of buffered external audio track data reaches a second preset threshold, so that the embedded audio track data and the embedded video data are played synchronously.
[0012] In one embodiment of the present application, the determination module is further used to obtain a transport stream slice of the embedded audio track data according to the embedded audio track data link during the buffering of the external audio track data; determine a target transport stream slice based on the transport stream slice of the embedded audio track data and the buffered external audio track data; and stop buffering the external audio track data when it is determined that the target transport stream slice is obtained.
[0013] In one embodiment of the present application, the determination module is specifically used to determine, from the transport stream slice of the embedded audio track data, the transport stream slice in which the amount of buffered external audio track data reaches the second preset threshold, and use the determined transport stream slice as the slice to be switched; delete the data in the slice to be switched that overlaps with the buffered external audio track data track to obtain the target transport stream slice, so as to switch and play the embedded audio track data starting from the target transport stream slice.
[0014] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the audio track switching method as described above.
[0015] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the audio track switching method as described above.
[0016] According to one aspect of an embodiment of the present application, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the audio track switching method as described above.
[0017] In the technical solution provided in the embodiments of the present application, the streaming media corresponds to an independent embedded video data link and an independent embedded audio track data link, and then the embedded video data and embedded audio track data corresponding to the streaming media can be obtained according to the embedded video data link and the embedded audio track data link, and the embedded audio track data and the embedded video data can be played synchronously. When it is necessary to switch the embedded audio track data being played, there is no need to modify the content of the original playback link of the streaming media. Only the embedded audio track data corresponding to the independent embedded audio track data link needs to be switched to switch the playback of the external audio track data corresponding to the embedded video data, thereby reducing the complexity of audio track switching and achieving the advantage of easy scalability.
[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, serving to explain the principles of the present application. Obviously, the drawings described below are merely some embodiments of the present application, and a person of ordinary skill in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0020] Figure 1 It is a schematic diagram of an implementation environment involved in this application;
[0021] Figure 2 is a flowchart of a method for switching audio tracks shown in an exemplary embodiment of the present application;
[0022] Figure 3 is a flowchart of another audio track switching method shown in an exemplary embodiment of the present application;
[0023] Figure 4 is a schematic diagram illustrating the relationship between embedded audio track data and external audio track data according to an exemplary embodiment of the present application;
[0024] Figure 5 is a flowchart of another audio track switching method shown in an exemplary embodiment of the present application;
[0025] Figure 6 yes Figure 2 A flow chart in an exemplary embodiment after step S140 in the illustrated embodiment;
[0026] Figure 7 is a flowchart of a method for switching audio tracks shown in another exemplary embodiment of the present application;
[0027] Figure 8 yes Figure 7 A flow chart of step S520 in the illustrated embodiment in an exemplary embodiment;
[0028] Figure 9 This is a flowchart of switching an embedded audio track to an external audio track, shown in an exemplary embodiment of the present application;
[0029] Figure 10 is a schematic diagram of an HLS playback link list shown in an exemplary embodiment of the present application;
[0030] Figure 11 is a schematic diagram of an application interface shown in an exemplary embodiment of the present application;
[0031] Figure 12 This is a flowchart of switching an external audio track to an embedded audio track, shown in an exemplary embodiment of the present application;
[0032] Figure 13 is a schematic diagram of an audio track switching device shown in an exemplary embodiment of the present application;
[0033] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0034] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. When the following description refers to the drawings, identical numerals in different figures represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0035] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0036] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0037] It should also be noted that the term "plurality" used in this application refers to two or more. "And / or" describes the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0038] Here, we introduce the definitions of abbreviations and key terms related to this application:
[0039] HLS: (HTTP Live Streaming, an adaptive bitrate streaming protocol based on HTTP) is Apple's dynamic bitrate adaptation technology;
[0040] M3U8: M3U8 is the Unicode version of M3U, encoded in UTF-8. Both "M3U" and "M3U8" files are the basis of the HLS protocol format used by Apple; HLS playlist file suffix;
[0041] External audio track data: the audio track data corresponding to an independent audio track data playback link outside the HLS playback link list;
[0042] Embedded audio track data: The audio track data corresponding to an independent audio track data playback link within the HLS playback link list.
[0043] See also Figure 1 , Figure 1This is a schematic diagram of an implementation environment involved in this application, which is used to support a track switching application. The implementation environment includes a client 10 and a server 20, and the client 10 and the server 20 communicate with each other via a wired or wireless network.
[0044] The client 10 is used to obtain the embedded video data and embedded audio track data corresponding to the streaming media from the server 20 according to the embedded video data link and the embedded audio track data link corresponding to the streaming media; synchronously play the embedded video data and the embedded audio track data; buffer the embedded audio track data according to the received first audio track data switching instruction; when the amount of buffered audio track data reaches a first preset threshold, switch to playing the external audio track data corresponding to the embedded video data, so that the external audio track data and the embedded video data are played synchronously, wherein the external audio track data can be obtained from the server 20.
[0045] The server 20 is used to send embedded video data and embedded audio track data to the client 10 , and is also used to send external audio track data to the client 10 .
[0046] Among them, the client 10 can be any electronic device that can play streaming media, such as a smart phone, tablet, laptop, computer, intelligent voice interaction device, smart home appliance, car terminal, etc. The server 20 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, CDN (Content Delivery Network) and big data and artificial intelligence platforms. This is not restricted here.
[0047] It can be understood that the embodiments of the present invention can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving. For example, the client is a vehicle-mounted terminal, and the vehicle-mounted terminal can play streaming media, which is music and video. The user triggers the switching of embedded audio track and external audio track data through intelligent voice.
[0048] like Figure 2 As shown, Figure 2 This is a flow chart of a method for switching audio tracks according to an exemplary embodiment. Figure 1 The implementation environment shown and Figure 1 The client 10 in the embodiment shown in the embodiment specifically performs the following. The audio track switching method may include steps S110 to S140, which are described in detail as follows:
[0049] S110 , acquiring embedded video data and embedded audio track data corresponding to the streaming media according to the embedded video data link and embedded audio track data link corresponding to the streaming media.
[0050] In one embodiment of the present application, the streaming media corresponds to one embedded video data link and one embedded audio track data link. The embedded video data link corresponds to independent embedded video data, and the embedded audio track data link corresponds to independent embedded audio track data. It can be understood that the embedded video data corresponds to the embedded video data. The embedded video data link is the file resource path of the embedded video data. The client searches for the embedded video data on the server according to the embedded video data link and downloads the embedded video data from the server. Similarly, the embedded audio track data link is the file resource path of the embedded audio track data. The client searches for the embedded audio track data on the server according to the embedded audio track link and downloads the embedded audio track data from the server. Through the embedded video data link and the embedded audio track link, there is no need to store a complete streaming media. Only two links need to be saved, which reduces the storage space of the client.
[0051] In an exemplary embodiment, the client stores an HLS play link list (master playlist) based on the HLS protocol. The HLS play link list includes embedded video data links and embedded audio track data links of the same streaming media. Optionally, the HLS play link list is an M3U8 file.
[0052] S120 , synchronously play the embedded video data and the embedded audio track data.
[0053] In one embodiment of the present application, the client may be a multimedia player, which may read video frames and audio track frames from embedded video data and embedded audio track data, decode the video frames and audio track frames, and play the video frames and audio track frames synchronously to realize playback of streaming media.
[0054] S130: Buffer the embedded audio track data according to the received first audio track data switching instruction.
[0055] It is worth noting that the first audio track data switching instruction is used to instruct the buffering of the embedded audio track data and to switch the embedded audio track data when the buffering is completed; the first audio track data switching instruction can be received during the playback of the streaming media, for example, when the streaming media is played to 00:01:00, the first audio track data switching instruction is received, or it can be received when the streaming media is started, for example, when the first audio track data switching instruction is received at 00:00:00 of the streaming media, which is not limited here.
[0056] Exemplarily, the client also includes a display screen, and the first audio track data switching instruction is issued by the user triggering the display screen, and the display screen responds to the trigger operation, which can be a single click, double click, long press, heavy press or slide. Then the first audio track data switching instruction corresponding to the trigger operation received by the client can be a single click instruction, a double click instruction, a long press instruction, a heavy press instruction, or a slide instruction, but is not limited to this; in other embodiments, the trigger operation can also be a voice operation, such as automatically playing the voice of "switch audio track" to issue the first audio track data switching instruction.
[0057] In one embodiment of the present application, when the client receives the first audio track data switching instruction, it starts to buffer the embedded audio track data, that is, when the client receives the first audio track data switching instruction, it continues to download the embedded audio track data from the server and stores the downloaded embedded audio track data in the buffer; for example, when the streaming media is played to 00:01:00, the first audio track data switching instruction is received, and the embedded audio track data is buffered starting from 00:01:01. In another embodiment of the present application, the first audio track data switching instruction also carries a buffering start time point. When the client receives the first audio track data switching instruction, the embedded audio track data is buffered from the buffering start time point; for example, when the streaming media is played to 00:01:00, the first audio track data switching instruction is received, and the first audio track data switching instruction indicates that the embedded audio track data is buffered starting from 00:01:02. It can be understood that, in order to ensure the smoothness of playback, the client has already buffered the embedded audio track data of 00:01:01 and 00:01:02 when playing 00:01:00, so the embedded audio track data can be buffered starting from 00:01:02.
[0058] S140: When the amount of buffered embedded audio track data reaches a first preset threshold, switch to playing the external audio track data corresponding to the embedded video data, so that the external audio track data and the embedded video data are played synchronously.
[0059] In one embodiment of the present application, when the amount of embedded audio track data in the buffer reaches a first preset threshold, the playback of the embedded audio track data is switched to the external audio track data corresponding to the embedded video data, and when the switch is completed, the external audio track data and the embedded video data are played synchronously; by buffering the embedded audio track data, the external audio track data can be prepared during the buffering process, and when the amount of buffered embedded audio track data reaches a threshold, only the embedded audio track data needs to be switched to switch to play the external audio track data, and when switching, the switching complexity is reduced and the smoothness of switching from the embedded audio track data to the external audio track data is improved. The first preset threshold can be set by the user or by the client, and can also be flexibly adjusted according to actual needs. For example, when the current network speed of the client is high, the first preset threshold is smaller; when the current network speed of the client is low, the first preset threshold is larger.
[0060] It should be noted that before the switching is completed, the client has obtained the external audio track data. The external audio track data is an audio track added to the original embedded audio track data and embedded video data of the streaming media to assist the embedded video data, and the external audio track data corresponds to the embedded video data; for example, if the embedded audio track data is the Chinese audio track of a Chinese movie, then the external audio track data is the additional English audio track of a Chinese movie.
[0061] The client obtains one or more external audio track data, and the audio tracks corresponding to the multiple external audio track data are different. For example, audio streams of different language types (such as Chinese, English, etc.) correspond to different audio tracks; audio streams of different sound qualities (such as Dolby, AAC (Advanced Audio Coding), MP3 (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3)) also correspond to different audio tracks. When the client obtains multiple external audio track data, the first audio track data switching instruction also carries an external audio track identifier, which determines which external audio track data to switch to play.
[0062] In one example, before buffering the embedded track data based on the received first track data switching instruction, the track switching method further includes generating a track switching interface based on the embedded track data link and the external track data corresponding to the external track data, the track switching interface being configured to receive the first track data switching instruction carrying an external track identifier, where the external track identifier corresponds to the external track data link. By generating the track switching interface and receiving the first track data switching instruction carrying the external track identifier, the client can find the corresponding external track data link, thereby ensuring the reliability of the external track data switched for playback by the client.
[0063] The client generates a track switching interface based on the embedded track data link and one (or more) external track data links corresponding to one (or more) external track data. In one example, the client can display the track switching interface corresponding to the track switching interface. The track switching interface is displayed on the above-mentioned display screen. The user can select which track he wants to switch to through the track switching interface displayed on the display screen. For example, the user chooses to switch to the English track and clicks "English". The track switching interface corresponding to the track switching interface will receive a first track data switching instruction carrying an English identifier. The client will determine the corresponding external track data link according to the English identifier, and then switch to play the external track data corresponding to the external track data. It can be understood that the external identifier carried by the first track data switching instruction is unique, that is, the external identifier and the external track data link correspond one to one, and the client can determine the unique corresponding external track data link according to the external identifier.
[0064] Figure 3 This is a flowchart of another audio track switching method shown in an exemplary embodiment of the present application.
[0065] like Figure 3 As shown, the audio track switching method further includes:
[0066] S210. During the buffering of the embedded audio track data, the external audio track data is obtained according to the external audio track data link corresponding to the embedded video data.
[0067] In one embodiment of the present application, the external audio track data is obtained according to the external audio track data link. The external audio track data link is an independent audio track data link. The external audio track data link can be a link based on the HLS protocol, or a link that can obtain complete audio track data; wherein the external audio track data link can be obtained by the user from the web page, or it can be sent to the client in advance by the server; the client pre-stores the external audio track data link, and then in the process of buffering the embedded audio track data, searches for the external audio track data on the server according to the external audio track data link, and downloads and parses the external audio track data from the server.
[0068] It should be noted that the external audio track data obtained by the client can be the complete audio track data corresponding to the video data; it can also be all the audio track data corresponding to the video data that has not been played when the first audio track data switching instruction is received. For example, when the video data is played to 00:01:00, the first audio track data switching instruction is received, and the client obtains all the external audio track data starting from 00:01:01; it can also be partial audio track data corresponding to the video data that has not been played when the first audio track data switching instruction is received. When the video data is played to 00:01:00, the first audio track data switching instruction is received, and the client obtains partial external audio track data from 00:01:01 to 00:05:00. This is not limited here.
[0069] S220: Determine, from the external audio track data, a target playback time point corresponding to when the amount of buffered embedded audio track data reaches a first preset threshold.
[0070] In one embodiment of the present application, when the amount of embedded track data in the buffer reaches a first preset threshold, the corresponding playback moment in the embedded track data is recorded, and the track time point synchronized with the recorded playback moment is determined from the external track data, and the track time point is used as the target playback time point, that is, when the amount of embedded track data in the buffer reaches the first preset threshold, the target playback time point can be determined from the external track data, and then the corresponding external track data can be directly played according to the target playback time point. For example, Figure 4 As shown, if the amount of buffered embedded track data reaches the first preset threshold, i.e., when buffering is complete, the embedded track data can be played up to 00:01:05, then the track time point starting at 00:01:05 is determined from the external track data, and 00:01:05 is used as the target playback time point for the external track data. It can be understood that the external track data obtained in step S210 includes the track data corresponding to when the amount of buffered embedded track data reaches the first preset threshold.
[0071] In this embodiment, by downloading and parsing the external audio track data during the buffering of the embedded audio track data, preparations are made for switching to play the external audio track data, thereby reducing the switching time for subsequent switching to play the external audio track data, and determining the target playback point corresponding to the completion of the embedded audio track data buffering in the external audio track data, so that the corresponding external audio track data can be directly played according to the target playback time point, thereby improving the switching flow.
[0072] Figure 5 FIG. 1 is a flowchart of another audio track switching method shown in an exemplary embodiment of the present application. Figure 5 As shown, when the target playback time point of the external audio track data is determined, the process of switching to play the external audio track data corresponding to the embedded video data includes:
[0073] S310: When the target playback time point is determined to be obtained, stop buffering the embedded audio track data.
[0074] It can be understood that when the target playback time point is determined, it means that the external audio track data is ready to play, and the embedded audio track data can be played until the amount of buffered embedded audio track data reaches the first preset threshold. At this time, the buffering of the embedded audio track data is stopped, that is, the embedded audio track data is no longer downloaded from the server.
[0075] S320: Determine a target track data frame corresponding to a target playback time point from the external track data, and start playing the external track data from the next frame of the target track data frame.
[0076] In an embodiment of the present application, there is a corresponding audio track data frame for each playback time point of the external audio track data, so the client can determine the target audio track data frame corresponding to the target playback time point from the external audio track data.
[0077] In an exemplary embodiment, when the amount of buffered embedded track data reaches a first preset threshold, the target track data frame is determined from the external track data, and the embedded track data continues to play until the last moment of the buffered embedded track data is played, that is, the moment corresponding to the target playback time point of the external track data is played, and then the external track data is switched to and played starting from the next frame of the target track data frame of the external track data to complete the track switching. Figure 4 In the example, when the amount of buffered audio track data reaches the first preset threshold, the embedded audio track data can be played to 00:01:05, and 00:01:05 is used as the target playback time point of the external audio track data. The target audio track data frame A corresponding to the target playback time point can be determined, and the embedded audio track data continues to play to 00:01:05, and then the next frame of the target audio track data frame A is played at the next moment 00:01:05.
[0078] It should be noted that there is no order restriction for step S310 and step S320. S310 may be performed before step S320, or after step S310, or both may be performed simultaneously.
[0079] In one example, when the external audio track data link is a link based on the HLS protocol, such as stream_audio_english.m3u8, the client obtains the transport stream TS slice of the external audio track data according to the external audio track data link corresponding to the embedded video data, searches for the current slice at the moment when the amount of buffered embedded audio track data reaches the first preset threshold, and discards the part of the embedded audio track data that overlaps with the current slice of the external audio track data; when the embedded audio track plays to the last buffered data, it switches to playing the current slice of the external audio track data after discarding the overlapping data.
[0080] The above describes an embodiment of a method for switching from an embedded audio track to an external audio track; here we introduce an embodiment of a method for switching from an external audio track to an embedded audio track; Figure 6 As shown, Figure 6 yes Figure 2 The flowchart in an exemplary embodiment after step S140 in the embodiment shown. Figure 6 As shown, after switching to play the external audio track data corresponding to the embedded video data so that the external audio track data and the embedded video data are played synchronously, the method further includes:
[0081] S410: Buffering the external audio track data according to the received second audio track data switching instruction;
[0082] The first audio track data switching instruction is used to instruct the buffering of the embedded audio track data and to switch the external audio track data when the buffering is completed; the second audio track data switching instruction is received during the playback of streaming media; the second audio track data switching instruction is issued by the user triggering the display interface, and the display interface responds to the trigger operation, which can be a single click, double click, long press, heavy press or slide, then the second audio track data switching instruction corresponding to the trigger operation received by the client can be a single click instruction, a double click instruction, a long press instruction, a heavy press instruction, a slide instruction, but is not limited to this; in another embodiment, the trigger operation can also be a voice operation, such as automatically playing the voice of "switch audio track" to issue the second audio track data switching instruction. In one example, the trigger operation corresponding to the second audio track data switching instruction and the first audio track data switching instruction can be the same or different.
[0083] In one embodiment of the present application, the client receives a second audio track data switching instruction through an audio track switching interface. Since there is only one embedded audio track data, the second audio track data switching instruction does not need to carry an identifier; in another embodiment, when there are multiple embedded audio track data, the second audio track data switching instruction carries an embedded identifier to determine which embedded audio track data to switch to play.
[0084] The process of switching the embedded audio track data to the external audio track data is the same as that of the embedded audio track data. When the second audio track data switching instruction is received, the external audio track data begins to be buffered. For details, please refer to the process of step S130, which will not be described in detail here.
[0085] S420: When the amount of buffered external audio track data reaches a second preset threshold, switch to playing the embedded data audio track so that the embedded audio track data and the embedded video data are played synchronously.
[0086] In one embodiment of the present application, when the amount of external audio track data in the buffer reaches a second preset threshold, playback switches from external video data to embedded audio track data, and upon completion of the switch, the external audio track data and embedded video data are played synchronously. The second preset threshold can be set by the user or by the client, and can be flexibly adjusted based on actual needs. For example, when the client's current network speed is high, the second preset threshold is smaller; when the client's current network speed is low, the second preset threshold is larger. The second preset threshold can be the same as or different from the first preset threshold.
[0087] Figure 7 FIG. 4 is a flowchart of a method for switching audio tracks shown in another exemplary embodiment of the present application.
[0088] like Figure 7 As shown, the audio track switching method further includes:
[0089] S510: In the process of buffering the external audio track data, a transport stream slice of the embedded audio track data is obtained according to the embedded audio track data link.
[0090] It should be noted that the embedded audio track data link in the embodiment of the present application is a link corresponding to streaming media. The streaming media is a media that is transmitted in segments in a streaming manner in the network. Therefore, the embedded audio track data link is a link of the HLS protocol. In the process of buffering the external audio track data, the embedded audio track data on the server is searched according to the embedded audio track data link. The server stores a series of embedded audio track fragment resources, that is, transport stream (TS) slices. The client downloads the TS slices of the embedded audio track data from the server in sequence. For example, when the streaming media is played to 01:01:00, the second audio track data switching instruction is received. The client downloads TS slice 1 and TS slice 2 according to the embedded audio track data link in the order corresponding to the received second audio track data switching instruction. The TS slice 1 is 01:00:01-01:02:00, and the TS slice 2 is 01:02:01-01:04:00.
[0091] S520: Determine a target transport stream slice according to the transport stream slice of the embedded audio track data and the buffered external audio track data.
[0092] In one embodiment of the present application, when the client obtains the TS slice of the embedded audio track data, it determines the TS slice that is compatible with the buffered external audio track data from the obtained TS slice, and determines the target TS slice based on the determined TS slice and the buffered external audio track data.
[0093] S530: When it is determined that the target transport stream slice is obtained, stop buffering the external audio track data.
[0094] It can be understood that when it is determined that the target TS slice is obtained, it means that the embedded audio track data is ready to play, and the external audio track data can be played until the amount of buffered external audio track data reaches the second preset threshold, at which time the buffering of the external audio track data is stopped.
[0095] Figure 8 yes Figure 7 The flowchart of step S520 in the embodiment shown is in an exemplary embodiment. Figure 7 As shown, the process of determining the target TS slice includes:
[0096] S521 : Determine, from the transport stream slices of the embedded audio track data, the transport stream slice where the amount of buffered external audio track data reaches a second preset threshold, and use the determined transport stream slice as the slice to be switched.
[0097] In one embodiment of the present application, the playback time in the external audio track data when the amount of buffered external audio track data reaches a second preset threshold is recorded, and the TS slice where the recorded playback time is located is determined from the transport stream slice of the embedded audio track data. For example, the moment when the amount of buffered external audio track data reaches the second preset threshold is 01:01:10, TS slice 1 is 01:00:01-01:02:00, and TS slice 2 is 01:02:01-01:04:00. Then, the TS slice where the amount of buffered external audio track data reaches the second preset threshold is TS slice 1, and TS slice 1 is used as the slice to be switched.
[0098] S522: Delete the data in the slice to be switched that overlaps with the buffered external audio track data, and obtain the target transport stream slice, so as to switch and play the embedded audio track data starting from the target transport stream slice.
[0099] After obtaining the slice to be switched, delete the part of the data in the slice to be switched that overlaps with the buffered external audio track data, for example, delete the audio track data from 01:00:01 to 01:01:10 in TS slice 1, and obtain the target TS slice. Then, when the embedded audio track data is played to 01:01:10, play the audio track data in the target TS slice from the next moment, that is, start playing the embedded audio track data from 01:01:11.
[0100] As an example, there is a corresponding embedded audio track data frame for each playback time point of the embedded audio track data, so the embedded audio track data frame corresponding to the start time of the target TS slice can also be determined. When the embedded audio track data is played to 01:01:10, the embedded audio track data frame is played at the next moment.
[0101] For ease of understanding, an embodiment of the present application describes a method for switching audio tracks using a specific application scenario, specifically describing a process of switching an embedded audio track to an external audio track. Figure 9 As shown, the multimedia player includes an application interface, a playback control module, a playback analysis module and an external audio track module.
[0102] S901: When the user wants to play streaming media, the user notifies the playback control module through the application interface to open the HLS playback link list (master playlist) of the streaming media.
[0103] S902: The playback control module parses the HLS playback link list through the playback parsing module to obtain independent embedded video data links and embedded audio track data links.
[0104] Figure 10 A schematic diagram of an HLS playback link list is shown, Figure 10 As shown, the HLS playback link list includes the embedded video data link stream_640x360.m3u8 and the embedded audio track data link stream_audio_chinese.m3u8; the playback parsing module also obtains the embedded video data and the embedded audio track data according to the embedded video data link and the embedded audio track data.
[0105] S903: The user notifies the playback control module through the application interface to add a plug-in audio track link (pure audio playlist).
[0106] It is understandable that adding the external audio track link at this time does not open the external audio track link. The client may request the external audio track link from the server, save the external audio track link, and add the external audio track link to display on the application interface.
[0107] S904: Synchronously play the embedded video data corresponding to the embedded video data link and the embedded audio track data corresponding to the embedded audio track data link.
[0108] S905: The user selects the audio track to be switched through the application interface and notifies the playback control module.
[0109] like Figure 11As shown, a track switching interface 1102 is displayed on the application interface 1101. The track switching interface corresponds to a track switching interface 1103 generated based on the embedded track data link and the external track data link. The embedded track data identifier 1102a and the external track data identifier 1102b are displayed in the track switching interface 1102. The user can click to select the corresponding track data identifier to determine the track to be switched. Then, the application interface generates a track data switching instruction based on the user's click operation, and the track data switching instruction carries the audio plug-in identifier.
[0110] S906: The playback control module determines the plug-in audio track to be switched according to the plug-in identifier.
[0111] S907: The playback control module buffers the embedded audio track data and starts switching after the amount of buffered embedded audio track data reaches a first preset threshold.
[0112] S908. During the buffering process, the playback control module notifies the external audio track module to open the external audio track link corresponding to the plug-in to download and parse the external audio track data.
[0113] S909. The external audio track module analyzes the external audio track data through the playback analysis module and searches for the buffering completion time.
[0114] S910: The playback control module notifies the playback analysis module to stop downloading and analyzing the embedded independent audio track data.
[0115] S911. The playback control module switches from the embedded audio track data to the external audio track data and notifies the application interface.
[0116] The above step S908 is performed during the embedded audio track data buffering process, and steps S909-S911 are all performed synchronously with the completion of the embedded audio track data buffering. The application interface displays the text "Switching Completed" to inform the user that the audio track switching is completed.
[0117] For ease of understanding, another embodiment of the present application describes the audio track switching method with a specific application scenario, specifically describing the process of switching from an external audio track to an embedded audio track. Figure 12 As shown, the multimedia player includes an application interface, a playback control module, a playback analysis module and an external audio track module.
[0118] S1201: When the user wants to play streaming media, the user notifies the playback control module through the application interface to open the HLS playback link list (master playlist) of the streaming media.
[0119] S1202: The playback control module parses the HLS playback link list through the playback parsing module to obtain independent embedded video data links and embedded audio track data links.
[0120] S1203: The user notifies the playback control module through the application interface to add a plug-in audio track data link (pure audio playlist).
[0121] S1204: Synchronously play the embedded video data corresponding to the embedded video data link and the external audio track data corresponding to the external audio track data link.
[0122] In this example, after adding the external audio track link, the playback control module downloads and parses the external audio track data, and then can synchronously play the embedded video data and the external audio track data.
[0123] S1205: The user selects the audio track to be switched through the application interface and notifies the playback control module.
[0124] S1206: The playback control module determines the embedded audio track to be switched.
[0125] S1207: The playback control module buffers the external audio track data and starts switching after the amount of buffered external audio track data reaches a second preset threshold.
[0126] The logic of steps S1201 to S1207 is the same as that of the above steps S901 to S907, and will not be repeated here.
[0127] S1208. During the buffering process, the playback control module notifies the external audio track module to close the external audio track link.
[0128] S1209: The playback control module notifies the playback analysis module to download and analyze the embedded audio track data.
[0129] S1210: The playback analysis module downloads and analyzes the embedded independent audio track data, and searches for the current slice where the buffering completion time is located.
[0130] S1211. The playback analysis module discards part of the data in the current slice of the embedded independent audio track that overlaps with the external independent audio track.
[0131] S1212: The playback control module starts switching from the buffering completion time to switch from the external audio track data to the embedded audio track data, and notifies the application interface.
[0132] The audio track switching method provided in this embodiment can avoid the need for each video link of different resolutions to carry the same audio track in the case of multiple resolutions, thereby causing storage redundancy. Therefore, based on the independent embedded video link and embedded audio track link, the technical solution provided in this embodiment supports external audio track data linking. The user can be unaware of which are external audio tracks and which are embedded audio tracks. When adding new language audio tracks at a later stage, there is no need to modify the content of the original playback link, thereby achieving the advantage of easy expansion.
[0133] It is worth noting that, through the description of the above implementation methods, those skilled in the art will easily think of other implementation methods of the present application after considering the specification and practicing the implementation methods disclosed herein. For example, switching embedded subtitles and external subtitles. Specifically, according to the embedded video data link and the embedded subtitle data link corresponding to the streaming media, the embedded video data and the embedded subtitle data corresponding to the streaming media are obtained, the embedded video data and the embedded subtitle data are played synchronously, and the embedded subtitle data are buffered according to the received first subtitle data switching instruction. When the amount of buffered embedded subtitle data reaches a first preset threshold, the external subtitle data corresponding to the embedded video data is switched to be played, so that the external subtitle data and the embedded video data are played synchronously. For the specific process logic, please refer to the above-mentioned method for switching audio tracks, which will not be repeated here.
[0134] For another example, while switching between the embedded audio track and the external audio track, the embedded subtitles and the external subtitles are also switched. Specifically, according to the embedded video data link, the embedded audio track data link, and the embedded subtitle data link corresponding to the streaming media, the embedded video data, the embedded audio track data, and the embedded subtitle data corresponding to the streaming media are obtained, and the embedded video data, the embedded audio track data, and the embedded subtitle data are played synchronously. According to the received first data switching instruction, the embedded audio track data and the embedded subtitle data are buffered. When the amount of the buffered embedded audio track data and the embedded subtitle data reaches a first preset threshold, the external subtitle data and the external audio track data corresponding to the embedded video data are switched to be played, so that the external subtitle data, the external audio track data, and the embedded video data are played synchronously. For the specific process logic, please refer to the above-mentioned method for switching audio tracks, which will not be described in detail here.
[0135] Another example is switching between external video and embedded video. Specifically, according to the embedded video data link and embedded audio track data link corresponding to the streaming media, the embedded video data and embedded subtitle data corresponding to the streaming media are obtained, and the embedded video data and embedded subtitle data are played synchronously. According to the received first video data switching instruction, the embedded video data is buffered. When the amount of buffered embedded video data reaches a first preset threshold, the external video data corresponding to the embedded audio track data is switched to play, so that the external video data and the embedded audio track data are played synchronously. For the specific process logic, please refer to the above-mentioned method for switching audio tracks, which will not be described in detail here.
[0136] The present invention introduces an apparatus embodiment that can be used to execute the data processing method in the above-mentioned embodiment of the present invention. For details not disclosed in the apparatus embodiment of the present invention, please refer to the above-mentioned embodiment of the data processing method of the present invention.
[0137] Figure 13 A block diagram of a track switching device according to an embodiment of the present application is shown, wherein the track switching device includes an acquisition module 1310, a playback module 1320, a buffer module 1330, and a switching module 1340;
[0138] The acquisition module 1310 acquires the embedded video data and embedded audio track data corresponding to the streaming media according to the embedded video data link and embedded audio track data link corresponding to the streaming media;
[0139] Playback module 1320, synchronously plays embedded video data and embedded audio track data;
[0140] The buffer module 1330 buffers the embedded audio track data according to the received first audio track data switching instruction;
[0141] The switching module 1340 switches to playing the external audio track data corresponding to the embedded video data when the amount of buffered embedded audio track data reaches a first preset threshold, so that the external audio track data and the embedded video data are played synchronously.
[0142] In one embodiment of the present application, based on the aforementioned scheme, the audio track switching device also includes a determination module, which is used to obtain external audio track data based on the external audio track data link corresponding to the embedded video data during the buffering of the embedded audio track data; and determine from the external audio track data a target playback time point corresponding to when the amount of buffered embedded audio track data reaches a first preset threshold.
[0143] In one embodiment of the present application, based on the aforementioned scheme, the switching module 1340 is specifically used to stop buffering the embedded audio track data when the target playback time point is determined; determine the target audio track data frame corresponding to the target playback time point from the external audio track data, and start playing the external audio track data from the next frame of the target audio track data frame.
[0144] In one embodiment of the present application, based on the aforementioned scheme, the audio track switching device also includes a generation module, which is used to generate an audio track switching interface based on the embedded audio track data link and the external audio track data corresponding to the external audio track data. The audio track switching interface is used to receive a first audio track data switching instruction carrying an external audio track identifier, and the external audio track identifier corresponds to the external audio track data link.
[0145] In one embodiment of the present application, based on the aforementioned scheme, the buffer module 1330 is also used to buffer the external audio track data according to the received second audio track data switching instruction; the switching module is also used to switch to playing the embedded data audio track when the amount of buffered external audio track data reaches a second preset threshold, so that the embedded audio track data and the embedded video data are played synchronously.
[0146] In one embodiment of the present application, based on the aforementioned scheme, the determination module is also used to obtain a transport stream slice of the embedded audio track data according to the embedded audio track data link during the buffering of the external audio track data; determine the target transport stream slice based on the transport stream slice of the embedded audio track data and the buffered external audio track data; and stop buffering the external audio track data when it is determined that the target transport stream slice is obtained.
[0147] In one embodiment of the present application, based on the aforementioned scheme, in one embodiment of the present application, the determination module is specifically used to determine from the transport stream slice of the embedded audio track data the transport stream slice where the amount of buffered external audio track data reaches a second preset threshold, and use the determined transport stream slice as the slice to be switched; delete the data in the slice to be switched that overlaps with the buffered external audio track data track, and obtain the target transport stream slice, so as to switch to playing the embedded audio track data starting from the target transport stream slice.
[0148] The audio track switching device provided in this embodiment can support newly added external audio tracks and / or subtitles without modifying the original playback link of the streaming media. It only switches the independent embedded audio tracks / embedded subtitles to play the external audio tracks / subtitles, reducing the complexity of switching and achieving the advantage of easy scalability.
[0149] It should be noted that the apparatus provided in the above embodiment and the method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.
[0150] An embodiment of the present application also provides an electronic device, comprising one or more processors and a storage device, wherein the storage device is used to store one or more programs, which, when one or more programs are executed by one or more processors, enable the electronic device to implement the audio track switching method as described above.
[0151] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown.
[0152] It should be noted that Figure 14 The computer system 1400 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present application.
[0153] like Figure 14 As shown, computer system 1400 includes a central processing unit (CPU) 1401, which can perform various appropriate actions and processes according to programs stored in read-only memory (ROM) 1402 or programs loaded from storage unit 1408 into random access memory (RAM) 1403, such as executing the methods described in the above embodiments. Various programs and data required for system operation are also stored in RAM 1403. CPU 1401, ROM 1402, and RAM 1403 are connected to each other via bus 1404. Input / output (I / O) interface 1405 is also connected to bus 1404.
[0154] The following components are connected to the I / O interface 1405: an input section 1406 including a keyboard, a mouse, and the like; an output section 1407 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 1408 including a hard disk; and a communication section 1409 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to the I / O interface 1405 as needed. Removable media 1411, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1410 as needed, so that computer programs read from the removable media can be installed in the storage section 1408 as needed.
[0155] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1409, and / or installed from a removable medium 1411. When the computer program is executed by the central processing unit (CPU) 1401, the various functions defined in the system of the present application are executed.
[0156] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a 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. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0157] 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 application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from 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 or flowchart, and the combination of boxes in the block diagram 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.
[0158] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0159] Another aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned method. The computer-readable storage medium may be included in the electronic device described in the above embodiments, or may exist independently without being incorporated into the electronic device.
[0160] Another aspect of the present application further provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above-mentioned embodiments.
[0161] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0162] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
[0163] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.
[0164] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. Ordinary technicians in this field can easily make corresponding changes or modifications based on the main ideas and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A method for switching audio tracks, characterized in that: include: Open the HLS playback link list of the streaming media through the application interface, and obtain the independent embedded video data and independent embedded audio track data corresponding to the streaming media according to the independent embedded video data link and independent embedded audio track data link corresponding to the streaming media included in the HLS playback link list; Adding an independent external audio track data link to be displayed on the application interface, wherein the external audio track data link is a link outside the HLS playback link list; Synchronously playing the embedded video data and the embedded audio track data; buffering the embedded audio track data according to a first audio track data switching instruction received through the application interface; In the process of buffering the embedded audio track data, the external audio track data is obtained according to the independent external audio track data corresponding to the embedded video data; When the amount of buffered embedded audio track data reaches a first preset threshold, a target playback time point corresponding to when the amount of buffered embedded audio track data reaches the first preset threshold is determined from the external audio track data, and the external audio track data corresponding to the embedded video data is switched for playback according to the target playback time point, so that the external audio track data and the embedded video data are played synchronously.
2. The method according to claim 1, characterized in that When the amount of the buffered embedded audio track data reaches a first preset threshold, switching to play the external audio track data corresponding to the embedded video data includes: When the target playback time point is determined to be obtained, stopping buffering of the embedded audio track data; A target track data frame corresponding to the target playback time point is determined from the external track data, so as to start playing the external track data from the next frame of the target track data frame.
3. The method according to claim 1, characterized in that Before buffering the embedded audio track data according to the first audio track data switching instruction received through the application interface, the method further includes: A track switching interface is generated according to the embedded track data link and the external track data link corresponding to the external track data. The track switching interface is used to receive the first track data switching instruction carrying the external track identifier, and the external track identifier corresponds to the external track data link.
4. The method according to any one of claims 1 to 3, characterized in that After switching to play the external audio track data corresponding to the embedded video data so that the external audio track data and the embedded video data are played synchronously, the method further includes: buffering the external audio track data according to the received second audio track data switching instruction; When the amount of buffered external audio track data reaches a second preset threshold, the embedded audio track data is switched to be played, so that the embedded audio track data and the embedded video data are played synchronously.
5. The method according to claim 4, characterized in that The method further comprises: In the process of buffering the external audio track data, obtaining a transport stream slice of the embedded audio track data according to the embedded audio track data link; Determining a target transport stream slice based on the transport stream slice of the embedded audio track data and the buffered external audio track data; When it is determined that the target transport stream slice is obtained, buffering of the external audio track data is stopped.
6. The method according to claim 5, characterized in that The determining of the target transport stream slice according to the transport stream slice of the embedded audio track data and the buffered external audio track data includes: Determining, from the transport stream slices of the embedded audio track data, the transport stream slice where the amount of buffered external audio track data reaches the second preset threshold, and using the determined transport stream slice as the slice to be switched; Delete the data overlapping with the buffered external audio track data in the slice to be switched, and obtain the target transport stream slice, so as to switch and play the embedded audio track data starting from the target transport stream slice.
7. A track switching device, characterized in that: include: An acquisition module is configured to open the HLS playback link list of the streaming media through the application interface, and acquire the independent embedded video data and independent embedded audio track data corresponding to the streaming media included in the HLS playback link list; and add and display the independent external audio track data link on the application interface, where the external audio track data link is a link outside the HLS playback link list. A playback module, configured to synchronously play the embedded video data and the embedded audio track data; a buffering module, configured to buffer the embedded audio track data according to a first audio track data switching instruction received through the application interface; A determination module, configured to obtain the external audio track data according to the external audio track data link corresponding to the embedded video data during the process of buffering the embedded audio track data; a switching module configured to switch to playing the external audio track data corresponding to the embedded video data according to a target playback time point when the amount of buffered embedded audio track data reaches a first preset threshold, so that the external audio track data and the embedded video data are played synchronously; The determination module is further configured to determine, from the external audio track data, the target playback time point corresponding to when the amount of buffered embedded audio track data reaches a first preset threshold.
8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Definition switching method and device, computer equipment and readable storage medium
CN111510770A
Audio track switching method and device
CN112866794A
Video playing method and device and computer readable medium
CN112887786A