An audio playing method, device, electronic device and storage medium

By creating audio context components in the live broadcast service and processing the audio data to be played independently from the preset audio playback interface, the problem of blocking live streams on the h5 page audio playback is solved, achieving rich presentation forms and improved user experience.

CN115633215BActive Publication Date: 2025-07-08BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211181989.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-27
Publication Date
2025-07-08
Estimated Expiration
2042-09-27

AI Technical Summary

Technical Problem

In the live broadcast business scenario, the audio playback of the h5 page will block the live broadcast stream, resulting in a single display form and poor effect.

Method used

通过在客户端创建音频上下文组件,将待播放音频数据转换为缓冲数据,并独立于预设音频播放接口播放直播流音频数据,确保两者互不干扰。

Benefits of technology

It enriches the display form of h5 pages, improves user experience and fun, and reduces the interference of audio playback on live streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115633215B_ABST
    Figure CN115633215B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an audio playing method, device, electronic device and storage medium, which are applied to a client and include: obtaining audio data to be played and live stream audio data of a preset page; creating an audio context component when the client meets the compatibility conditions of an audio context interface; calling the audio context component to convert the audio data to be played into buffer data and playing the buffer data to achieve the playing effect of the audio data to be played; calling a preset audio playing interface to play the live stream audio data, and the preset audio playing interface is independent of the audio context component. In this way, the audio playing processes of the preset page and the live stream in the client do not interfere with each other, which can reduce the situation where the audio playing of the preset page blocks the live stream. Therefore, in the scenario of live broadcast services, audio elements can also be set in the preset page, thus enriching the display form of the preset page, enhancing the interest and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of audio processing, and in particular, to an audio playback method, apparatus, electronic device, and storage medium. Background Art

[0002] In the scenario of live broadcast services, an h5 (HyperText Markup Language 5) page can be presented to users. The h5 page includes elements such as special effects, games, and vibrations, which is conducive to enhancing the interest of the user's gameplay and meeting the user's visual impact experience.

[0003] In the prior art, the presentation form of most h5 pages is a semi-screen web view in the live broadcast room. The h5 page usually uses an audio component to play audio data. In addition to playing the audio data of the h5 page, the audio component also needs to play the audio data in the live stream. Thus, during the live broadcast, the audio playback of the h5 page will block the live stream, seriously affecting the live broadcast function.

[0004] Therefore, currently in the scenario of live broadcast services, the h5 page usually does not include audio elements, the presentation form is relatively single, and the display effect is poor. Summary of the Invention

[0005] The present disclosure provides an audio playback method, apparatus, electronic device, and storage medium to at least solve the problem that in the scenario of live broadcast services in the related art, the h5 page usually does not include audio elements, the presentation form is relatively single, and the display effect is poor. The technical solutions of the present disclosure are as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, an audio playback system method is provided, which is applied to a client and includes:

[0007] Obtain the audio data to be played of a preset page and the audio data of the live stream;

[0008] Create an audio context component when the client meets the compatibility condition of the audio context interface;

[0009] Call the audio context component, convert the audio data to be played into buffer data, and play the buffer data to achieve the playback effect of the audio data to be played;

[0010] Call a preset audio playback interface to play the audio data of the live stream, and the preset audio playback interface is independent of the audio context component.

[0011] Optionally, the calling the audio context component, converting the audio data to be played into buffer data, and playing the buffer data includes:

[0012] Invoke the audio context component to create an audio conversion module and an audio playback module;

[0013] Use the audio conversion module to convert the audio data to be played into buffer data;

[0014] Use the audio playback module to connect the buffer data to the outlet of the audio context component to play the buffer data.

[0015] Optionally, the method further includes:

[0016] In response to the unloading instruction of the preset page, stop running the audio conversion node module and the audio playback node module, and delete the buffer data to close the audio context component.

[0017] Optionally, the method further includes:

