Audio control method, storage medium, program product and electronic device
By creating multiple focus stacks on electronic devices to manage audio applications on different devices, the problem of mutual influence of audio playback in device interconnection scenarios is solved, and an independent distributed audio experience is achieved.
Patent Information
- Application Number
- CN202211358862.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-01
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-11-01
AI Technical Summary
Existing audio output processing methods cannot achieve a distributed audio experience in device interconnection scenarios, resulting in audio playback of audio applications on different devices affecting each other.
At least two focus stacks are created on the electronic device to store focus information of audio applications that play audio through different electronic devices, thereby separately managing audio applications on different devices and achieving independence of audio playback.
It enables independent playback of audio applications between different electronic devices, avoids conflicts in audio focus, and ensures a distributed audio experience.
Smart Images

Figure CN117992007B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an audio control method, storage medium, program product, and electronic device. Background Art
[0002] The existing audio output processing method is: when device A outputs the audio of application 1, the user starts application 2 on device A to play the audio of application 2, then device A turns off the audio of application 1 or lowers the audio volume to output the audio of application 2.
[0003] In a device interconnection scenario, based on existing audio output processing methods, when device A streams Application 1 on it to device B and plays the audio of Application 1 through device B, if the user launches Application 2 on device A to play the audio of Application 2, the audio of Application 1 on device B will be affected, and the audio of Application 1 on device B will be turned off or the volume will be reduced. Summary of the Invention
[0004] The present application provides an audio control method, storage medium, program product and electronic device, which separately manage focus information through a first focus stack and a second focus stack, and separately manage audio applications that play audio through different electronic devices by separately managing focus information, thereby achieving the independence of audio played through the second electronic device and the audio played through the first electronic device, thereby realizing a distributed audio experience.
[0005] In a first aspect, the present application provides an audio control method, which is applied to a first electronic device, wherein a first audio application is installed on the first electronic device, and the first electronic device includes a first focus stack, wherein the first focus stack is used to store focus information corresponding to the audio application that plays audio through the first electronic device. The audio control method includes: creating a second focus stack, wherein the second focus stack is used to store focus information corresponding to the audio application that plays audio through the second electronic device; in response to a first instruction, placing the first focus information of the first audio application at the top of the second focus stack, and notifying the first audio application to obtain audio focus, so that when the content of the first audio application is transferred to the second electronic device, the audio of the first audio application is played through the second electronic device.
[0006] Compared with the existing audio output processing method that only maintains one focus stack, the audio control method of the present application creates and maintains at least two focus stacks. Taking the first electronic device maintaining the first focus stack and the second focus stack as an example, the first focus stack and the second focus stack are both used to store the focus information of the audio application applying for audio focus. The difference between the first focus stack and the second focus stack is that the audio of the audio application corresponding to the focus information stored in the first focus stack is played through the first electronic device, and the audio of the audio application corresponding to the focus information stored in the second focus stack is played through the second electronic device. The focus information is managed separately through the first focus stack and the second focus stack, and the audio applications that play audio through different electronic devices are managed separately by separately managing the focus information, thereby achieving the independence of the audio played through the second electronic device and the audio played through the first electronic device, so as to realize a distributed audio experience.
[0007] In one possible implementation, the audio control method further includes: obtaining first information, wherein the first information is used to indicate that the audio of the second audio application is played through the second electronic device; in response to obtaining the first information, obtaining second focus information of the second audio application, placing the second focus information on the top of the second focus stack, and notifying the first audio application of the loss of audio focus. Wherein, before responding to obtaining the first information, it also includes: obtaining the first information from the second electronic device through the distributed fusion perception platform service. By adopting this technical solution, it can be achieved that after the first electronic device transfers the first audio application to the second electronic device for playback, the second audio application can be played normally on the second electronic device.
[0008] In one possible implementation, the audio control method further includes: obtaining second information, wherein the second information is used to indicate that the second audio application has lost audio focus; in response to obtaining the second information, placing the first focus information on the top of the second focus stack, and notifying the first audio application to obtain audio focus. Wherein, before responding to obtaining the second information, it also includes: obtaining the second information from the second electronic device through the distributed fusion perception platform service. By adopting this technical solution, it is possible to transfer the first audio application from the first electronic device to the second electronic device for playback, and when the first audio application has not finished playing and the second audio application applies for playback, the second audio application can be played normally on the second electronic device, and when the second audio application loses audio focus (for example, after the application for playback is completed), the first audio application can continue to be played on the second electronic device.
[0009] In one possible implementation, in response to a first instruction, placing the first focus information of the first audio application at the top of the second focus stack includes: obtaining a first operation; in response to the first operation, determining the first focus stack corresponding to the first operation from the first focus stack and the second focus stack, and placing the first focus information of the first audio application at the top of the first focus stack to play the audio of the first audio application through the first electronic device; obtaining a second operation, wherein the second operation is used to instruct the first audio application that is playing audio to be transferred to the second electronic device; in response to the first instruction corresponding to the second operation, determining the second focus stack corresponding to the first instruction from the first focus stack and the second focus stack, and moving the first focus information of the first audio application from the first focus stack to the top of the second focus stack. By adopting this technical solution, the first electronic device can transfer the first audio application that is playing audio to the second electronic device for playback.
[0010] In one possible implementation, before responding to the first instruction, the method further includes: responding to a third operation, transferring the first audio application to the second electronic device; and obtaining the first instruction when detecting that the first audio application transferred to the second electronic device requests to play audio. By adopting this technical solution, the first electronic device can transfer the first audio application that is not playing audio to the second electronic device for playback.
[0011] In one possible implementation, the audio control method further includes: obtaining a second instruction, wherein the second instruction is used to instruct to migrate the first audio application back to the first electronic device; in response to the second instruction, moving the first focus information from the second focus stack to the top of the first focus stack, and notifying the first audio application to obtain audio focus. By adopting this technical solution, the first electronic device can migrate the first audio application that has been migrated to the second electronic device back, and the migrated first audio application can play audio on the first electronic device.
[0012] In one possible implementation, creating the second focus stack includes: obtaining a device identifier of the second electronic device; and creating the second focus stack based on the device identifier. By adopting this technical solution, a corresponding focus stack (in addition to the first focus stack) can be created for the second electronic device connected to the first electronic device.
[0013] In one possible implementation, when N device identifiers are obtained, where N is an integer greater than or equal to 2, creating a second focus stack based on the device identifiers includes: creating N second focus stacks based on the N device identifiers. By adopting this technical solution, when there are two or more second electronic devices interconnected with the first electronic device, corresponding focus stacks (excluding the first focus stack) can be created for each of the two or more second electronic devices.
[0014] In a second aspect, the present application provides an audio control method, which is applied to a first electronic device and a second electronic device, where the first electronic device is communicatively connected to the second electronic device, a first audio application is installed on the first electronic device, and the second electronic device includes a first local focus stack, where the first local focus stack is used to store focus information of the audio application that plays audio through the second electronic device. The method includes: the first electronic device obtains a first instruction; the first electronic device responds to the first instruction, notifies the first audio application to obtain audio focus, and transmits the first focus information of the first audio application to the second electronic device; the second electronic device creates first simulated focus information based on the first focus information, and places the first simulated focus information at the top of the first local focus stack, so that when the content of the first audio application is transferred to the second electronic device, the audio of the first audio application is played through the second electronic device.
[0015] Compared with the existing audio output processing method in which the focus information of the audio application on the electronic device is stored in the focus stack maintained by the electronic device, the present application stores the focus information of the audio application in the local focus stack of the electronic device that plays the audio application. When it is desired to play the audio of the first audio application on the electronic device B through the electronic device A, the focus information of the audio focus applied by the first audio application is stored in the first local focus stack of the electronic device B, and the first local focus stack maintains the focus information corresponding to the first audio application that has been transferred. Correspondingly, when it is desired to play the audio of the second audio application on the electronic device B through the electronic device A, the focus information of the audio focus applied by the second audio application is stored in the second local focus stack of the electronic device A, and the second local focus stack maintains the focus information corresponding to the second audio application that has been transferred. In this way, by separately managing the focus information, the audio applications that play audio through different electronic devices can be managed separately, thereby achieving the independence of the audio played through the second electronic device and the audio played through the first electronic device, so as to achieve a distributed audio experience.
[0016] In one possible implementation, the second electronic device includes a second audio application, and the audio control method further includes: the second electronic device obtains a fourth operation, wherein the fourth operation indicates that the audio of the second audio application is played through the second electronic device; the second electronic device responds to the fourth operation, places the second focus information of the second audio application on the top of the first local focus stack, and notifies the second audio application to obtain audio focus; the first electronic device responds to the second audio application obtaining audio focus, notifying the first audio application to lose audio focus. By adopting this technical solution, it can be achieved that after the first electronic device transfers the first audio application to the second electronic device for playback, the second audio application can be played normally on the second electronic device.
[0017] In one possible implementation, the first electronic device includes a second local focus stack, and the audio control method further includes: the first electronic device, in response to a migration instruction, obtains first simulated focus information from the second electronic device; the first electronic device places the first simulated focus information at the top of the second local focus stack, notifies the first audio application to obtain audio focus, and the first electronic device plays the audio of the first audio application. By adopting this technical solution, the first electronic device can migrate the first audio application that has been migrated to the second electronic device back, and the migrated first audio application plays audio on the first electronic device.
[0018] In a third aspect, the present application provides a computer storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes any one of the audio control methods described above.
[0019] In a fourth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute any one of the audio control methods described above.
[0020] In a fifth aspect, the present application provides an electronic device, which includes a processor and a memory, the memory being used to store instructions, and the processor being used to call the instructions in the memory, so that the electronic device executes any one of the audio control methods in the above-mentioned implementation manners.
[0021] The technical effects obtained in the above-mentioned second, third, fourth and fifth aspects are similar to those obtained by the corresponding technical means in the first aspect, and will not be repeated here.
[0022] The beneficial effects of the technical solution provided by this application include at least:
[0023] By separately managing focus information, audio applications that play audio through different electronic devices can be managed separately, thereby achieving independence between the audio played through the second electronic device and the audio played through the first electronic device, thereby realizing a distributed audio experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of the structure of an audio system provided in an embodiment of the present application.
[0025] Figure 2 This is a software structure block diagram of the electronic device provided in the embodiment of the present application.
[0026] Figure 3 A flowchart of an audio control method provided in Example 1 of the present application.
[0027] Figures 4A to 4G A schematic diagram of an application scenario corresponding to the first embodiment.
[0028] Figure 5 To correspond Figures 4A to 4G Schematic diagram of the operation flow of the first electronic device.
[0029] Figure 6 A flowchart of an audio control method provided in Example 2 of the present application.
[0030] 7A to 7D A schematic diagram of an application scenario corresponding to the second embodiment.
[0031] Figure 8 To correspond 7A to 7D Schematic diagram of the operation flow of the first electronic device.
[0032] Figure 9 A flowchart of an audio control method provided in Example 3 of the present application.
[0033] Figures 10A to 10C A schematic diagram of an application scenario corresponding to Example 3.
[0034] Figure 11 To correspond Figures 10A to 10C Schematic diagram of the operation flow of the first electronic device.
[0035] Figure 12 A flowchart of an audio control method provided in Example 4 of the present application.
[0036] 13A to 13B A schematic diagram of an application scenario corresponding to the fourth embodiment.
[0037] Figure 14 To correspond 13A to 13B Schematic diagram of the operation flow of the first electronic device.
[0038] Figure 15 A flowchart of an audio control method provided in Example 5 of the present application.
[0039] Figure 16 A flowchart of an audio control method provided in Example 6 of the present application.
[0040] Figure 17 A flowchart of an audio control method provided in Example 7 of the present application.
[0041] Figure 18 A flowchart of an audio control method provided in Example 8 of the present application.
[0042] Figure 19 A flowchart of an audio control method provided in Example 9 of the present application.
[0043] Figure 20A flowchart of an audio control method provided in the tenth embodiment of the present application.
[0044] Figure 21 A flowchart of an audio control method provided in Example 11 of the present application.
[0045] Figure 22 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In this application, the term "plurality" refers to two or more. In addition, it should be understood that in the description of this application, the terms "first" and "second" are used only for the purpose of distinguishing descriptions and should not be understood as indicating or implying relative importance or order.
[0047] The term "multiple" as used in this application refers to two or more. In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.
[0048] In the device interconnection scenario, users hope to achieve a distributed audio experience, such as device A transmits the audio of application 1 to device B, and the audio of application 2 played on device A and the audio of application 1 played on device B can not affect each other. Distributed audio experience cannot be achieved based on the existing audio output processing method. When implementing this application, the inventors found that the existing audio output processing method manages audio output based on the audio focus (Audio Focus) preemptive mechanism. For example, an audio focus preemptive mechanism is provided in the design of the Android Open Source Project (AOSP). Each audio application needs to apply for audio focus to play audio, and the audio application that obtains audio focus has the right to play audio. However, the focus information of all audio applications on the same device applying for audio focus is placed in the same audio focus stack, which makes it impossible to achieve a distributed audio experience.
[0049] Specifically, when audio application 1 on device A successfully applies for audio focus, focus information 1 of audio application 1 applying for audio focus is added to the top of the audio focus stack, and audio application 1 is notified to obtain audio focus. Audio application 1 has the permission to play audio. Device A transfers audio application 1 to device B, and plays the audio of audio application 1 through device B. At this time, the user starts audio application 2 on device A to play audio, and audio application 2 applies for audio focus. When audio application 2 successfully applies for audio focus, focus information 2 of audio application 2 applying for audio focus is added to the top of the audio focus stack, and the focus information of audio application 1 is no longer at the top of the stack. Then audio application 2 is notified to obtain audio focus, and the audio applications corresponding to other focus information in the audio focus stack (such as audio application 1) are notified that they have lost audio focus. Audio application 1 will stop playing or pause playing, or lower the volume due to the loss of audio focus.
[0050] In view of this, the present application provides an audio control method that can be applied to device interconnection scenarios to achieve a distributed audio experience. The basic principle of the present application: in a scenario where multiple electronic devices are interconnected, for multiple audio applications on the same electronic device, when the multiple audio applications play audio through different electronic devices, the audio playback of the multiple audio applications is managed separately. Taking the installation of the first audio application 1 and 2 on the first electronic device as an example, when the audio of the first audio application 1 is played through the first electronic device and the audio of the second audio application 2 is played through the second electronic device, the audio playback of the first audio application 1 and the first audio application 2 are managed separately, such as separately managing the focus information A for applying for audio focus of the first audio application 1 and the focus information B for applying for audio focus of the first audio application 2, avoiding storing both the focus information A and the focus information B in the same management bucket (such as the audio focus stack) for maintaining the order of audio playback, and then separately managing the audio playback of the first audio application 1 and 2 by separately managing the focus information A and the focus information B.
[0051] For example, the first electronic device includes a first focus stack and a second focus stack, and the first focus stack and the second focus stack are both used to store focus information of the audio application applying for audio focus. The difference between the first focus stack and the second focus stack is that the audio of the audio application corresponding to the focus information stored in the first focus stack is played through the first electronic device, and the audio of the audio application corresponding to the focus information stored in the second focus stack is played through the second electronic device. In other words, when it is desired to play the audio of the audio application through the first electronic device, the focus information of the audio application applying for audio focus is stored in the first focus stack. When it is desired to play the audio of the audio application through the second electronic device, the focus information of the audio application applying for audio focus is stored in the second focus stack.
[0052] For another example, when you want to play the audio of the first audio application on electronic device B through electronic device A, the focus information of the first audio application requesting audio focus is stored in the first local focus stack of electronic device B, and the first local focus stack maintains the focus information corresponding to the first audio application that has been transferred. Correspondingly, when you want to play the audio of the second audio application on electronic device B through electronic device A, the focus information of the second audio application requesting audio focus is stored in the second local focus stack of electronic device A, and the second local focus stack maintains the focus information corresponding to the second audio application that has been transferred.
[0053] In this way, by separately managing focus information, audio applications that play audio through different electronic devices can be managed separately, thereby achieving independence between the audio played through the second electronic device and the audio played through the first electronic device, so as to achieve a distributed audio experience.
[0054] See also Figure 1 , an audio system 100 provided in an embodiment of the present application is exemplarily introduced.
[0055] like Figure 1 As shown, the audio system 100 includes a first electronic device 101 and a second electronic device 102. A communication connection is established between the first electronic device 101 and the second electronic device 102. The first electronic device 101 and the second electronic device 102 can use the established communication connection to realize information transmission between the first electronic device 101 and the second electronic device 102. The information transmitted between the first electronic device 101 and the second electronic device 102 includes but is not limited to application content, application-related parameters (such as focus information of an audio application requesting audio focus), video data, audio data, and control instructions.
[0056] The first electronic device 101 and the second electronic device 102 can communicate with each other via a wired manner or a wireless manner. For example, a wired connection can be established between the first electronic device 101 and the second electronic device 102 using a Universal Serial Bus (USB). For another example, a wireless connection can be established between the first electronic device 101 and the second electronic device 102 via a global system for mobile communications (GSM), a general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), Bluetooth, wireless fidelity (Wi-Fi), near field communication (NFC), voice over Internet protocol (VoIP), and a communication protocol that supports a network slicing architecture. This application does not make any specific restrictions on this.
[0057] In the embodiment of the present application, the first electronic device 101 is a device that outputs the content of the audio application. The second electronic device 102 is a device that receives the transmitted content of the audio application. For example, the first electronic device 101 transfers the content of the audio application installed on it to the second electronic device 102.
[0058] In an embodiment of the present application, the content of an audio application can be transferred between multiple electronic devices through application flow technology. Application flow technology is to transfer the content (such as pictures, text or audio, etc.) of an application currently running on one or more electronic devices to another or more electronic devices so that they can run the content of the application; for example, the audio of the first audio application running on the first electronic device 101 is transmitted to the second electronic device 102, so that the second electronic device 102 can play the audio of the first audio application. In addition, the application flow technology may include application screen projection technology, application handoff technology, application distribution technology, etc. Among them, application screen projection technology is to project the content of an application running on one electronic device onto the display screen or display medium of another electronic device for display. Application relay technology is a technology that stores, transfers or shares the content of an application running on one electronic device to another electronic device. Application distribution technology is a back-end running an application on one electronic device (such as processing the display business logic function of the user interface UI interface), and running the front-end of the application (such as the user interface UI interface) on another electronic device, and requires real-time access to the back-end of the application.
[0059] For an electronic device in the audio system 100, the electronic device can stream the content of the audio application installed on it, and can also receive the content of the audio application streamed from other electronic devices in the audio system 100. When the electronic device streams the content of the audio application installed on it, the electronic device is the first electronic device 101. When the electronic device receives the content of the audio application streamed from other electronic devices, the electronic device is the second electronic device 102.
[0060] Exemplarily, the first electronic device 101 can be a mobile phone, a speaker, a tablet, a television (also known as a smart TV, a smart screen or a large-screen device), a laptop computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a personal digital assistant (PDA), a wearable electronic device, a vehicle-mounted device, a virtual reality device, or other electronic device with audio input and output functions. The embodiments of the present application do not impose any restrictions on this.
[0061] For example, in addition to being a traditional audio output device such as a Bluetooth headset or a wired headset, the second electronic device 102 can also be an electronic device with audio input and output functions such as a mobile phone, a tablet, a laptop computer, a television, a speaker or a car-mounted device. The embodiments of the present application do not impose any restrictions on this.
[0062] It should be noted that Figure 1The number and type of the first electronic devices 101 and the number and type of the second electronic devices 102 in the audio system 100 are only examples and are not specifically limited in this application. The number of the second electronic devices in the audio system 100 of this application is N, where N is an integer greater than or equal to 1.
[0063] The software system of the first electronic device 101 or the second electronic device 102 can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a microservice architecture, or a cloud architecture. The following embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device (the first electronic device 101 or the second electronic device 102). Of course, in other operating systems, as long as the functions implemented by each functional module are similar to those of the embodiment of the present application, the embodiment of the present application can also be implemented.
[0064] See also Figure 2 , the software structure of the electronic device provided in the embodiment of the present application.
[0065] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers: from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, the hardware abstraction layer (HAL), and the kernel layer. The application layer can include a series of application packages.
[0066] like Figure 2 As shown, the application layer can be used to install applications such as calls, navigation, browsers, cameras, calendars, maps, Bluetooth, games, music, and videos (applications, APPs).
[0067] Applications installed in the application layer include audio applications. These applications have audio functionality and can provide audio content to users. These applications can be pre-installed on the device, such as Huawei Music, or third-party audio applications.
[0068] For example, an audio application can be a music app, a camera app, a video app, a map app, or a recording app. A music app can play music. A camera app can output a system-preset shutter sound when taking a photo. A video app can output audio corresponding to the video while playing a video. A map app can output navigation voice after turning on the navigation function. A recording app can play pre-recorded audio. This application does not specifically limit the specific types of audio applications.
[0069] In an embodiment of the present application, before the audio application starts playing audio, it needs to send a request for audio focus to the audio framework. When the audio application successfully applies for the audio focus, the audio application obtains the audio focus, and the audio application obtains the permission to play audio. Otherwise, the audio application does not obtain the permission to play audio.
[0070] In some embodiments, an audio application calls the requestAudioFocus() function to request audio focus from the audio framework, such as by requesting audio focus from the audio manager (not shown) in the audio framework. When an audio application requests audio focus from the audio framework, it needs to provide the audio framework with relevant information regarding the request for audio focus (i.e., focus information). After receiving the audio application's request for audio focus, the audio framework constructs a corresponding focus request object and stores the focus information in the focus request object.
[0071] In this document, the focus information of an audio application or the focus information corresponding to an audio application refers to the focus information when the audio application applies for audio focus.
[0072] In an embodiment of the present application, the focus information includes the identifier of the audio application, which can be composed of the application's package name, the audio manager information held by the application, and the application's monitoring object information. The package name information is obtained from the audio application, and the audio manager information held by the audio application and the application's monitoring object information are distinguished by memory addresses.
[0073] In this embodiment of the present application, the focus information also includes the audio focus application type. The audio focus application type has the following five optional values:
[0074] (1) AUDIOFOCUS_GAIN: This parameter indicates that you want to apply for a permanent audio focus and want the previous audio application holding the audio focus to stop playing; for example, apply AUDIOFOCUS_GAIN when the audio application needs to play music.
[0075] (2) AUDIOFOCUS_GAIN_TRANSIENT: This flag is used to request a short audio focus that will be released immediately. This flag is used to pause the audio application that previously held the audio focus. For example, an audio application that needs to play a reminder sound may request AUDIOFOCUS_GAIN_TRANSIENT.
[0076] (3) AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK: This flag indicates that a short audio focus is requested and will be released immediately. The previous audio application holding the focus is expected to reduce its volume (but still allow it to play). The audio will be mixed and played. For example, a map app may request AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK when outputting navigation information.
[0077] (4) AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE: Indicates that you are applying for a short audio focus and hope that the system will not play any sudden sounds (such as notifications, reminders, etc.). For example, when a recording app wants to record, it applies AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE.
[0078] In some embodiments, the focus information also includes a source type, where the source includes at least one of music, video, call, and voice. The operating system can use the focus information to distinguish whether the source audio is from the same audio application during subsequent processing.
[0079] In some embodiments, the focus information includes a user code of the audio playback process and a user code of the audio application.
[0080] If the request is successful, the audio framework returns the AUDIOFOCUS_REQUEST_GRANTED constant to the audio application. When the audio application receives the AUDIOFOCUS_REQUEST_GRANTED constant, it indicates that the audio application has obtained audio focus. If the request fails, the audio framework returns the AUDIOFOCUS_REQUEST_FAILED constant to the audio application. When the audio application receives the AUDIOFOCUS_REQUEST_FAILED constant, it indicates that the audio application has failed to obtain audio focus.
[0081] When an audio application successfully requests audio focus, the focus request object corresponding to the audio application is added to the top of the audio focus stack, indicating that the audio application has obtained audio focus. The OnAudioFocusChangeListener callback function is registered with the audio framework so that the audio application can promptly receive audio focus state changes from the audio framework. The OnAudioFocusChangeListener is an audio focus listener that notifies the audio application when it has acquired or lost focus.
[0082] The audio focus listener monitors the state of the audio focus. The audio focus listener calls the onAudioFocusChange(int focus Change) function according to the change of the current audio focus. The focus Change function mainly has the following four parameters:
[0083] 1.AUDIOFOCUS_GAIN: Indicates that audio focus has been obtained and the audio application can call the audio output device to play audio.
[0084] 2.AUDIOFOCUS_LOSS: Indicates that the audio focus has been lost for a long time. Please end the related audio playback and complete the finishing work.
[0085] 3. AUDIOFOCUS_LOSS_TRANSIENT: Indicates that audio focus has been temporarily lost but will be returned soon. In this case, the audio application terminates audio playback but retains playback resources because it may return soon.
[0086] 4.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: Indicates that the audio focus has been temporarily lost, but can be shared with a new user.
[0087] After the audio application finishes playing, it can call the abandonAudioFocus() function to release the audio focus.
[0088] In an embodiment of the present application, the audio framework can execute the audio control method provided in the embodiment of the present application to manage the focus process requested by the audio application.
[0089] In addition to creating and maintaining the first focus stack, the audio framework in the embodiment of the present application also creates and maintains one or more focus stacks, such as the second focus stack.
[0090] like Figure 2 As shown, taking the first audio application installed on the first electronic device as a music APP as an example, the first electronic device is provided with an audio architecture for the music APP to implement the above-mentioned audio functions. When the music APP applies to play audio on the first electronic device, the music APP applies for audio focus from the audio framework. When the music APP successfully applies for audio focus, the focus information when the music APP applies for audio focus is placed on the top of the first focus stack, notifying the music APP to obtain audio focus, and the music APP plays audio and plays the audio through the first electronic device.
[0091] When the music app requests to play audio on the second electronic device, the music app requests audio focus from the audio framework. When the music app successfully requests audio focus, the focus information when the music app requests audio focus is placed at the top of the second focus stack, notifying the music app to obtain audio focus and play the audio. When the second electronic device obtains the audio content of the music app transmitted by the first electronic device, the second electronic device plays the audio of the music app.
[0092] like Figure 2 As shown, the Android system also includes a hardware abstraction layer (HAL) between the application framework layer and the kernel layer. The HAL layer is responsible for interacting with the various hardware devices of the electronic device. On the one hand, the HAL layer hides the implementation details of each hardware device, and on the other hand, it provides the Android system with an interface for calling each hardware device. The HAL provides HALs corresponding to different mobile phone hardware devices, such as the Audio HAL, Camera HAL, and Wi-Fi HAL.
[0093] The Audio HAL can also be used as part of the aforementioned audio architecture. The audio architecture can directly call the Audio HAL and send the processed audio data to the Audio HAL, which then sends the audio data to the corresponding audio output device (such as speakers, headphones, etc.) for playback.
[0094] Among them, Audio HAL can be further divided into Primary HAL, A2dp HAL, etc. For example, AudioFlinger can call Primary HAL to output audio data to the speaker of the electronic device, or AudioFlinger can call A2dp HAL to output audio data to a Bluetooth headset connected to the electronic device.
[0095] In addition, the application framework layer may also include a window manager, a content provider, a view system, a notification manager, etc., and the embodiments of the present application do not impose any restrictions on this.
[0096] like Figure 2 As shown in Figure 1, the Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.
[0097] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0098] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0099] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0100] The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of various common audio and video formats, as well as static image files.
[0101] The media library can support a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0102] The kernel layer is located below the HAL and is the layer between hardware and software. The kernel layer includes at least a display driver, a Near Field Communication (NFC) driver, an audio driver, a sensor driver, a Bluetooth driver, etc., which are not limited in this embodiment of the application.
[0103] The following describes an audio control method provided by an embodiment of the present application, which can be applied to Figure 1 The audio system 100 shown is composed of Figure 1 The first electronic device 101 shown executes the operation, and the first audio application is installed on the first electronic device 101.
[0104] Example 1
[0105] See also Figure 3 , an audio control method provided in an embodiment of the present application is exemplarily introduced.
[0106] In step S301, a first electronic device creates a first focus stack and a second focus stack, wherein the first focus stack is used to store focus information corresponding to an audio application playing audio through the first electronic device, and the second focus stack is used to store focus information corresponding to an audio application playing audio through the second electronic device.
[0107] In the existing audio output management method, the first electronic device only maintains one audio focus stack, and the focus information corresponding to the audio application that applies for audio focus on the first electronic device is stored in the only audio focus stack. If the focus information is at the top of the audio focus stack, the audio application corresponding to the focus information obtains the audio focus, and the audio application that obtains the audio focus has the permission to play audio. However, there is only one top position, which leads to at least the following problems: it is impossible to achieve that multiple audio applications on the first electronic device (such as an audio application that applies to play audio on the first electronic device and an audio application that is transferred to the second electronic device to play audio) all obtain audio focus. The audio application whose focus information is at the top of the stack has the permission to play audio, and the audio corresponding to the audio application that loses the audio focus is affected.
[0108] To this end, the first electronic device of the present application creates and maintains at least two focus stacks, and the at least two focus stacks are used to store the focus information of the audio application applying for audio focus when the audio application wants to play audio. The difference is that the first focus stack stores the focus information corresponding to the audio application that plays audio through the first electronic device, while the second focus stack stores the focus information corresponding to the audio application that plays audio through the second electronic device. In other words, when the first electronic device and the second electronic device are interconnected to achieve a distributed audio experience, for the first audio application installed on the first electronic device, when the audio of the first audio application needs to be played through the first electronic device, the focus information of the first audio application is stored in the first focus stack. When the audio of the first audio application needs to be played through the second electronic device, the focus information of the first audio application is stored in the second focus stack.
[0109] In some embodiments, when the first electronic device transfers the audio application stream to the second electronic device for playback, the second audio application installed on the second electronic device needs to play audio through the second electronic device, and the focus information of the second audio application is stored in the second focus stack. The first focus stack stores the focus information of the first audio application installed on the first electronic device. The second focus stack can store the focus information of the first audio application installed on the first electronic device, and can also store the focus information of the second audio application installed on the second electronic device.
[0110] The focus stack (such as the first focus stack and the second focus stack) in the embodiment of the present application can be implemented not only as a stack, but also as an array, a queue or a map, etc., and the present application does not make specific limitations on this. Among them, the second focus stack and the first focus stack can ensure that only one audio application corresponding to the focus information obtains the audio focus at a time based on the preset maintenance order. For example, when the focus information is at the top of the focus stack, the audio application corresponding to the focus information obtains the audio focus.
[0111] In an embodiment of the present application, multiple first audio applications may be installed on the first electronic device, and different first audio applications may correspond to different focus information. For example, the first focus information B1 corresponding to the first audio application A1 and the first focus information B2 corresponding to the first audio application A2 may be different, at least in terms of the application identifiers.
[0112] It should be noted that the first electronic device can create a second focus stack when searching for the second electronic device. The first electronic device can also create a second focus stack in response to the user transferring the first audio application that is not playing audio or is playing audio to the second electronic device, then step S301 can be executed simultaneously with step S305. In some embodiments, the first electronic device can pre-create the second focus stack when leaving the factory. Then, when the first electronic device is interconnected with the second electronic device, the first electronic device can directly respond to transferring the first audio application to the second electronic device for playback, and store the focus information when the first audio application applies for audio focus in the created second focus stack. This application does not specifically limit the timing of the first electronic device creating the second focus stack.
[0113] When the first electronic device creates only one second focus stack, the second focus stack may not be associated with the second electronic device. If the first electronic device creates two or more focus stacks in addition to the first focus stack, such as in the following embodiment, where the first electronic device creates a second focus stack and a third focus stack, the second focus stack and the third focus stack are associated with the corresponding second electronic device.
[0114] In an embodiment of the present application, the second focus stack and the first focus stack are maintained on the first electronic device, and the audio output device on the first electronic device only plays the audio of the audio application that obtains the audio focus in the first focus stack.
[0115] Step S302: The first electronic device obtains a first operation, where the first operation is used to instruct the first electronic device to play audio of a first audio application.
[0116] Exemplarily, the first operation may be a click, touch, long press, voice, or other operation. For example, the first operation may be a click on a first audio application playback control.
[0117] In step S303, the first electronic device responds to the first operation by determining the first focus stack corresponding to the first operation from the first focus stack and the second focus stack, and placing the first focus information of the first audio application on the top of the first focus stack to play the audio of the first audio application through the first electronic device.
[0118] In an embodiment of the present application, the first focus information of the first audio application is placed at the top of the first focus stack, the first audio application obtains the audio focus, has the permission to play audio, and the first audio application plays the audio through the audio output device on the first electronic device.
[0119] The first operation instructs the first electronic device to play audio, and the first electronic device may determine that the focus stack corresponding to the first operation is the first focus stack. When the first electronic device responds to the first operation, the first electronic device has not yet created a second focus stack. In step S303, the first electronic device, in response to the first operation, places the first focus information of the first audio application at the top of the first focus stack, so that the audio of the first audio application can be played through the first electronic device.
[0120] Step S304: The first electronic device obtains a second operation, where the second operation is used to instruct to transfer the first audio application that is playing audio to the second electronic device.
[0121] The second operation instruction transfers the first audio application currently playing audio on the first electronic device to the second electronic device, that is, transfers the first audio application to the second electronic device, and keeps the audio playing of the first audio application, and plays the audio through the second electronic device.
[0122] Exemplarily, the second operation may be a click, touch, long press, voice, or other operation. For example, the second operation may be that the user starts a streaming function on the interface of the first audio application that is playing audio.
[0123] Step S305: In response to the first instruction corresponding to the second operation, the first electronic device determines a second focus stack corresponding to the first instruction from the first focus stack and the second focus stack, and moves the first focus information of the first audio application from the first focus stack to the top of the second focus stack.
[0124] The first instruction is used to instruct the playback of audio of the first audio application transferred to the second electronic device.
[0125] In an embodiment of the present application, the first electronic device moves the first focus information from the first focus stack to the top of the second focus stack, and the first audio application corresponding to the first focus information in the focus stack obtains the audio focus, notifies the first audio application to obtain the audio focus, and the first audio application has the permission to play audio and can play the audio. When the second electronic device receives the content of the first audio application (including at least audio data and may also include interface data, etc.), the second electronic device plays the audio of the first audio application.
[0126] Based on the first instruction indicating that the electronic device playing the audio is the second electronic device, the first electronic device may determine that the focus stack corresponding to the first instruction is the second focus stack. When the first electronic device obtains the second operation, the first electronic device has not yet created the second focus stack. In this case, step S305 may be: the first electronic device creates the second focus stack in response to the first instruction corresponding to the second operation, and moves the first focus information of the first audio application from the first focus stack to the top of the second focus stack.
[0127] For example, take the first electronic device as a mobile phone and the first audio application as a music application.
[0128] See also Figure 4A , the mobile phone displays the main interface 40, which includes a music application 400 and a recording application 401. The user clicks the music application 400. In response to the user clicking the music application 400, the mobile phone displays the following Figure 4B The interface 402 of the music application 400 shown in FIG. The interface 402 includes a control 403 for music 1. The user clicks the control 403 for music 1. In response to the user clicking the control 403 for music 1, the mobile phone displays the following Figure 4C The interface 404 of Music 1 is shown. The interface 404 of Music 1 includes a play control 405, and the state of the play control 405 is not playing. The user clicks the play control 405 (i.e., the first operation). In response to the user clicking the play control 405, the mobile phone displays the following Figure 4D The interface 404 shown, Figure 4D The state of the play control 405 in the interface 404 shown is changed to the play state, and the mobile phone plays the audio of Music 1 at the same time. After the user plays the audio of Music 1, as shown in FIG. Figure 4D As shown, the user clicks on the more control 406 on the interface 404. In response to the user clicking on the more control 406, the mobile phone displays the following Figure 4E The display list 407 and the streaming option 408 are shown. The user clicks on the streaming option 408, where the streaming option 408 corresponds to the streaming function. In response to the user clicking on the streaming option 408, the mobile phone starts the streaming function, and can stream the content of the music application 400 to the second electronic device by applying the streaming technology. Before streaming the content of the music application 400, search for devices that can currently receive the content of the music application 400, that is, search for devices that can establish interconnection with the mobile phone. If the current mobile phone searches for devices that can receive streaming audio applications, including tablets, then the mobile phone displays the following in response to the user clicking on the streaming option 408: Figure 4F The available device list 409 and the tablet option 410 are shown. The user clicks the tablet option 410 (i.e., the second operation), that is, the user instructs to stream the content of the music application 401 to the tablet. The mobile phone responds to the user clicking the tablet option 410, as shown in FIG. Figure 4GAs shown, the mobile phone streams the content of music application 400 (such as the audio of Music 1 and the interface of Music 1) to the tablet, the main interface is displayed on the mobile phone, and the interface displayed on the tablet is similar to interface 404 of music application 400, and the tablet plays the audio of Music 1. The mobile phone does not display interface 404 of music application 400, the mobile phone can display the main interface 400, and the mobile phone does not play the audio of Music 1.
[0129] Please refer to 4C, 4D, 4F, 4G and Figure 5 , an exemplary introduction to the operation process of the first electronic device is given.
[0130] Step S500: The first audio application obtains a first operation.
[0131] like Figure 4C As shown, the first operation is the user clicking the play control 405 .
[0132] Step S501: In response to a first operation, a first audio application applies for an audio focus from an audio framework of a first electronic device.
[0133] Step S502: The audio framework places the first focus information of the first audio application on the top of the first focus stack.
[0134] When the first audio application successfully applies for the audio focus, the audio framework places the first focus information of the first audio application on the top of the first focus stack, and notifies the first audio application to obtain the audio focus, and the first audio application obtains the permission to play audio. Figure 4D As shown, the music application 400 obtains the permission to play audio, and the audio output device on the mobile phone plays the audio of Music 1.
[0135] Step S503: The first audio application obtains a second operation.
[0136] like Figure 4F As shown, the second operation is that the user clicks on the tablet option 410 .
[0137] Step S504: The first audio application performs application migration in response to the second operation.
[0138] like Figure 4F As shown, the mobile phone starts the streaming function in response to the user clicking the tablet option 410. The first audio application performs application migration, the mobile phone migrates the music application 400 to the tablet, and notifies the audio framework of the information of migrating the music application 400 to the tablet.
[0139] Step S505: The audio framework extracts first focus information of the first audio application.
[0140] In response to the information indicating that the music application 400 has been migrated to the tablet, the audio framework extracts the first focus information corresponding to the music application 400 from the first focus stack.
[0141] Step S506: The audio framework places the first focus information on the top of the second focus stack.
[0142] Based on the migration of the music application 400 to the tablet, the audio framework extracts the first focus information of the first audio application from the first focus stack and places the first focus information on the top of the second focus stack.
[0143] In some embodiments, after the audio framework extracts the first focus information from the first focus stack, it can recreate corresponding first focus information based on the extracted first focus information, and push the recreated first focus information onto the top of the second focus stack. For example, after the audio framework extracts the first focus information from the first focus stack, it can create a new focus request object based on the extracted first focus information, with the new focus request object storing the content of the extracted first focus information, and then placing the new focus request object on the top of the second focus stack.
[0144] like Figure 4G As shown, the music application 400 obtains permission to play audio, and the tablet receives the audio of Music 1 transmitted from the mobile phone and can play the audio of Music 1 through the audio output device on the tablet.
[0145] Step S507: The audio framework deletes the first focus information in the first focus stack.
[0146] When the audio framework adds the first focus information to the second focus stack, the first focus information in the first focus stack is also deleted, that is, the first focus information is popped out of the stack.
[0147] In an embodiment of the present application, a first audio application is installed on a first electronic device, and the first electronic device can transfer the first audio application that is currently playing audio to a second electronic device, which then plays the audio of the first audio application. Based on the first focus information corresponding to the first audio application playing audio through the second electronic device, the first focus stack and the second focus stack are independent of each other, and the audio played by the first electronic device and the audio played by the second electronic device do not affect each other.
[0148] Example 2
[0149] Embodiment 2 is based on embodiment 1, and the user continues to activate other first audio applications on the first electronic device and play audio.
[0150] See also Figure 6 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0151] Step S601: The first electronic device obtains a play operation, where the play operation is used to instruct the first electronic device to play audio of another first audio application.
[0152] The play operation in step S601 may be a click, touch, long press, voice or other operation. For example, the play operation may be a click on another first audio application play control.
[0153] In the embodiment of the present application, the difference between the first operation and the play operation is that the first operation instructs to play the audio of the first audio application on the first electronic device, while the play operation instructs to play the audio of another first audio application on the first electronic device.
[0154] Step S602: In response to the play operation, the first electronic device places the first focus information of the other first audio application on the top of the first focus stack, and notifies the other first audio application to obtain the audio focus to play the audio of the other first audio application on the first electronic device.
[0155] In an embodiment of the present application, the first focus information of the other first audio application is placed at the top of the first focus stack, then the other first audio application obtains the audio focus and has the permission to play audio, and the other first audio application plays the audio through the audio output device on the first electronic device.
[0156] Based on the play operation instruction to play audio through the first electronic device, the first electronic device may determine that the focus stack corresponding to the play operation is the first focus stack.
[0157] As in the above example, the other first audio application is implemented as a recording application. Figure 4G As shown, after the mobile phone transfers the content of the music application 400 to the tablet, the mobile phone can display the main interface 40. Figure 7A As shown, the user continues to click the recording application 401 on the main interface 40. In response to the user clicking the recording application 401, the mobile phone displays the following Figure 7B The recording interface 700 shown in FIG. 7 includes multiple recordings. The user clicks on the option 701 of recording 1 (ie, the first operation). In response to the user clicking on the option 701 of recording 1, the mobile phone displays the following Figure 7C The interface 702 of recording 1 is shown, and the mobile phone plays the audio of recording 1. Figure 7D As shown, the mobile phone displays the interface corresponding to the recording application 401 (such as Figure 7C The interface 702 shown in FIG. 7 is displayed, and the audio of recording 1 is played. The interface of the music application 400 (as shown in FIG. 703 ) is still displayed on the tablet. Figure 4D Interface 404 shown), and play the audio of Music 1.
[0158] Please also refer to Figure 7B 、 7C , 7D and Figure 8 , an exemplary introduction to the operation process of the first electronic device is given.
[0159] After implementing the first embodiment, the second focus stack stores the first focus information of the first audio application, and the first focus information is placed on the top of the stack. At this time, the tablet plays the audio of Music 1.
[0160] Step S800: Another first audio application obtains a play operation.
[0161] like Figure 7B As shown, the play operation is that the user clicks option 701 of recording 1.
[0162] Step S801: Another first audio application applies for audio focus from the audio framework of the first electronic device in response to a play operation.
[0163] In step S802 , the audio framework places first focus information of another first audio application on the top of the first focus stack.
[0164] When the other first audio application successfully applies for the audio focus, the audio framework places the first focus information of the other first audio application on the top of the first focus stack and notifies the other first audio application to obtain the audio focus. The other first audio application then obtains the permission to play audio. Figure 7C As shown, the recording application 401 obtains the permission to play audio, and the audio output device on the mobile phone plays the audio of recording 1.
[0165] In an embodiment of the present application, the first focus information of the first audio application is stored in the second focus stack, and the first focus information of another first audio application is stored in the first focus stack. The two focus information are independent of each other and do not affect each other, so the two first audio applications can obtain audio focus at the same time. The second electronic device can play the audio of the first audio application normally and is not affected by the other first audio application. At the same time, the audio of the other first audio application can also be played normally on the first electronic device and is not affected by the first audio application.
[0166] Example 3
[0167] In the third embodiment, based on the second embodiment, the user transfers the other first audio application to the second electronic device.
[0168] See also Figure 9 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0169] Step S901: The first electronic device obtains a second operation, where the second operation is used to instruct to transfer another first audio application that is playing audio to a second electronic device.
[0170] The content of the second operation in step S901 can be referred to in the first embodiment and will not be repeated here.
[0171] The second operation in both the first embodiment and the third embodiment is to instruct to transfer the first audio application that is playing audio to the second electronic device. The difference is that the first audio applications transferred in the first embodiment and the third embodiment are different.
[0172] In step S902, the first electronic device responds to the first instruction corresponding to the second operation, determines the second focus stack corresponding to the first instruction from the first focus stack and the second focus stack, and places the first focus information corresponding to the other first audio application on the top of the second focus stack, so that when the audio of the other first audio application is transferred to the second electronic device, the audio of the other first audio application is played through the second electronic device.
[0173] The first instruction corresponding to the second operation in step S902 is used to instruct the playback of the audio of another first audio application transferred to the second electronic device. The content of the first instruction in step S902 can refer to the first instruction in embodiment 1 and will not be repeated here.
[0174] The first instructions in both the first and third embodiments instruct to play the audio of the first audio application transferred to the second electronic device. The difference is that the first audio application played in the first and third embodiments is different.
[0175] In an embodiment of the present application, if the first focus information of the other first audio application is placed at the top of the second focus stack, the other first audio application obtains the audio focus and has the permission to play audio. The audio framework notifies the first audio application originally at the top of the second focus stack that it has lost the audio focus. The other first audio application plays the audio, and the audio of the other first audio application is played through the audio output device on the second electronic device.
[0176] Based on the first instruction instructing the first electronic device to play audio, the first electronic device may determine that the focus stack corresponding to the first instruction is the second focus stack.
[0177] like Figure 10A As shown, the recording interface 702 also includes more options 703, and the user clicks on the more options 703. In response to the user clicking on the more options 703, the mobile phone displays the following Figure 10B The available device list 704 and the tablet option 705 are shown. The user clicks the tablet option 705. In response to the user clicking the tablet option 705, the mobile phone transfers the content of the recording application 401 to the tablet. Figure 10C As shown, the tablet displays the interface corresponding to the recording application 401 (such as Figure 7C or Figure 10AInterface 702 shown), and plays the audio of the recording application 401.
[0178] Please also refer to Figure 10B 、 10C as well as Figure 11 , an exemplary introduction to the operation process of the first electronic device is given.
[0179] After the implementation of the second embodiment, the second focus stack stores the first focus information of the first audio application, and the first focus stack stores the first focus information of another first audio application.
[0180] Step S110: Another first audio application obtains a second operation.
[0181] like Figure 10B As shown, the second operation is that the user clicks on the tablet option 705 .
[0182] Step S111: Another first audio application performs application migration in response to the second operation.
[0183] like Figure 10B As shown, the mobile phone starts the streaming function in response to the user clicking the tablet option 705. Another first audio application performs application migration, the mobile phone migrates the recording application 401 to the tablet, and notifies the audio framework of the information that the recording application 401 has been migrated to the tablet.
[0184] Step S112: The audio framework extracts first focus information of another first audio application.
[0185] In response to the information indicating that the recording application 401 has been migrated to the tablet, the audio framework extracts the first focus information corresponding to the recording application 401 from the first focus stack.
[0186] In step S113 , the audio framework places the first focus information of another first audio application on the top of the second focus stack.
[0187] After the audio framework extracts the first focus information of another first audio application from the first focus stack, it places the first focus information of the other first audio application on the top of the second focus stack. Then, the first focus information of the first audio application is no longer at the top of the second focus stack.
[0188] Step S114: The audio framework notifies the first audio application that the audio focus has been lost.
[0189] Based on the fact that the first focus information of the first audio application is no longer at the top of the second focus stack, the audio framework notifies the first audio application that the audio focus has been lost. Figure 10CThe music application 401 loses the audio focus. According to the audio focus application type requested by the recording application, the music application 401 is AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE, so the music application 401 stops playing.
[0190] Step S115: The audio framework deletes the first focus information of the other first audio application.
[0191] When the audio framework adds the first focus information of another first audio application to the second focus stack, the first focus information of another first audio application in the first focus stack is also deleted, that is, the first focus information of another first audio application is popped out of the stack.
[0192] Step S115 may be executed before step S113 or S114, or may be executed simultaneously with step S113 or S114.
[0193] In an embodiment of the present application, the first focus information of another first audio application is at the top of the stack, and the other first audio application can play audio. The second electronic device receives the audio of the other first audio application, and the second electronic device plays the audio of the other first audio application. The first electronic device also notifies other audio applications (such as the first audio application) in the second focus stack that they have lost audio focus, and the first audio application is adjusted according to the audio focus application type of the other first audio application, such as the audio of the first audio application can be paused or stopped or the volume can be lowered. When the audio of the first audio application is paused or stopped, the second electronic device only plays the audio of the first audio application. When the volume of the audio of the first audio application is lowered, the second electronic device plays the audio of the first audio application and the other first audio application at the same time.
[0194] Example 4
[0195] The difference between the fourth embodiment and the third embodiment is that the fourth embodiment further includes another second electronic device, and after the user opens another first audio application, the another first audio application is transferred to the other second electronic device.
[0196] See also Figure 12 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0197] Step S121: The first electronic device obtains a device identification of another second electronic device.
[0198] In an embodiment of the present application, a first electronic device may obtain device identifications of one or more second electronic devices via a sensor. The sensor may include an ultra-wideband (UWB) sensor, an NFC sensor, a laser sensor, and / or a visible light sensor, and the device identification may include an Internet Protocol (IP) address, a media access control (MAC) address, a UWB tag, an NFC tag, and the like, which are not specifically limited in this application.
[0199] The following description will be made by taking the first electronic device as a mobile phone and the second electronic device as a laptop as an example.
[0200] For example, if both a mobile phone and a laptop are equipped with UWB sensors and each has a UWB tag (i.e., device identifier), when the user moves the mobile phone so that the distance between the mobile phone and the laptop is closer, the UWB sensor on the mobile phone will acquire the UWB tag of the laptop.
[0201] For another example, if both a mobile phone and a laptop are equipped with NFC sensors and each has an NFC tag (i.e., device identifier), when the user touches the mobile phone to the laptop by tapping or leaning against it, the NFC sensor on the mobile phone will acquire the NFC tag of the laptop.
[0202] In some embodiments, a first electronic device can be used to obtain the device identifications of all second electronic devices under the same user account, or the device identifications of all second electronic devices connected to the first electronic device under the same network. The first electronic device can access a remote or cloud-based server or other electronic device to obtain the device identifications of the second electronic devices, can access its own internal memory to obtain the device identifications, or can access an external memory interface to obtain the device identifications, without specific limitation.
[0203] Step S122: The first electronic device creates a third focus stack according to the device identification of the second electronic device.
[0204] In an embodiment of the present application, the first electronic device obtains the device identification of the second electronic device and creates a second focus stack based on the device identification of the second electronic device. The first electronic device obtains the device identification of another second electronic device and creates a third focus stack based on the device identification of the other second electronic device.
[0205] In some embodiments, the second focus stack is associated with a device identifier of a second electronic device, and the third focus stack is associated with a device identifier of another second electronic device. The second focus stack may be named after the device identifier of the second electronic device, and the third focus stack may be named after the device identifier of the other second electronic device. The stack names of the second focus stack and the third focus stack may be different.
[0206] If the first electronic device obtains the device identification of the second electronic device and another second electronic device at the same time, it can create the second focus stack and the third focus stack at the same time. The first electronic device can also create the second focus stack and the third focus stack at different times. For example, in the second embodiment above, the first electronic device can create the second focus stack in response to streaming the first audio application to the second electronic device, and then search for the other second electronic device when the other first audio application is subsequently opened or the other first audio application starts the streaming function, and create the third focus stack based on the device identification of the other second electronic device that was searched. This application does not specifically limit the timing and number of focus stacks created by the first electronic device in addition to the first focus stack.
[0207] Step S123: The first electronic device obtains a second operation, where the second operation is used to instruct to transfer another first audio application that is playing audio to another second electronic device.
[0208] The content of the second operation in step S123 may refer to the above-mentioned embodiment 3 and will not be repeated here.
[0209] The second operation in both the fourth embodiment and the third embodiment is to instruct another first audio application that is playing audio to be transferred to a second electronic device. The difference is that the second electronic devices in the third embodiment and the fourth embodiment are different.
[0210] In step S124, the first electronic device responds to the first instruction corresponding to the second operation, determines a third focus stack corresponding to the first instruction from the first focus stack, the second focus stack, and the third focus stack, and places the first focus information of another first audio application on the top of the third focus stack, so that when the audio of the other first audio application is transferred to the other second electronic device, the audio of the other first audio application is played through the other second electronic device.
[0211] The first instruction corresponding to the second operation in step S124 is used to instruct the playback of audio of another first audio application transferred to another second electronic device. The content of the first instruction in step S124 can refer to the first instruction in embodiment 3 and will not be repeated here.
[0212] The first instructions in both the fourth embodiment and the third embodiment instruct to play the audio of another first audio application transferred to the second electronic device. The difference is that the second electronic device that plays the audio is different in the fourth embodiment and the third embodiment.
[0213] Based on the first instruction instructing to play audio through another second electronic device, it is determined from the first focus stack, the second focus stack and the third focus stack that the focus stack corresponding to the first instruction is the third focus stack associated with the other second electronic device.
[0214] As in the above example, Figure 10A The user clicks on the more option 703, and the first electronic device also searches for another second electronic device, such as a laptop. Figure 13A As shown, the mobile phone displays a list of optional devices 704, which includes a tablet option 705 and a laptop option 706. The user clicks the laptop option 706. In response to the user clicking the laptop option 706, the mobile phone transfers the content of the recording application 401 to the laptop. Figure 13B , the tablet displays the interface of the music application 400 (such as Figure 4D The interface 404 shown in FIG. 4 is displayed, and the audio of the music application 400 is played. The laptop computer displays the interface corresponding to the recording application 401 (as shown in FIG. 404 ). Figure 7C The interface 702 shown in the figure) and plays the audio of the recording application 401, while the mobile phone can display the main interface.
[0215] In some embodiments, after step S124, the first electronic device opens another new first audio application (such as a telephone application) and plays it on the first electronic device. Then, the audio of the telephone application is played on the first electronic device, the audio of the music application played on the second electronic device is not affected, and the audio of the recording application played on another second electronic device is not affected.
[0216] Please also refer to Figure 13A 、 13B as well as Figure 14 , an exemplary introduction to the operation process of the first electronic device is given.
[0217] After the implementation of the second embodiment, the second focus stack stores the first focus information of the first audio application, and the first focus stack stores the first focus information of another first audio application.
[0218] Step S141: Another first audio application obtains a second operation.
[0219] like Figure 13A As shown, the second operation is that the user clicks on the laptop option 706 .
[0220] Step S142: Another first audio application performs application migration.
[0221] like Figure 13AAs shown, the mobile phone starts the streaming function in response to the user clicking the laptop option 706. Another first audio application performs application migration, the mobile phone migrates the recording application 401 to the laptop, and notifies the audio framework of the information that the recording application 401 has been migrated to the laptop.
[0222] Step S143: The audio framework extracts first focus information of another first audio application.
[0223] In response to the information that the recording application 401 is migrated to the laptop computer, the audio framework extracts the first focus information corresponding to the recording application 401 from the first focus stack.
[0224] In step S144 , the audio framework places the first focus information of another first audio application on the top of the third focus stack.
[0225] After extracting the first focus information of another first audio application from the first focus stack, the audio framework places the first focus information of the other first audio application on the top of the third focus stack. Figure 13B As shown, the recording application 401 obtains the audio focus, and when the notebook computer receives the audio of the recording application 401 , the notebook computer plays the audio of the recording application 401 .
[0226] In step S145 , the audio framework deletes the first focus information in the first focus stack.
[0227] When the audio framework adds the first focus information of another first audio application to the third focus stack, the first focus information of another first audio application in the first focus stack is also deleted, that is, the first focus information of another first audio application is popped out of the stack.
[0228] Step S145 may be executed before step S144 or simultaneously with step S144.
[0229] In an embodiment of the present application, the second electronic device can play the audio of the first audio application normally, and is not affected by another first audio application. At the same time, the audio of another first audio application can also be played normally on another second electronic device, and is not affected by the first audio application. The audio of the new first audio application can also be played normally on the first electronic device, so that the first electronic device can transfer the content of multiple different first audio applications to different second electronic devices, and the audio played by the first electronic device and the multiple different second electronic devices do not affect each other.
[0230] Example 5
[0231] The difference between the fifth embodiment and the first embodiment is that the first electronic device transfers the first audio application that is not playing audio to the second electronic device.
[0232] See also Figure 15 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0233] Step S151: The first electronic device obtains a third operation, where the third operation indicates transferring the first audio application to the second electronic device.
[0234] For example, the third operation can be a click, touch, long press, voice, etc. The third operation is that the user starts the streaming function on the interface of the first audio application. The difference between the streaming function started by the third operation and the second operation is that the streaming in the third operation does not include the audio of the audio application.
[0235] Step S152: The first electronic device transfers the first audio application stream to the second electronic device in response to the third operation.
[0236] Step S153: When detecting that the first audio application transferred to the second electronic device applies to play audio, the first electronic device obtains a first instruction.
[0237] In an embodiment of the present application, after the user transfers the first audio application to the second electronic device, the user clicks the play control of the first audio application of the second electronic device, and the second electronic device transmits the information of the first audio application requesting to play to the first electronic device. For example, the second electronic device can transmit the information of "playing the audio of the first audio application" to the first electronic device through reverse control, and the first audio application transferred to the second electronic device obtains the information of "playing the audio of the first audio application", and the first audio application requests to play the audio from the audio framework of the first electronic device. The first electronic device detects that the first audio application requests to play the audio, and the first electronic device obtains the first instruction.
[0238] In one possible implementation, a communication connection is established between a first electronic device and a second electronic device, and the first electronic device can obtain information about "the first audio application transferred to the second electronic device applying to play audio" based on the communication connection with the second electronic device. For example, a communication connection can be established between the first electronic device and the second electronic device through a distributed mobile sensing development platform (DMSDP) service. When a user clicks on the play control of the first audio application of the second electronic device, the first electronic device can obtain information about "the first audio application transferred to the second electronic device applying to play audio" from the second electronic device through the distributed mobile sensing platform service. The first audio application then applies to the audio framework of the first electronic device to play audio, and the first electronic device obtains a first instruction.
[0239] In step S154, the first electronic device responds to the first instruction, determines the second focus stack corresponding to the first instruction from the first focus stack and the second focus stack, places the first focus information of the first audio application on the top of the second focus stack, and notifies the first audio application to obtain the audio focus, so that when the content of the first audio application is transferred to the second electronic device, the audio of the first audio application is played through the second electronic device.
[0240] In an embodiment of the present application, a first electronic device can transfer a first audio application that is not playing audio to a second electronic device. When a user operates the second electronic device to play the audio of the first audio application, the first electronic device places the first focus information of the first audio application in a second focus stack, and the second electronic device plays the audio of the first audio application. Based on the first focus information corresponding to the first audio application that plays audio through the second electronic device being stored in the second focus stack, the first focus stack and the second focus stack are independent of each other, and the audio played by the first electronic device and the audio played by the second electronic device do not affect each other.
[0241] Example 6
[0242] As in the above embodiment, the first electronic device transfers the first audio application to the second electronic device. In embodiment six, after the second electronic device plays the audio of the first audio application, the user starts the second audio application installed on the second electronic device and plays the audio of the second audio application.
[0243] See also Figure 16 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0244] Step S161: The first electronic device obtains first information, where the first information is used to instruct the second electronic device to play audio of a second audio application.
[0245] In an embodiment of the present application, a communication connection is established between a first electronic device and a second electronic device, and the second electronic device can transmit the first information to the first electronic device in response to the user's operation of starting and playing the second audio application.
[0246] In some embodiments, the second electronic device may transmit the first information to the first electronic device via the distributed fusion perception platform service when detecting that the user has started and played the second audio application. The first electronic device obtains the first information from the second electronic device via the distributed fusion perception platform service.
[0247] In other embodiments, when the distributed fusion perception platform service deployed on the second electronic device detects that the user starts and plays the second audio application, the first information is transmitted to the first electronic device.
[0248] Step S162: In response to obtaining the first information, the first electronic device obtains second focus information of the second audio application, places the second focus information on the top of the second focus stack, and notifies the first audio application that the audio focus has been lost.
[0249] In an embodiment of the present application, the first electronic device, in response to obtaining the first information, obtains the second focus information corresponding to the second audio application indicated by the first information, determines the second electronic device corresponding to the first information, and then determines the corresponding focus stack (a focus stack other than the first focus stack) based on the determined second electronic device, and adds the second focus information to the determined focus stack.
[0250] In some embodiments, the first electronic device obtains the second focus information when the second audio application requests audio focus based on a communication connection with the second electronic device. Alternatively, the first electronic device obtains the second focus information when the second audio application requests audio focus through a distributed fusion perception platform service.
[0251] In some embodiments, placing the second focus information at the top of the second focus stack can be: after the first electronic device obtains the second focus information, it can create a new focus request object based on the obtained second focus information, and the new focus request object stores the content of the second focus information, and places the new focus request object at the top of the second focus stack.
[0252] As in the fourth embodiment above, the first audio application is transferred to the second electronic device, and the other first audio application is transferred to another second electronic device. When the second audio application A is opened on the second electronic device and audio is played, the second focus information A1 of the second audio application A is added to the second focus stack, and the first focus information and the second focus information A1 of the first audio application are stored in the second focus stack. When the second audio application B is opened on another second electronic device and audio is played, the second focus information B1 of the second audio application B is added to the third focus stack, and the first focus information and the second focus information B1 of the other first audio application are stored in the third focus stack.
[0253] In an embodiment of the present application, in response to the second audio application obtaining audio focus, the first electronic device notifies the first audio application that it has lost audio focus. In response to losing audio focus, the first audio application can obtain the audio focus request type of the second audio application and then pause, stop, or reduce the volume based on the audio focus request type.
[0254] As in the above example, the first electronic device streams the content (Music 1) of the music application 400 to the second electronic device, and the second electronic device plays the audio of Music 1. The user opens a second audio application (such as a video application) installed on the second electronic device, and based on the audio focus request type of the video application being AUDIOFOCUS_GAIN, the music application 400 pauses playing audio, and the second electronic device plays the audio of the video application. For another example, the user opens a second audio application installed on the second electronic device, which is a map application, and based on the audio focus request type of the map application being AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK, the music application reduces its playback volume (but can still be played). At this time, the second electronic device will mix the playback and play the navigation audio of the map application and the audio of the audio application at the same time.
[0255] Example 7
[0256] Embodiment 7 is based on embodiment 6, and the second audio application opened by the user loses the audio focus.
[0257] See also Figure 17 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0258] Step S171: The first electronic device obtains second information, where the second information is used to indicate that the second audio application has lost audio focus.
[0259] In an embodiment of the present application, a communication connection is established between a first electronic device and a second electronic device, and the second electronic device can transmit second information to the first electronic device in response to the second audio application losing audio focus.
[0260] In some embodiments, upon detecting that the second audio application loses audio focus, the second electronic device may transmit the second information to the first electronic device through the distributed fusion perception platform service, and the first electronic device may obtain the second information from the second electronic device through the distributed fusion perception platform service.
[0261] In other embodiments, when the distributed fusion perception platform service deployed on the second electronic device detects that the second audio application has lost audio focus, the second information is transmitted to the first electronic device.
[0262] In an embodiment of the present application, the situations in which the second audio application loses audio focus include but are not limited to the following: other second audio applications on the second electronic device apply to play audio through the second electronic device, and the other second audio applications successfully apply for audio focus, the second audio application applies for a short audio focus, and the audio playback is completed or the second audio application is closed.
[0263] When the second electronic device is powered off or disconnected from the first electronic device, the first electronic device may stop streaming the content of the first audio application to the second electronic device.
[0264] In step S172 , in response to obtaining the second information, the first electronic device places the first focus information of the first audio application on the top of the second focus stack, and notifies the first audio application to obtain the audio focus.
[0265] In an embodiment of the present application, the first electronic device transfers the first audio application to the second electronic device for playback, and the first focus information of the first audio application is placed at the top of the second focus stack. On the second electronic device, the second audio application applies to play audio, and the second focus information of the second audio application is placed at the top of the second focus stack, and the first focus information is located below the second focus information. In response to obtaining the second information, the first electronic device moves the second focus information out of the second focus stack, and the first focus information of the first audio application is placed at the top of the second focus stack.
[0266] Exemplarily, the first electronic device transfers the content of the music application to the second electronic device, and the second electronic device plays the audio of the music application. The user opens the map application installed on the second electronic device, and the second focus information of the map application is at the top of the second focus stack, and the first focus information of the music application is below the second focus information. The second electronic device plays the audio of the map application, and the map application applies for a short audio focus. After the map application finishes playing the navigation voice, the map application releases the audio focus, that is, the map application loses the audio focus, and the second focus information at the top of the second focus stack is moved out, and the first focus information of the music application is at the top of the stack. The music application obtains the audio focus. When the second electronic device receives the audio of the music application, the second electronic device can continue to play the audio of the music application.
[0267] In some embodiments, a first electronic device transfers multiple first audio application streams to multiple second electronic devices. When the first electronic device obtains second information, the first electronic device determines a focus stack corresponding to the second information from multiple focus stacks in response to obtaining the second information, and removes the second focus information corresponding to the second information from the determined focus stack.
[0268] As in the fourth embodiment above, the first audio application is transferred to the second electronic device, and another first audio application is transferred to another second electronic device. When the second audio application on the second electronic device loses the audio focus, the first electronic device, in response to obtaining the second information, determines from the second focus stack and the third focus stack that the focus stack corresponding to the second information is the second focus stack according to the second information, determines the second focus information of the second audio application corresponding to the second information, moves the second focus information out of the second focus stack, and then places the first focus information of the first audio application at the top of the second focus stack, notifying the first audio application to obtain the audio focus, and the second electronic device can play the audio of the first audio application.
[0269] When another second audio application on another second electronic device loses audio focus, the first electronic device responds to obtaining the second information, determines from the second focus stack and the third focus stack that the focus stack corresponding to the second information is the third focus stack according to the second information, determines the second focus information of the other second audio application corresponding to the second information, moves the second focus information of the other second audio application in the third focus stack, and then places the first focus information of the other first audio application at the top of the third focus stack, notifying the other first audio application to obtain audio focus, and then the other second electronic device can play the audio of the other first audio application.
[0270] In the above embodiments one to seven, the second electronic device receives the audio of the first audio application that is transferred. If the second electronic device also has a second audio application that requests to play at this time, the second electronic device can determine the audio playback according to a preset strategy. For example, the audio corresponding to the latest event can be set to play. The second electronic device first receives the audio of the first audio application that is transferred. Subsequently, the second electronic device opens the second audio application, and the second electronic device gives priority to playing the audio of the second audio application. Correspondingly, the audio of the second audio application is being played on the second electronic device. At this time, the second electronic device receives the audio of the first audio application that is transferred, and the second electronic device gives priority to playing the audio of the first audio application.
[0271] Example 8
[0272] As in the above embodiment, the first electronic device has migrated the first audio application to the second electronic device. In the eighth embodiment, the user migrates the first audio application back to the first electronic device.
[0273] See also Figure 18 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0274] In step S181 , the first electronic device obtains a second instruction, where the second instruction is used to instruct to migrate the first audio application back to the first electronic device.
[0275] In an embodiment of the present application, after migrating the first audio application to the second electronic device, the first electronic device detects that the user clicks the icon of the first audio application, and the first electronic device obtains a second instruction. Alternatively, the user performs a migration operation on the first audio application on the second electronic device, and the second electronic device transmits the second instruction to the first electronic device. Alternatively, the distributed fusion perception platform service deployed on the second electronic device transmits the second instruction to the first electronic device when it detects that the user performs a migration operation on the first audio application on the second electronic device.
[0276] Step S182: In response to the second instruction, the first electronic device moves the first focus information of the first audio application from the second focus stack to the top of the first focus stack, and notifies the first audio application to obtain the audio focus.
[0277] In an embodiment of the present application, the first electronic device responds to the second instruction, determines the focus stack corresponding to the second instruction, then extracts the first focus information of the first audio application from the determined focus stack, and places the extracted first focus information in the first focus stack.
[0278] Exemplarily, when the first electronic device migrates the first audio application to the second electronic device, the first focus information of the first audio application is stored in the second focus stack, the first electronic device determines the second focus stack in response to the second instruction, and the first electronic device moves the first focus information from the second focus stack to the first focus stack. When the first electronic device migrates the first audio application to another second electronic device, the first focus information of the first audio application is stored in the third focus stack, the first electronic device determines the third focus stack in response to the second instruction, and the first electronic device moves the first focus information from the third focus stack to the first focus stack. When the first focus information in the first focus stack is placed at the top of the stack, the first audio application corresponding to the first focus information obtains permission to play audio, and the first electronic device can play the audio of the first audio application.
[0279] In an embodiment of the present application, after the first electronic device migrates the first audio application back to the second electronic device to play the audio, the first audio application can be migrated back to the first electronic device to play the audio.
[0280] As in the above embodiment, for multiple first audio applications on a first electronic device, when the multiple first audio applications play audio through different electronic devices (such as the first electronic device, the second electronic device, or another second electronic device), the focus information of the multiple first audio applications is maintained by the multiple focus stacks on the first electronic device respectively, thereby achieving separate management of the audio playback of the multiple first audio applications. The following introduces the management of the first audio application transferred by the second electronic device to achieve distributed audio management.
[0281] Example 9
[0282] The difference between Example 9 and the above-mentioned Examples 1 to 8 is that the second electronic device can only maintain a first local focus stack (similar to the above-mentioned first focus stack), and the first electronic device can also only maintain a second local focus stack (ie, the above-mentioned first focus stack).
[0283] The first electronic device and the second electronic device both include a focus stack. The first local focus stack of the second electronic device is used to store focus information of an audio application that plays audio through the second electronic device (including a second audio application installed on the second electronic device and a first audio application transferred from the first electronic device to the second electronic device). The second local focus stack of the first electronic device is used to store focus information of an audio application that requests to play audio through the first electronic device.
[0284] The focus stack can ensure that only one audio application corresponding to the focus information obtains audio focus at a time based on a preset maintenance order. The focus stack in the embodiments of the present application (such as the first local focus stack and the second local focus stack) can be implemented not only as a stack, but also as an array, queue, or map, etc., which is not specifically limited in this application.
[0285] See also Figure 19 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0286] Step S191: The first electronic device obtains a first instruction.
[0287] The first electronic device obtains the first instruction in the following situations, including but not limited to: the first electronic device detects that the user transfers the first audio application that is playing audio to the second electronic device, and the first electronic device obtains the first instruction. Alternatively, the first electronic device has transferred the first audio application that is not playing audio to the second electronic device, and the second electronic device detects that the transferred first audio application requests to play audio, and the second electronic device transmits the information that the transferred first audio application requests to play audio to the first electronic device, and the first electronic device obtains the first instruction. The relevant content of the first instruction can be referred to the above embodiment and will not be repeated here.
[0288] Step S192: The first electronic device notifies the first audio application to obtain audio focus in response to the first instruction, and transmits first focus information of the first audio application to the second electronic device.
[0289] In an embodiment of the present application, the first electronic device responds to the first instruction and notifies the first audio application to obtain audio focus, and the first audio application obtains permission to play audio. The first electronic device can transmit the content of the first audio application (such as audio, interface, first focus information when applying for audio focus, etc.) to the second electronic device based on the communication connection between it and the second electronic device.
[0290] In step S193, the second electronic device creates first simulated focus information based on the first focus information, and places the first simulated focus information at the top of the first local focus stack, so that when the content of the first audio application is transferred to the second electronic device, the audio of the first audio application is played through the second electronic device.
[0291] In an embodiment of the present application, the second electronic device simulates the first audio application according to the first focus information and applies for the first simulated focus information from the audio framework of the second electronic device, and adds the first simulated focus information to the first local focus stack of the second electronic device. The first focus information is similar to the first simulated focus information, at least the audio focus application type in the first focus information and the first simulated focus is consistent. The second electronic device places the first simulated focus information on the top of the first local focus stack, notifying the audio applications corresponding to other focus information in the first local focus stack that they have lost audio focus, and the audio application that has lost audio focus pauses, stops, or lowers the volume according to the corresponding audio focus application type in the first simulated focus information. At the same time, the second electronic device can inform the first electronic device of the information that the first audio application has obtained the audio focus based on its communication connection with the first electronic device. Then the first audio application has the permission to play audio and can play audio. When the second electronic device receives the audio of the first audio application, the second electronic device plays the audio of the first audio application.
[0292] In an embodiment of the present application, the first electronic device responds to the first instruction and transmits the first focus information corresponding to the first audio application indicated by the first instruction to the second electronic device. The second electronic device can create first analog focus information based on the first focus information and add the first analog focus information to the first local focus stack of the second electronic device, and the second electronic device indirectly manages the first audio application transferred to the second electronic device. The first focus information corresponding to the first audio application that applies to play audio on the first electronic device will be added to the second local focus stack of the first electronic device. The first local focus stack and the second local focus stack are independent of each other, so the first audio application that plays audio through the second electronic device and other first audio applications that play audio through the first electronic device do not affect each other.
[0293] Example 10
[0294] The difference from the ninth embodiment is that after the first electronic device transfers the first audio application, a new second audio application is opened on the second electronic device.
[0295] See also Figure 20 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0296] Step S201: The second electronic device obtains a fourth operation, where the fourth operation indicates playing audio of a second audio application through the second electronic device.
[0297] The second electronic device installs a second audio application, and the second electronic device can obtain a fourth operation when detecting that a user starts and plays the second audio application. The fourth operation can be an operation such as a click, touch, long press, or voice. For example, the fourth operation can be a click on the play control of the second audio application.
[0298] Step S202: In response to the fourth operation, the second electronic device places the second focus information of the second audio application on the top of the first local focus stack, and notifies the second audio application to obtain the audio focus.
[0299] As in Example 9, the second electronic device stores the first analog focus information in the first local focus stack of the second electronic device. When the first analog focus information is at the top of the stack, the second electronic device plays the audio of the first audio application. In step S202, the second electronic device adds the second focus information of the second audio application to the first local focus stack. The second focus information of the second audio application is at the top of the stack, and the first analog focus information is below the second focus information of the second audio application. The second electronic device notifies the second audio application to obtain audio focus.
[0300] Step S203: The first electronic device obtains first information.
[0301] The first information is used to instruct the second electronic device to play the audio of the second audio application.
[0302] The content of the first information obtained by the first electronic device may refer to the above-mentioned embodiment 6.
[0303] When the second electronic device places the second focus information of the second audio application at the top of the first local focus stack, the second audio application is notified to obtain the audio focus. At the same time, the second electronic device, based on the communication connection with the first electronic device, notifies the first electronic device that the second audio application has obtained the audio focus, and the first electronic device then obtains the first information.
[0304] Step S204: In response to obtaining the first information, the first electronic device notifies the first audio application that the audio focus has been lost.
[0305] In an embodiment of the present application, when the second audio application obtains the audio focus, the second electronic device plays the audio of the second audio application.
[0306] When the first electronic device notifies the first audio application that it has lost audio focus, the first audio application responds to the loss of audio focus by obtaining the audio focus request type of the second audio application, and then pausing playback, stopping playback, or lowering the volume according to the audio focus request type.
[0307] Example 11
[0308] The difference from the ninth and tenth embodiments is that the first electronic device has already migrated the first audio application to the second electronic device, while in the eleventh embodiment the user migrates the first audio application back to the first electronic device.
[0309] See also Figure 21 , exemplarily introduces another audio control method provided in an embodiment of the present application.
[0310] In step S211 , the first electronic device obtains first simulated focus information from the second electronic device in response to the migration instruction.
[0311] The migration instruction instructs to migrate the first audio application back to the first electronic device.
[0312] In an embodiment of the present application, after migrating the first audio application to the second electronic device, the first electronic device detects that the user has clicked the icon of the first audio application and obtains a migration instruction (corresponding to the fourth instruction of the above embodiment). Alternatively, the user performs a migration operation on the first audio application on the second electronic device (e.g., clicking to migrate the first audio application to the first electronic device), and the second electronic device transmits the migration instruction to the first electronic device.
[0313] The first electronic device obtains the first analog focus information from the corresponding second electronic device according to the first audio application indicated in the migration instruction. In the above-mentioned fourth embodiment, the first audio application is transferred to the second electronic device for playback, and the other first audio application is transferred to the other second electronic device for playback. When the migration instruction received by the first electronic device indicates the migration back to the first audio application on the second electronic device, the first analog focus information of the first audio application is obtained from the second electronic device. When the migration instruction indicates the migration back to another first audio application on another second electronic device, the first analog focus information of the other first audio application is obtained from the other second electronic device.
[0314] In step S212, the first electronic device places the first simulated focus information on the top of the second local focus stack, notifies the first audio application to obtain the audio focus, and plays the audio of the first audio application.
[0315] As in step S211 above, the first electronic device obtains the first analog focus information, and then creates new first analog focus information based on the obtained first analog focus information. The new first analog focus information is added to the second local focus stack of the first electronic device. When the new first analog focus information is at the top of the second local focus stack, the first electronic device notifies the first audio application corresponding to the new first analog focus information to obtain audio focus. The first audio application has the permission to play audio, and the first electronic device plays the audio of the first audio application.
[0316] It should be noted that the first electronic device in Examples 9 to 11 may also maintain two or more focus stacks, and this application does not make any specific limitation on this.
[0317] The embodiments of the present application can also be applied to the management of focus, such as the management of window focus. For example, after the first electronic device transfers the first application A installed thereon to the second electronic device, the window focus corresponding to the first application A is stored in the first bucket. Correspondingly, if the user opens the first application B installed on the first electronic device, the window focus corresponding to the first application B can be stored in the second bucket. The first bucket is used to store the window focus of the first application transferred to the second electronic device. The second bucket is used to store the window focus of the first application on the first electronic device. By setting the first bucket and the second bucket, both applications can obtain focus, and the focus can be well managed.
[0318] In some embodiments, when a first electronic device transfers N first applications to N second electronic devices respectively, the window focus corresponding to the N first applications can be stored in N first buckets respectively, and the N first buckets correspond to the second electronic devices to which they are transferred. When there are multiple applications transferred to the second electronic device, the focus of these multiple applications can be better managed.
[0319] See also Figure 22 , exemplarily introduces the structure of the electronic device 220 provided in this application, and the electronic device 220 can be the above-mentioned first electronic device or the second electronic device.
[0320] The electronic device 220 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, etc.
[0321] The illustrated structure of the embodiment of the present invention does not constitute a specific limitation on the electronic device 220. In other embodiments of the present application, the electronic device 220 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0322] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0323] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0324] The wireless communication function of the electronic device 220 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0325] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
[0326] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 220. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the processor 110.
[0327] In some embodiments, at least some functional modules of the mobile communication module 150 and at least some functional modules of the processor 110 may be provided in the same device.
[0328] The wireless communication module 160 can provide wireless communication solutions for application on the electronic device 220, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0329] In some embodiments, antenna 1 of electronic device 220 is coupled to mobile communication module 150 , and antenna 2 is coupled to wireless communication module 160 , so that electronic device 220 can communicate with the network and other devices through wireless communication technology.
[0330] Electronic device 220 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0331] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 220 may include one or N display screens 194, where N is a positive integer greater than one.
[0332] The electronic device 220 can implement the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0333] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 220 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0334] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 220. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0335] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 220 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 220 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0336] The electronic device 220 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0337] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.
[0338] The speaker 170A, also called a "speaker," is used to convert audio electrical signals into sound signals. The electronic device 220 can listen to music or make hands-free calls through the speaker 170A.
[0339] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 220 receives a call or voice message, the user can place the receiver 170B close to the ear to hear the voice.
[0340] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 220 can be provided with at least one microphone 170C. In other embodiments, the electronic device 220 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 220 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.
[0341] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0342] The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
[0343] Of course, the electronic device 220 may also include a charging management module, a power management module, a battery, buttons, indicators, and one or more SIM card interfaces, etc., and the embodiment of the present application does not impose any restrictions on this.
[0344] The embodiments of the present application also provide a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the audio control method in the above-mentioned method embodiments.
[0345] An embodiment of the present application further provides a computer storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the audio control method as described in the above embodiment.
[0346] Among them, the electronic device, computer storage medium, computer program product or chip system provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0347] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0348] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0349] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0350] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0351] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0352] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. An audio control method, characterized in that: Applied to a first electronic device, a first audio application is installed on the first electronic device, the first electronic device includes a first focus stack, wherein the first focus stack is used to store focus information corresponding to the audio application playing audio through the first electronic device, the method comprising: Creating a second focus stack, wherein the second focus stack is used to store focus information corresponding to an audio application that plays audio through the second electronic device; In response to the first instruction, placing the first focus information of the first audio application at the top of the second focus stack, and notifying the first audio application to obtain the audio focus, so that when the content of the first audio application is streamed to the second electronic device, the audio of the first audio application is played through the second electronic device, and the second audio application is installed on the second electronic device; Acquire first information, wherein the first information is used to instruct the second electronic device to play the audio of the second audio application; In response to obtaining the first information, second focus information of the second audio application is obtained, the second focus information is placed on the top of the second focus stack, and the first audio application is notified to lose the audio focus.
2. The audio control method according to claim 1, wherein: The method further comprises: Obtaining second information, wherein the second information is used to indicate that the second audio application has lost the audio focus; In response to obtaining the second information, the first focus information is placed on the top of the second focus stack, and the first audio application is notified to obtain the audio focus.
3. The audio control method according to claim 1 or 2, wherein: Placing the first focus information of the first audio application on the top of the second focus stack in response to the first instruction includes: Get the first operation; In response to the first operation, determining the first focus stack corresponding to the first operation from the first focus stack and the second focus stack, and placing the first focus information of the first audio application on the top of the first focus stack, so as to play the audio of the first audio application through the first electronic device; Obtaining a second operation, wherein the second operation is used to instruct to transfer the first audio application that is playing audio to the second electronic device; In response to the first instruction corresponding to the second operation, the second focus stack corresponding to the first instruction is determined from the first focus stack and the second focus stack, and the first focus information of the first audio application is moved from the first focus stack to the top of the second focus stack.
4. The audio control method according to claim 1 or 2, wherein: Before responding to the first instruction, the method further includes: In response to a third operation, transferring the first audio application to the second electronic device; When it is detected that the first audio application transferred to the second electronic device applies to play audio, the first instruction is obtained.
5. The audio control method according to claim 1 or 2, wherein: The method further comprises: Obtaining a second instruction, wherein the second instruction is used to instruct to migrate the first audio application back to the first electronic device; In response to the second instruction, the first focus information is moved from the second focus stack to the top of the first focus stack, and the first audio application is notified to obtain the audio focus.
6. The audio control method according to claim 1 or 2, wherein: The creating the second focus stack comprises: Obtaining a device identification of the second electronic device; The second focus stack is created according to the device identification.
7. The audio control method according to claim 6, wherein: When N device identifiers are obtained, where N is an integer greater than or equal to 2, creating the second focus stack according to the device identifiers includes: N second focus stacks are created respectively according to the N device identifiers.
8. An audio control method, characterized in that: The method is applied to a first electronic device and a second electronic device, wherein the first electronic device is communicatively connected to the second electronic device, a first audio application is installed on the first electronic device, and the second electronic device includes a first local focus stack, wherein the first local focus stack is used to store focus information of the audio application playing audio through the second electronic device. The method includes: The first electronic device obtains a first instruction; In response to the first instruction, the first electronic device notifies the first audio application to obtain audio focus, and transmits first focus information of the first audio application to the second electronic device; The second electronic device creates first simulated focus information based on the first focus information, and places the first simulated focus information on the top of the first local focus stack, so that when the content of the first audio application is transferred to the second electronic device, the audio of the first audio application is played through the second electronic device.
9. The audio control method according to claim 8, wherein: The second electronic device includes a second audio application, and the method further includes: The second electronic device acquires a fourth operation, where the fourth operation indicates playing the audio of the second audio application through the second electronic device; In response to the fourth operation, the second electronic device places the second focus information of the second audio application on the top of the first local focus stack, and notifies the second audio application to obtain the audio focus; In response to the second audio application obtaining the audio focus, the first electronic device notifies the first audio application of losing the audio focus.
10. The audio control method according to claim 8 or 9, characterized in that: The first electronic device includes a second local focus stack, and the method further includes: The first electronic device obtains the first simulated focus information from the second electronic device in response to the migration instruction; The first electronic device places the first simulated focus information on the top of the second local focus stack and notifies the first audio application to obtain the audio focus, and the first electronic device plays the audio of the first audio application.
11. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the audio control method according to any one of claims 1 to 7.
12. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the audio control method according to any one of claims 1 to 7.
13. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the audio control method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Extended projection screen method and projection screen system of mobile terminal
CN107493375A
Screen projection method and terminal equipment
CN111324327A
Cited By
Audio control method, storage medium, program product, and electronic device
WO2024093922A1