[0018] In the case where the client does not meet the compatibility conditions of the audio context interface, if the client is in the live room state, after obtaining the audio data to be played, pause playing the audio data to be played.

[0019] Optionally, the method further includes:

[0020] If the client is not in the live state, after obtaining the audio data to be played, call the preset audio playback interface to play the audio data to be played.

[0021] Optionally, the method further includes:

[0022] In response to the unloading instruction of the preset page, stop playing the audio data to be played and close the preset audio playback interface.

[0023] Optionally, the step of invoking the audio context component to convert the audio data to be played into buffer data and play the buffer data includes:

[0024] In response to the first instruction to switch the preset page to the foreground, invoke the audio context component to convert the audio data to be played into buffer data and play the buffer data;

[0025] In response to the second instruction to switch the preset page to the background, pause playing the buffer data.

[0026] Optionally, the step of invoking the audio context component to convert the audio data to be played into buffer data and play the buffer data includes:

[0027] Invoke the audio context component, convert the audio data to be played into buffer data, and play the buffer data according to a preset offset.

[0028] Optionally, the method further includes:

[0029] After detecting a preset interaction operation, set an interaction variable to a preset value;

[0030] When the interaction variable is the preset value, perform the step of creating an audio context component when the client meets the compatibility condition of the audio context interface.

[0031] According to a second aspect of the embodiments of the present disclosure, there is provided an audio playback device, which is applied to a client and includes:

[0032] An acquisition unit configured to acquire audio data to be played and live stream audio data of a preset page;

[0033] A creation unit configured to create an audio context component when the client meets the compatibility condition of the audio context interface;

[0034] A first playback unit configured to invoke the audio context component, convert the audio data to be played into buffer data, and play the buffer data to achieve the playback effect of the audio data to be played;

[0035] A second playback unit configured to invoke a preset audio playback interface to play the live stream audio data, and the preset audio playback interface is independent of the audio context component.

[0036] Optionally, the first playback unit is specifically configured to perform:

[0037] Invoke the audio context component to create an audio conversion module and an audio playback module;

[0038] Use the audio conversion module to convert the audio data to be played into buffer data;

[0039] Use the audio playback module to connect the buffer data to the outlet of the audio context component to achieve playing the buffer data.

[0040] Optionally, the device further includes:

[0041] A first closing unit configured to, in response to an unloading instruction of the preset page, stop running the audio conversion module and the audio playback module, and delete the buffer data to close the audio context component.

[0042] Optionally, the device further includes:

[0043] A third playback unit, configured to execute that when the client does not meet the compatibility condition of the audio context interface, if the client is in a live broadcast state, after obtaining the audio data to be played, pause playing the audio data to be played.

[0044] Optionally, the third playback unit is further configured to execute:

[0045] If the client is not in a live broadcast state, after obtaining the audio data to be played, call the preset audio playback interface to play the audio data to be played.

[0046] Optionally, the device further includes:

[0047] A second closing unit, configured to execute in response to an unloading instruction of the preset page, stop playing the audio data to be played, and close the preset audio playback interface.

[0048] Optionally, the first playback unit is configured to execute:

[0049] In response to a first instruction to switch the preset page to the foreground, call the audio context component, convert the audio data to be played into buffer data, and play the buffer data;

[0050] In response to a second instruction to switch the preset page to the background, pause playing the buffer data.

[0051] Optionally, the first playback unit is configured to execute:

[0052] Call the audio context component, convert the audio data to be played into buffer data, and play the buffer data according to a preset offset.

[0053] Optionally, the device further includes:

[0054] An interaction unit, configured to execute that after detecting a preset interaction operation, set an interaction variable to a preset value; in the case where the interaction variable is the preset value, execute the step of creating an audio context component when the client meets the compatibility condition of the audio context interface.

[0055] According to a third aspect of the embodiments of the present disclosure, an audio playback electronic device is provided, including:

[0056] A processor;

[0057] A memory for storing executable instructions of the processor;

[0058] Wherein, the processor is configured to execute the instructions to implement the audio playing method described in the first item above.

[0059] According to a fourth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor of an audio playing electronic device, the audio playing electronic device can execute the audio playing method described in the first item above.

[0060] According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the audio playing method described in the first item above is implemented.

[0061] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:

[0062] Obtain the audio data to be played and the live stream audio data of a preset page; when the client meets the compatibility conditions of the audio context interface, create an audio context component; call the audio context component to convert the audio data to be played into buffer data and play the buffer data to achieve the playing effect of the audio data to be played; call a preset audio playing interface to play the live stream audio data, and the preset audio playing interface is independent of the audio context component.

[0063] In this way, the client plays the audio data to be played on the preset page through the audio context component, while the live stream audio data is played through the preset audio playing interface. The audio context component and the preset audio playing interface are independent of each other, and the audio playing processes of the preset page and the live stream do not interfere with each other, which can reduce the situation where the audio playing on the preset page blocks the live stream. Therefore, in the scenario of live broadcast services, audio elements can also be set on the preset page, thus enriching the display form of the preset page, enhancing the interest, and improving the user experience.

[0064] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure, and do not constitute an improper limitation to the present disclosure.

[0066] Figure 1 is a flowchart of an audio playing method shown according to an exemplary embodiment.

[0067] Figure 2 is a schematic diagram of the playing logic of audio data to be played shown according to an exemplary embodiment.

[0068] Figure 3 It is a design schematic diagram of an audio context component shown according to an exemplary embodiment.

[0069] Figure 4 It is a call schematic diagram of a component shown according to an exemplary embodiment.

[0070] Figure 5 It is a block diagram of an audio playback device shown according to an exemplary embodiment.

[0071] Figure 6 It is a block diagram of an electronic device for audio playback shown according to an exemplary embodiment.

[0072] Figure 7 It is a block diagram of a device for audio playback shown according to an exemplary embodiment. Detailed implementation manners

[0073] In order to enable those of ordinary skill in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0074] It should be noted that the terms "first", "second", etc. in the description and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data used can be interchanged under appropriate circumstances so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0075] Figure 1 It is a flowchart of an audio playback method shown according to an exemplary embodiment, applied to a client, such as Figure 1 shown, and the audio playback method includes the following steps.

[0076] In step S11, obtain the audio data to be played and the live stream audio data of the preset page.

[0077] In some scenarios, an h5 page can be displayed to users simultaneously in the context of a live broadcast service. The h5 page includes elements such as animations, games, vibrations, etc., thereby enhancing the fun of the user's gameplay and meeting the user's visual impact experience. Among them, the presentation form of most h5 pages is a semi-screen web view within the live broadcast room. In this case, the client needs to play the audio data of the h5 page and the audio data in the live stream simultaneously. The audio data to be played obtained in this step is the audio data in the h5 page, and the live stream audio data is the audio data in the live stream. The audio data to be played and the live stream audio data can specifically be any form of audio data, and the present disclosure does not make any limitations in this regard.

[0078] The client can obtain the audio data to be played in different ways. For example, it can obtain the audio data to be played from the server through an XMLHttpRequest request on a preset page. Alternatively, the server can also automatically send the audio data to be played after the client accesses the preset page, and no specific limitations are made.

[0079] In step S12, when the client meets the compatibility conditions of the audio context interface, an audio context component is created.

[0080] In this step, it is necessary to determine the compatibility between the client and the audio context interface. It can be understood that due to different client system settings and application scenario limitations of the audio context interface, there may be an incompatible situation between the two. If the client does not meet the compatibility conditions of the audio context interface, then the client will not be able to call the audio context interface. Among them, the audio context interface can be represented as the AudioContext API. The AudioContext API is a component in the Web Audio API and represents an audio processing graph composed of audio modules. The audio context component controls the creation and audio processing and decoding of the functional modules it contains. Before using other interfaces of the Web Audio API, it is necessary to create an audio context component, and subsequent operations are all carried out in the audio context environment.

[0081] Among them, the step of creating the audio context component can be executed after the client obtains the audio data to be played. That is to say, after obtaining the preset page and determining that the preset page has corresponding audio data to be played, the audio context component is created. Conversely, if the preset page has not been obtained currently, or the preset page does not include the audio data to be played, then there is no need to create the audio context component, thereby saving system resources; or, the audio context component can also be created in advance after the client enters the live broadcast state. In this way, after obtaining the audio data to be played on the preset page, the created audio context component can be directly called, thereby improving the reaction speed of the system.

[0082] In one implementation, when the client does not meet the compatibility conditions of the audio context interface, if the client is in the live broadcast state, after obtaining the audio data to be played, the playback of the audio data to be played is paused. Additionally, if the client is not in the live broadcast state, after obtaining the audio data to be played, a preset audio playback interface is called to create an audio playback component; then, the audio data to be played is played using the audio playback component.

[0083] That is to say, for the situation where the client does not meet the compatibility conditions of the audio context interface, it is possible to first detect whether the client is in the live broadcast state. If the client is in the live broadcast state, the preset audio playback interface (Audio) is playing the live stream audio data. Then, the preset audio playback interface can maintain its original state and continue to play the live stream audio data without playing the audio data to be played. If the client is not in the live broadcast state, at this time the preset audio playback interface is in an idle state, and the preset audio playback component can be called to load the audio data to be played on the preset page to implement audio playback.

[0084] In this way, on the one hand, when the preset audio playback interface plays the live stream audio data, there is no need to play the audio data to be played simultaneously, thus reducing the situation of audio jams. On the other hand, when the preset audio playback interface does not play the live stream audio data, its playback of the audio data to be played can be called, thereby improving the applicable scenarios of audio playback on the preset page.

[0085] Based on the above implementation, the client can also respond to the unloading instruction of the preset page, stop playing the audio data to be played, and close the preset audio playback interface. In this way, when the preset page is unloaded, the audio data to be played will also be destroyed, thus avoiding memory leaks.

[0086] In one implementation, the client can set the interaction variable to a preset value after detecting a preset interaction operation; in the case where the interaction variable is the preset value, the step of creating an audio context component when the client meets the compatibility conditions of the audio context interface is executed.

[0087] That is to say, the audio playback scheme in the present disclosure will only be executed on the premise of detecting a preset interaction operation. Among them, the preset interaction operation can be any human-computer interaction operation, which can improve the security of audio playback and reduce the situation of resource leakage.

[0088] Among them, different settings can be made for different clients. For example, for clients based on the IOS system, it can be required that there must be at least one human-computer interaction operation to execute the audio playback scheme in the present disclosure, while for clients based on the Android system, there can be no restrictions.

[0089] For example, before determining the compatibility between the client and the audio context interface, the hasUserAction variable of the system can be obtained. Generally, the default value of the hasUserAction variable in the Android system is true, and the value of the hasUserAction variable in the IOS system is false. Then, listen for the touchstart event, and use the touchstart event as a preset interaction operation. If the hasUserAction variable is detected, set the value of the hasUserAction variable to true. Furthermore, the audio playback solution in the present disclosure can be executed.

[0090] In step S13, call the audio context component, convert the audio data to be played into buffered data, and play the buffered data to achieve the playback effect of the audio data to be played.

[0091] In this step, the audio context component can be called to play the audio data to be played. Among them, the audio context component is the AudioContext instance corresponding to the created audio context interface, and the buffered data can be data in buffer format.

[0092] Among them, calling the audio context component, converting the audio data to be played into buffered data, and playing the buffered data includes: calling the audio context component to create an audio conversion module and an audio playback module; using the audio conversion module to convert the audio data to be played into buffered data; using the audio playback module to connect the buffered data to the outlet of the audio context component to achieve playing the buffered data.

[0093] For example, first, an audio conversion module and an audio playback module can be created through the createBufferSource function of the AudioContext instance; then, buffered data in buffer format can be specified as the container of the audio conversion module, and the audio data to be played can be converted into buffered data in buffer format through the decodeAudioData function of the AudioContext instance; furthermore, through the pipeline capability of the AudioContext instance, that is, by calling the connect function, the buffered data is connected to the outlet of the AudioContext instance, and the audio effect is achieved through the start function.

[0094] Based on the above embodiments, the client can respond to the unloading instruction of the preset page, stop running the audio conversion module and the audio playback module, and delete the buffered data to close the audio context component. In this way, when the preset page is unloaded, the audio data to be played will also be destroyed, thus avoiding memory leakage.

[0095] In one implementation, an audio context component is called to convert the audio data to be played into buffered data and play the buffered data, including: in response to a first instruction to switch a preset page to the foreground, calling the audio context component to convert the audio data to be played into buffered data and play the buffered data; in response to a second instruction to switch the preset page to the background, pausing the playback of the buffered data.

[0096] That is to say, in the present disclosure, the playback and pause of the audio data to be played can be controlled by the client itself based on different scenarios. When the preset page is switched to the foreground, the client starts playing the audio data to be played; when the preset page is switched to the background, the client stops playing the audio data to be played. In this way, the playback of the audio data is more flexible and reasonable, which is conducive to improving the user experience.

[0097] In another implementation, an audio context component is called to convert the audio data to be played into buffered data and play the buffered data, including: calling the audio context component to convert the audio data to be played into buffered data and playing the buffered data according to a preset offset.

[0098] That is to say, the playback start time of the audio data to be played can be controlled by adjusting the preset offset. In this way, when playing in a loop, the connection between the audio data to be played is smoother, so seamless connection playback can be achieved, further improving the user experience.

[0099] In step S14, a preset audio playback interface is called to play the live stream audio data, and the preset audio playback interface is independent of the audio context component.

[0100] In this step, the preset audio playback interface is the AudioSession interface. The audio context component and the preset audio playback interface are independent of each other, and the audio playback process of the preset page and the live stream does not interfere with each other, and the audio playback performance of the preset page inside and outside the live broadcast room can be made consistent.

[0101] Such as Figure 2As shown in the figure, it is a schematic diagram of the playback logic of the audio data to be played in the present disclosure. First, the compatibility between the client and the audio context interface is detected. When the client supports the audio context interface, an audio context component is created, and the audio data to be played on the preset page is obtained through an XMLHttpRequest request, and the obtained audio data to be played is converted into buffer-format buffered data. Then, an audio playback module is created, and the buffer-format buffered data is specified as the container of the audio playback module, and the buffered data is connected to the outlet of the audio context component by using the pipeline capability, thereby realizing audio playback; when the client does not support the audio context interface, first, it can be detected whether the client is in the live state. If the client is in the live state, the audio data to be played is not played, and the preset page is muted. If the client is not in the live state, a preset audio playback component can be created, and the preset audio playback component is called to load the audio data to be played, thereby realizing audio playback.

[0102] As Figure 3 shown in the figure, it is a schematic design diagram of the audio context component in the present disclosure. By introducing a preset component tool, the caller can call the pipeline tool in the component to implement functions such as obtaining audio resources, setting the playback mode, and implementing a fallback strategy. Among them, the fallback strategy refers to the processing strategy for the audio data to be played on the preset page when the client is incompatible with the audio context interface. For example, it can be that if the client is in the live state, after obtaining the audio data to be played, the playback of the audio data to be played is paused; if the client is not in the live state, after obtaining the audio data to be played, a preset audio playback interface is called to create an audio playback component; then, the audio data to be played is played by using the audio playback component.

[0103] As Figure 4 shown in the figure, it is a schematic diagram of the component call. After introducing the audio context component, the audio context component needs to be registered to obtain an instance of the audio context component. Then, based on the parameter passing between the components, the audio context component is called.

[0104] As can be seen from the above, in the technical solution provided by the embodiments of the present disclosure, the client plays the audio data to be played on the preset page through the audio context component, while the live stream audio data is played through the preset audio playback interface. The audio context component and the preset audio playback interface are independent of each other, and the audio playback processes of the preset page and the live stream do not interfere with each other, which can reduce the situation where the audio playback on the preset page blocks the live stream. Therefore, in the scenario of the live broadcast service, audio elements can also be set on the preset page, thereby enriching the display form of the preset page, enhancing the interest, and improving the user experience.

[0105] Figure 5It is a block diagram of an audio playback device shown according to an exemplary embodiment, which is applied to a client. The device includes:

[0106] An acquisition unit configured to acquire audio data to be played and live stream audio data of a preset page;

[0107] A creation unit configured to create an audio context component when the client meets the compatibility conditions of the audio context interface;

[0108] A first playback unit configured to call the audio context component, convert the audio data to be played into buffer data, and play the buffer data to achieve the playback effect of the audio data to be played;

[0109] A second playback unit configured to call a preset audio playback interface to play the live stream audio data, and the preset audio playback interface is independent of the audio context component.

[0110] In one implementation, the first playback unit is specifically configured to:

[0111] Call the audio context component to create an audio conversion module and an audio playback module;

[0112] Use the audio conversion module to convert the audio data to be played into buffer data;

[0113] Use the audio playback module to connect the buffer data to the outlet of the audio context component to achieve playing the buffer data.

[0114] In one implementation, the device further includes:

[0115] A first closing unit configured to, in response to an unloading instruction of the preset page, stop running the audio conversion module and the audio playback module, and delete the buffer data to close the audio context component.

[0116] In one implementation, the device further includes:

[0117] A third playback unit configured to, when the client does not meet the compatibility conditions of the audio context interface, if the client is in a live state, pause playing the audio data to be played after acquiring the audio data to be played.

[0118] In one implementation, the third playback unit is further configured to:

[0119] If the client is not in the live broadcast state, after obtaining the audio data to be played, call the preset audio playback interface to play the audio data to be played.

[0120] In one implementation, the device further includes:

[0121] A second closing unit, configured to execute in response to an unloading instruction of the preset page, stop playing the audio data to be played, and close the preset audio playback interface.

[0122] In one implementation, the first playback unit is configured to execute:

[0123] In response to a first instruction to switch the preset page to the foreground, call the audio context component, convert the audio data to be played into buffer data, and play the buffer data;

[0124] In response to a second instruction to switch the preset page to the background, pause playing the buffer data.

[0125] In one implementation, the first playback unit is configured to execute:

[0126] Call the audio context component, convert the audio data to be played into buffer data, and play the buffer data according to a preset offset.

[0127] In one implementation, the device further includes:

[0128] An interaction unit, configured to execute after detecting a preset interaction operation, set an interaction variable to a preset value; in the case where the interaction variable is the preset value, execute the step of creating an audio context component when the client meets the compatibility condition of the audio context interface.

[0129] As can be seen from the above, in the technical solution provided by the embodiments of the present disclosure, the client plays the audio data to be played on the preset page through the audio context component, while the live stream audio data is played through the preset audio playback interface. The audio context component and the preset audio playback interface are independent of each other, and the audio playback processes of the preset page and the live stream do not interfere with each other, which can reduce the situation where the audio playback of the preset page blocks the live stream. Therefore, in the scenario of the live broadcast service, audio elements can also be set on the preset page, thus enriching the display form of the preset page, enhancing the fun, and improving the user experience.

[0130] Figure 6 It is a block diagram of an electronic device for audio playback shown according to an exemplary embodiment.

[0131] In an exemplary embodiment, a computer-readable storage medium including instructions, such as a memory including instructions, is also provided. The above instructions can be executed by a processor of an electronic device to complete the above method. Optionally, the computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical audio player device, etc.

[0132] In an exemplary embodiment, a computer program product is also provided. When it runs on a computer, it enables the computer to implement the above method for audio playback.

[0133] As can be seen from the above, in the technical solution provided by the embodiments of the present disclosure, the client plays the to-be-played audio data of the preset page through the audio context component, while the live stream audio data is played through the preset audio playback interface. The audio context component and the preset audio playback interface are independent of each other, and the audio playback processes of the preset page and the live stream do not interfere with each other, which can reduce the situation where the audio playback of the preset page blocks the live stream. Therefore, in the scenario of live broadcast services, audio elements can also be set in the preset page, thus enriching the display form of the preset page, enhancing the interest, and improving the user experience.

[0134] Figure 7 FIG. 10 is a block diagram of a device 800 for audio playback according to an exemplary embodiment.

[0135] For example, the device 800 may be a mobile phone, a computer, a digital broadcast electronic device, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0136] Referring to Figure 7 , the device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.

[0137] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0138] The memory 804 is configured to store various types of data to support the operation of the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, and the like. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0139] The power supply component 807 provides power to various components of the device 800. The power supply component 807 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0140] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0141] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker for outputting audio signals.

[0142] The I / O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a start button, and a lock button.

[0143] The sensor assembly 814 includes one or more sensors for providing a status assessment of various aspects of the device 800. For example, the sensor assembly 814 can detect the on / off state of the device 800, the relative positioning of components, such as the display and keypad of the device 800. The sensor assembly 814 can also detect a change in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and a change in the temperature of the device 800. The sensor assembly 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0144] The communication component 816 is configured to facilitate communication between the device 800 and other devices in a wired or wireless manner. The device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0145] In an exemplary embodiment, the device 800 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the methods described in the first aspect and the second aspect.

[0146] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as the memory 804 including instructions, and the above instructions can be executed by the processor 820 of the device 800 to complete the above methods. Optionally, for example, the storage medium can be a non-transitory computer-readable storage medium. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical audio playback device, etc.

[0147] In an exemplary embodiment, there is also provided a computer program product including instructions, which when running on a computer, causes the computer to execute the audio playback method described in the first of the above embodiments.

[0148] As can be seen from the above, in the technical solution provided by the embodiment of the present disclosure, the client plays the to-be-played audio data of the preset page through the audio context component, while the live stream audio data is played through the preset audio playback interface. The audio context component and the preset audio playback interface are independent of each other, and the audio playback processes of the preset page and the live stream do not interfere with each other, which can reduce the situation where the audio playback of the preset page blocks the live stream. Therefore, in the scenario of the live broadcast service, audio elements can also be set in the preset page, thus enriching the display form of the preset page, enhancing the interest, and improving the user experience.

[0149] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0150] It should be understood that the present disclosure is not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. An audio playback method, characterized in that, Applied to a client, including: Obtain the audio data to be played and the live stream audio data of a preset page; Create an audio context component when the client meets the compatibility conditions of the audio context interface; Call the audio context component, convert the audio data to be played into buffer data, and play the buffer data to achieve the playback effect of the audio data to be played; Call a preset audio playback interface to play the live stream audio data, and the preset audio playback interface is independent of the audio context component.

2. The audio playback method according to claim 1, wherein The step of calling the audio context component, converting the audio data to be played into buffer data, and playing the buffer data includes: Call the audio context component to create an audio conversion module and an audio playback module; Use the audio conversion module to convert the audio data to be played into buffer data; Use the audio playback module to connect the buffer data to the outlet of the audio context component to achieve playing the buffer data.

3. The audio playing method according to claim 2, wherein The method further includes: In response to the unloading instruction of the preset page, stop running the audio conversion module and the audio playback module, and delete the buffer data to close the audio context component.

4. The audio playback method according to claim 1, wherein The method further includes: When the client does not meet the compatibility conditions of the audio context interface, if the client is in a live state, pause playing the audio data to be played after obtaining the audio data to be played.

5. The audio playing method according to claim 4, wherein The method further includes: If the client is not in a live state, call the preset audio playback interface to play the audio data to be played after obtaining the audio data to be played.

6. The audio playing method according to claim 5, wherein The method further includes: In response to the unloading instruction of the preset page, stop playing the audio data to be played and close the preset audio playback interface.

7. The audio playing method according to claim 1, wherein The step of calling the audio context component, converting the audio data to be played into buffer data, and playing the buffer data includes: In response to a first instruction to switch the preset page to the foreground, call the audio context component, convert the audio data to be played into buffer data, and play the buffer data; In response to a second instruction to switch the preset page to the background, pause playing the buffer data.

8. The audio playing method according to claim 1, wherein The step of calling the audio context component, converting the audio data to be played into buffer data, and playing the buffer data includes: Call the audio context component, convert the audio data to be played into buffer data, and play the buffer data according to a preset offset.

9. The audio playing method according to claim 1, characterized in that The method further includes: After detecting a preset interaction operation, set an interaction variable to a preset value; When the interaction variable is the preset value, execute the step of creating an audio context component when the client meets the compatibility conditions of the audio context interface.

10. An audio playback device, characterized in that, Applied to a client, including: An obtaining unit configured to obtain the audio data to be played and the live stream audio data of a preset page; A creating unit configured to create an audio context component when the client meets the compatibility conditions of the audio context interface; The first playback unit is configured to execute calling the audio context component, convert the audio data to be played into buffer data, and play the buffer data to achieve the playback effect of the audio data to be played; The second playback unit is configured to execute calling a preset audio playback interface to play the live stream audio data, and the preset audio playback interface is independent of the audio context component.

11. The audio playback device according to claim 10, wherein The first playback unit is specifically configured to execute: Call the audio context component to create an audio conversion module and an audio playback module; Use the audio conversion module to convert the audio data to be played into buffer data; Use the audio playback module to connect the buffer data to the outlet of the audio context component to achieve playing the buffer data.

12. The audio playback device according to claim 11, wherein, The device further includes: The first shutdown unit is configured to execute in response to an unloading instruction of the preset page, stop running the audio conversion module and the audio playback module, and delete the buffer data to achieve shutting down the audio context component.

13. The audio playback device according to claim 10, wherein The device further includes: The third playback unit is configured to execute in the case that the client does not meet the compatibility condition of the audio context interface, if the client is in a live state, then pause playing the audio data to be played after obtaining the audio data to be played.

14. The audio playback device according to claim 13, wherein The third playback unit is further configured to execute: If the client is not in a live state, then call the preset audio playback interface to play the audio data to be played after obtaining the audio data to be played.

15. The audio playback device according to claim 14, wherein The device further includes: The second shutdown unit is configured to execute in response to an unloading instruction of the preset page, stop playing the audio data to be played, and close the preset audio playback interface.

16. The audio playback device according to claim 10, characterized in that, The first playback unit is configured to execute: In response to a first instruction to switch the preset page to the foreground, call the audio context component, convert the audio data to be played into buffer data, and play the buffer data; In response to a second instruction to switch the preset page to the background, pause playing the buffer data.

17. The audio playback device according to claim 10, wherein The first playback unit is configured to execute: Call the audio context component, convert the audio data to be played into buffer data, and play the buffer data according to a preset offset.

18. The audio playback device according to claim 10, wherein The device further includes: The interaction unit is configured to execute setting an interaction variable to a preset value after monitoring a preset interaction operation; in the case that the interaction variable is the preset value, execute the step of creating an audio context component in the case that the client meets the compatibility condition of the audio context interface.

19. An electronic device, characterized in that, Includes: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the audio playback method according to any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the audio playback electronic device, the audio playback electronic device can execute the audio playback method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Seamless playing method of multimedia file, terminal device and storage medium

    CN108377409A

  • Live broadcasting room sound shielding method and related equipment

    CN114339277A