Audio playback control method and electronic device
By determining whether an application has registered an audio service and processing media control commands from Bluetooth peripherals, the problem of overlaying audio from unregistered applications is solved, thus optimizing the user experience of single-channel audio output.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2026-04-02
Smart Images

Figure CN2025112944_02042026_PF_FP_ABST
Abstract
Description
Audio playing control method and electronic device
[0001] The present application claims priority to the Chinese patent application No. 202411392258.0, filed on September 30, 2024, and entitled "Audio playing control method and electronic device", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the field of terminals, and in particular to an audio playing control method and an electronic device. BACKGROUND
[0003] The application includes an application that registers an audio service (also referred to herein as a registered application) and an application that does not register an audio service (also referred to herein as a non-registered application). Since the non-registered application does not support receiving media control instructions sent by a Bluetooth peripheral, when the master device receives the media control instructions sent by the Bluetooth peripheral in the case that there is a non-registered application currently playing audio, the master device (for example, a mobile phone) will not send the media control instructions to the non-registered application, but will launch (that is, start) a registered application, and then send the media control instructions to the registered application. This will cause the audio data of the non-registered application and the audio data of the registered application to be played simultaneously, which affects the user's listening experience. SUMMARY
[0004] Embodiments of the present application provide an audio playing control method and an electronic device to optimize the control of the electronic device on audio playing and improve the user's listening experience.
[0005] In a first aspect, embodiments of the present application provide an audio playing method applied to a first electronic device, the method comprising: establishing a Bluetooth communication connection with a second electronic device; receiving a first control instruction sent by the second electronic device through the Bluetooth communication connection, the first control instruction being used to instruct the first electronic device to play audio; in a first case, discarding the first control instruction and continuing to play the audio through the second electronic device, the first case including: when the first control instruction is received, the first electronic device is playing first audio of a first application, and the first application does not register an audio service; continuing to play the audio through the second electronic device includes: continuing to play the first audio of the first application through the second electronic device.
[0006] In one scenario, when the first control instruction is received, the first electronic device is playing the first audio, and the first audio is not played completely, for example, the first audio is played to the third second. At this time, the playing the first audio of the first application by the second electronic device (the first audio of the first application can be understood as the audio data from the first application) means uninterrupted playing of the first audio (i.e., uninterrupted playing of the audio data from the first application), for example, after the third second of the first audio is played, the audio after the third second of the first audio is continuously played.
[0007] In some embodiments, the method further includes: in a second case, sending the first control instruction to a second application, and playing the audio by the second electronic device, the second case including: when the first control instruction is received, the first electronic device is playing second audio of a second application, and the second application has registered the audio service; and the playing the audio by the second electronic device including: playing the second audio of the second application by the second electronic device.
[0008] Similarly, the playing the second audio of the second application by the second electronic device means uninterrupted playing of the second audio.
[0009] In some embodiments, the method further includes: in a third case, starting a third application, sending the first control instruction to the third application, and playing the audio by the second electronic device, the third application being an application that has registered the audio service, the third case including: when the first control instruction is received, no application on the first electronic device is playing audio; and the playing the audio by the second electronic device including: playing third audio of the third application by the second electronic device.
[0010] Implementing the above method, the first electronic device can start an application that has registered when no application is playing audio, send the media control instruction to the application, and then control the application to play audio, thereby meeting the listening experience of the user; when an application is playing audio and the application is a registered application, send the media control instruction received from the Bluetooth peripheral device to the application; when an application is playing audio and the application is a non-registered application, discard the media control instruction sent by the Bluetooth peripheral device, thereby avoiding starting an application that has registered to play audio according to the media control instruction, and then avoiding the master device outputting two audio at the same time, thereby avoiding superimposed playing and affecting the listening experience of the user.
[0011] In some embodiments, the first electronic device playing the first audio of the first application includes: the first electronic device playing the first audio of the first application running in the foreground. When the first application runs in the foreground, the first electronic device displays the user interface of the first application. When an application runs in the background, the first electronic device does not display the user interface of the application.
[0012] Optionally, in some embodiments, after receiving the first control instruction and the first electronic device is playing the first audio of the first application running in the background, the first electronic device can start a third application, send the first control instruction to the third application, stop playing the first audio of the first application, and play a third audio of the third application instead.
[0013] In some embodiments, starting the third application comprises: when the interface currently displayed in the foreground by the first electronic device is one interface of a desktop application, switching the interface displayed in the foreground to a user interface of the third application; or when the interface currently displayed in the foreground by the first electronic device is a user interface of an application other than the desktop application, not switching the interface displayed in the foreground to the user interface of the third application.
[0014] The desktop application can include multiple interfaces, such as a desktop home screen (also referred to as a homepage), a negative one screen on the left of the home screen, one or more interfaces on the right of the home screen, and an activity center, etc. The application other than the desktop application refers to any application installed on the electronic device other than the desktop application, including system applications and third-party applications, such as a note application, a memo application, and the like provided by the system, and social application V, social application W, and the like downloaded from a third party.
[0015] After switching to display the user interface of the third application, the user can directly operate the user interface of the third application. In this way, the user can further set the playing parameters, such as playing in a list order, playing randomly, turning on / off a surround sound effect, and the like, to improve the user listening experience.
[0016] In the scenario of not switching the interface displayed in the foreground to the user interface of the third application, the user can continue to browse the user interface of the application displayed previously, without affecting the original browsing experience of the user.
[0017] In some embodiments, after continuing to play the second audio of the second application, the method further comprises: receiving a second control instruction sent by the second electronic device, the second control instruction being used to instruct to stop playing the audio; and sending the second control instruction to the second application, the second application stopping playing the second audio in response to the second control instruction.
[0018] In some embodiments, after continuing to play the first audio of the first application, the method further comprises: receiving a second control instruction sent by the second electronic device, the second control instruction being used to instruct to stop playing the audio; and discarding the second control instruction and continuing to play the first audio.
[0019] In some embodiments, the first electronic device has installed thereon a plurality of audio service registered applications, and the third application is one of the plurality of audio service registered applications that has been recently run. In this way, the first electronic device can play audio that the user has recently listened to, improving the user's listening experience.
[0020] Preferably, the first application belongs to a game application, a video application, or a news information application. Among them, belonging to a certain type of application means being one of the applications of this type. For example, the first application is application T, and application T belongs to a news information application, that is, one of the many news information applications.
[0021] Preferably, the second application belongs to a music application or an audiobook application.
[0022] Preferably, the first electronic device is a mobile phone or a tablet computer, and the second electronic device is a truly wireless earphone or a car audio, etc.
[0023] The first control instruction is, for example, a play instruction. The second control instruction is, for example, a pause instruction.
[0024] In a second aspect, an embodiment of the present application provides an electronic device, which comprises one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are configured to store a computer program, and when the one or more processors execute the computer program, the electronic device is caused to perform the method described in the first aspect and any possible implementation manner of the first aspect.
[0025] In a third aspect, an embodiment of the present application provides a chip system applied to an electronic device, which comprises one or more processors, and the processor is configured to invoke a computer instruction to cause the electronic device to perform the method described in the first aspect and any possible implementation manner of the first aspect.
[0026] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which comprises a computer program, and when the computer program is executed on an electronic device, the electronic device is caused to perform the method described in the first aspect and any possible implementation manner of the first aspect.
[0027] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, and when the computer program product is executed on an electronic device, the electronic device is caused to perform the method described in the first aspect and any possible implementation manner of the first aspect.
[0028] It can be understood that the electronic device provided in the second aspect, the chip system provided in the third aspect, the computer storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in the present application. Therefore, the beneficial effects achieved thereby can refer to the beneficial effects in the corresponding method, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS
[0029] FIG. 1A is a Bluetooth application scenario provided by an embodiment of the present application;
[0030] FIG. 1B is a Bluetooth application scenario of multi-channel audio superimposed playing provided by an embodiment of the present application;
[0031] FIG. 2 is a flowchart of an audio playing control method provided by an embodiment of the present application;
[0032] FIG. 3 is a system framework diagram provided by an embodiment of the present application;
[0033] FIG. 4 is a system interaction diagram provided by an embodiment of the present application;
[0034] FIG. 5 is a hardware structure diagram of a master device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0035] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to be limiting to the present application.
[0036] Based on a Bluetooth (BT) communication protocol, a mobile phone, a tablet computer and the like electronic device can establish a Bluetooth communication connection with a true wireless (TWS) earphone, a car audio and the like electronic device. In the above communication system based on the Bluetooth communication connection, the mobile phone, the tablet computer and the like electronic device are also called a master device, and the TWS earphone, the car audio and the like electronic device are also called a Bluetooth peripheral device. Based on the Bluetooth communication connection between the master device and the Bluetooth peripheral device, the master device can send audio data to the Bluetooth peripheral device, and then play through the Bluetooth peripheral device.
[0037] It can be understood that the master device is not limited to a mobile phone, a tablet computer, and can also be other types of electronic devices, such as a notebook computer, a smart watch and the like. Similarly, the Bluetooth peripheral device is not limited to a TWS earphone, a car audio, and can also be other types of electronic devices, such as a home audio, a projector and the like. The specific types of the master device and the Bluetooth peripheral device in the embodiments of the present application are not limited.
[0038] FIG. 1A is a Bluetooth application scenario provided by an embodiment of the present application;
[0039] A user can carry a master device (e.g. a mobile phone) into a vehicle cabin. The vehicle cabin is equipped with a vehicle audio. When the master device and the vehicle audio are both turned on, the master device can establish a Bluetooth communication connection with the vehicle audio after the master device enters the vehicle cabin. At this time, the vehicle audio is a Bluetooth peripheral of the master device.
[0040] After the Bluetooth communication connection is established, the Bluetooth peripheral can send a media control instruction to the master device. Typically, the Bluetooth peripheral first sends a play instruction. In response to the instruction, the master device can determine a target audio to be played, and then send the target audio to the Bluetooth peripheral through the Bluetooth communication connection for playing by the Bluetooth peripheral.
[0041] In some scenarios, when the master device receives the play instruction sent by the Bluetooth peripheral, the master device is running a music application A. In response to the instruction, the master device can determine a target audio to be played (e.g. a song B) from the music application A, and then send the target audio to the Bluetooth peripheral for playing by the Bluetooth peripheral.
[0042] In some scenarios, when the master device receives the play instruction sent by the Bluetooth peripheral, the master device is not currently running any music application. In response to the instruction, the master device can determine a music application that was used most recently from one or more music applications installed, launch the music application, determine a target audio to be played from the music application, and send the target audio to the Bluetooth peripheral for playing by the Bluetooth peripheral.
[0043] The applications installed on the master device include applications that have registered an audio service (referred to as registered applications) and applications that have not registered an audio service (referred to as unregistered applications).
[0044] The registered applications support receiving media control instructions sent by the Bluetooth peripheral, and can perform the next operation according to the received media control instructions. For example, after receiving a play instruction, in response to the instruction, the registered application can play an audio; after receiving a pause instruction, in response to the instruction, the registered application can stop playing the audio; after receiving a forward instruction, in response to the instruction, the registered application can obtain a next audio file in a play list and play the audio file; and after receiving a backward instruction, in response to the instruction, the registered application can obtain a previous audio file in the play list and play the audio file.
[0045] In contrast, the non-registered application does not support receiving the media control instruction sent by the Bluetooth peripheral (i.e., after the Bluetooth module receives the media control instruction sent by the Bluetooth peripheral, the Bluetooth module does not send the media control instruction to the non-registered application), and thus cannot perform the next operation indicated by the media control instruction.
[0046] Generally, a music application and an audiobook application register an audio service for the registered application. A game application, a video player, and a news application, although involving audio playback, generally do not register an audio service and are not registered applications (i.e., non-registered applications). Further, a desktop application, a note application, and a weather application, which do not involve audio playback, do not register an audio service and are not registered applications (i.e., non-registered applications).
[0047] Since the non-registered application does not support receiving the media control instruction sent by the Bluetooth peripheral, when the media control instruction sent by the Bluetooth peripheral is received and the non-registered application is running, the host device does not send the media control instruction to the non-registered application, but instead pulls up a registered application and then sends the media control instruction to the registered application.
[0048] For example, referring to FIG. 1B, the host device is currently running a short video application X (the short video application X is a non-registered application). After the host device enters the vehicle cabin, the host device establishes a Bluetooth communication connection with the in-vehicle audio system in the vehicle cabin. The Bluetooth peripheral (i.e., the in-vehicle audio system) can send a media control instruction, such as a play instruction, to the host device through the Bluetooth communication connection. At this time, since the short video application X is not a registered application, the host device does not send the play instruction to the short video application X, but instead pulls up a registered application, such as a music application Y, and then sends the play instruction to the music application Y. In response to the play instruction, the music application Y can obtain a recent playlist and determine a target audio, and then send the target audio to the Bluetooth peripheral for playback through the Bluetooth communication connection. After the Bluetooth communication connection is established, when the short video application X plays audio, the host device sends audio data of the short video application X to the Bluetooth peripheral for playback.
[0049] At this time, the audio data of the originally running non-registered application (e.g., the short video application X) and the audio data of the registered application (e.g., the music application Y) pulled up (i.e., started) based on the media control instruction are played in the Bluetooth peripheral in superposition, affecting the user's listening experience.
[0050] In view of this, an audio playback control method is provided in the embodiments of the present application.
[0051] The method is implemented, after receiving the media control instruction sent by the Bluetooth peripheral device, the host device can confirm whether an application is playing audio. When no application is playing audio, the host device can start a registered application, send the media control instruction to the application, and then control the application to play audio to meet the user's listening experience.
[0052] When an application is playing audio, the host device can further confirm whether the application is registered for audio service, i.e., whether it is a registered application. After determining that the application is a registered application, the host device can send the received media control instruction sent by the Bluetooth peripheral device to the application. Then, the registered application can execute the operation indicated by the media control instruction according to the preset instruction strategy, such as playing audio, pausing playing, etc. After determining that the application is a non-registered application, the host device can discard the media control instruction sent by the Bluetooth peripheral device to avoid starting a registered application to play audio according to the media control instruction, thereby avoiding the host device outputting two audio (one from the registered application and one from the non-registered application) at the same time, causing the played audios to be superimposed on each other and affecting the user's listening experience.
[0053] FIG. 2 is a flowchart of an audio playing control method provided by an embodiment of the application. The method can be applied to a host device.
[0054] S201, turn on Bluetooth function.
[0055] S202, establish Bluetooth communication connection with a Bluetooth peripheral device.
[0056] S203, receive media control instruction sent by the Bluetooth peripheral device.
[0057] After establishing the Bluetooth communication connection, the Bluetooth peripheral device can send a media control instruction to the host device through the Bluetooth communication connection to set the media playing state of the host device.
[0058] In some embodiments, after establishing the Bluetooth communication connection, the Bluetooth peripheral device can immediately send a play instruction to the host device to control the host device to play audio. It can be understood that during the duration of the Bluetooth communication connection, the host device plays audio, which can specifically mean that the host device determines the audio data of the target audio to be played, and then sends the audio data to the Bluetooth peripheral device, which converts the audio data of the electrical signal into an acoustic signal and plays it out.
[0059] In some embodiments, the Bluetooth peripheral device sends the play instruction to the host device immediately after the Bluetooth communication connection is established. In some other embodiments, the Bluetooth peripheral device does not send the play instruction to the host device immediately after the Bluetooth communication connection is established. During the duration of the Bluetooth communication connection, the Bluetooth peripheral device can detect a user operation acting on the Bluetooth peripheral device, such as a play operation of clicking a play control, a switch operation of clicking a next control, and the like. After detecting the user operation, the Bluetooth peripheral device can send a corresponding media control instruction to the host device.
[0060] S204, confirming whether there is an application playing audio.
[0061] When there is an application playing audio, S205, confirming whether the application registers an audio service.
[0062] When the application registers the audio service, S206, sending the media control instruction to the application.
[0063] After sending the media control instruction to the application, the application can execute the operation indicated by the media control instruction according to the instruction strategy preset in the application.
[0064] For example, after receiving the play instruction, the registered application can play audio in response to the instruction; after receiving the pause instruction, the registered application can stop playing audio in response to the instruction; after receiving the forward instruction, the registered application can obtain the next audio file in the play list and play the audio file in response to the instruction; after receiving the backward instruction, the registered application can obtain the previous audio file in the play list and play the audio file in response to the instruction.
[0065] Further, the instruction strategy also records the processing method of repeated instructions. For example, in a specific processing method, after receiving the play instruction, the registered application can discard the play instruction when the registered application is playing audio. Alternatively, after receiving the play instruction, the registered application can also play the audio file currently playing again or play an audio file in a specific list in response to the instruction when the registered application is playing audio. The embodiments of the present application do not limit this.
[0066] For example, when the host device is running the music application Y and the music application Y is playing audio, after receiving the play instruction sent by the Bluetooth peripheral device, the host device can send the play instruction to the music application Y. The music application Y can process the play instruction according to the instruction strategy preset in the application. For example, after determining that the music application Y is playing audio, the music application Y can ignore the play instruction. In this way, the user can continue to listen to the audio currently playing.
[0067] S207, discarding the media control instruction when the application is not registered to the audio service.
[0068] For example, when the host device is running the short video application X and the short video application X is playing audio, after receiving the play instruction sent by the Bluetooth peripheral device, the host device can discard the play instruction.
[0069] In this way, after discarding the play instruction, the host device will not pull up a registered application according to the play instruction, and thus will not output multiple audio at the same time, and will not cause the problem of audio superposition playback. The user can continue to browse the short video application X without obstacles, and play the audio of the short video application X through the Bluetooth peripheral device.
[0070] S208, pulling up a registered application and sending the media control instruction to the registered application when no application is playing audio. Similarly, the registered application can perform the operation indicated by the media control instruction according to the preset instruction strategy.
[0071] For example, when no application is currently playing audio, for example, when displaying the desktop (for example, the home screen), and for example, when running the note application in the foreground, after receiving the play instruction sent by the Bluetooth peripheral device, the host device can pull up a registered application (which can be the last registered application used) such as the music application Y in response to the instruction, and then send the play instruction to the music application Y. In response to the instruction, the music application Y can determine the target audio and then send the target audio to the Bluetooth peripheral device to control the Bluetooth peripheral device to play the target audio.
[0072] Since the host device does not play other audio before pulling up the registered application, there is only one audio output by the pulled-up registered application on the host device, and thus there is no problem of audio superposition playback, and the user experience is not affected. The user can also continue the previous task, such as browsing notes, while listening to audio.
[0073] Similarly, after receiving the forward / backward instruction sent by the Bluetooth peripheral device, the host device can pull up a registered application in response to the instruction, and then send the instruction to the pulled-up registered application. In response to the instruction, the registered application can determine the target audio and then send the target audio to the Bluetooth peripheral device to control the Bluetooth peripheral device to play the target audio. After receiving the pause instruction sent by the Bluetooth peripheral device, the host device can also pull up a registered application in response to the instruction to maintain the pause playback state of the registered application.
[0074] A plurality of registered applications can be installed in the host device. When a registered application is pulled up, preferably, the host device first pulls up the registered application that is recently used by the user. For example, two registered applications, music application Z and music application Y, are installed in the host device. Among them, the registered application that is recently opened by the user is music application Y. At this time, when a registered application is pulled up, the host device first pulls up music application Y, obtains a play list and target audio from music application Y, and sends the play list and the target audio to the Bluetooth peripheral device for playing.
[0075] In this way, when the host device currently has an application playing audio, the host device will not randomly pull up a registered application to output audio according to the media control instruction sent by the Bluetooth peripheral device, thereby avoiding the problem of audio superimposed playing and ensuring the user listening experience. When the host device currently has no application playing audio, the host device can pull up a registered application according to the media control instruction sent by the Bluetooth peripheral device to control the registered application to play audio or pause playing, thereby meeting the Bluetooth remote control demand of the user.
[0076] Optionally, after the registered application is pulled up, the host device can further determine whether the desktop is currently displayed.
[0077] In the scenario of displaying the desktop, preferably, the host device can display the user interface of the pulled-up registered application, so that the user can further set a playing parameter, such as playing in a list order, playing randomly, turning on / off a surround sound effect, and the like, thereby improving the user listening experience.
[0078] In the scenario of not displaying the desktop, for example, in the scenario of the lock screen or the scenario of displaying the note application, the host device can run the pulled-up registered application in the background and does not display the user interface of the application, thereby avoiding disturbing the user.
[0079] FIG. 3 is a system framework diagram provided by an embodiment of the present application.
[0080] The embodiment of the present application takes an Android system in a layered architecture as an example to exemplarily illustrate the system structure of the host device. As shown in FIG. 3, the software system of the host device includes an application layer, a framework layer, a system library, and a kernel layer. The layers communicate with each other through a software interface.
[0081] The application layer can include a series of application programs. The application programs include system application programs (such as a camera, a gallery, a calendar, a call, a map, navigation, WLAN, Bluetooth, music, video, and short message) and third-party application programs (such as music application Z, music application Y, short video application X, and social application W).
[0082] The framework layer provides an application programming interface (API) and a programming framework for the application programs of the application layer. The framework layer includes some pre-defined capability modules, such as a window manager, a phone manager, a resource manager, a notification manager, a view system, and a media session. The window manager can be used to obtain a display screen size, determine whether there is a status bar, lock a screen, and capture a screen. The phone manager is used to provide a communication function of the host device. The resource manager provides various resources for the application programs, such as localized strings, icons, pictures, layout files, and video files. The notification manager can be used for the application programs to convey a notification type of message and display the above information in a status bar for a user to obtain. The view system includes visual controls, such as a control for displaying text and a control for displaying a picture. The view system can be used to build a graphical user interface (GUI) of the application program. The media service can be used to implement standardization of audio and video playback control, provide unified management of a media session, and support media control interaction between different terminal devices. In the embodiment of the application, the framework layer further includes an identification module, which is used to identify a currently foreground running application program, whether the application program performs a playback operation, and whether the application program registers an audio service.
[0083] The system library includes a plurality of function modules, such as a surface manager, a three-dimensional graphics processing library (for example, OpenGL ES), a two-dimensional graphics engine (for example, SGL), media libraries, and the like. The surface manager is used to manage a display subsystem and provides fusion of 2D and 3D layers for a plurality of application programs. The three-dimensional graphics processing library is used to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing, and the like. The two-dimensional graphics engine is used for two-dimensional graphics drawing. The media libraries support playback and recording of a plurality of commonly used audio, video formats, and static image files, and the like. The media libraries can support a plurality of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, and the like.
[0084] The kernel layer is a layer between hardware and software, and includes a plurality of hardware drivers, such as a display driver, an audio driver, a Bluetooth driver, a Wi-Fi driver, a camera driver, a sensor driver, and the like.
[0085] The hardware layer of the host device can include a chip system, an audio module, a display, a camera, various sensors, and the like. The chip system can include an application processor (AP), a baseband processor (BP), which can also be referred to as a modem, and in some implementations, a Bluetooth chip, a Wi-Fi chip, and the like. The audio module can include a speaker, a receiver, a microphone, and the like. The foregoing processors or chips can be independently deployed on the host device, or some or all of them can be integrated into a chip system on the host device.
[0086] The display is driven by a display driver to display visual content such as images and GUIs. The audio module (including a speaker, a receiver, and a microphone) is driven by an audio driver, in which the speaker and the receiver are used to convert audio electrical signals into sound signals for the user to listen to, and the microphone is used to collect sound signals and convert the sound signals into electrical signals. The Bluetooth chip is driven by a Bluetooth driver to provide Bluetooth connection and communication services. The Wi-Fi chip is driven by a Wi-Fi driver to provide Wi-Fi connection and communication services. The camera is driven by a camera driver to capture images. Various sensors, such as a pressure sensor, a gyroscope sensor, a barometric 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, are driven by corresponding sensor drivers to provide corresponding sensing services.
[0087] FIG. 4 is a system interaction diagram provided by an embodiment of the present application.
[0088] S501, turn on the Bluetooth function.
[0089] The user can instruct the host device to turn on the Bluetooth function through a user operation on the Bluetooth shortcut icon or a user operation on the on-off button in the Bluetooth settings. After detecting the above user event, the Bluetooth module can turn on the Bluetooth. The Bluetooth module wakes up the Bluetooth chip through the Bluetooth driver.
[0090] S502, establish a Bluetooth communication connection.
[0091] After turning on the Bluetooth, the Bluetooth module can enter a Bluetooth connection process. The Bluetooth module can drive the Bluetooth chip to receive Bluetooth probe frames in the environment and discover nearby Bluetooth devices. In the scenario shown in FIG. 1B, at this time, the host device can discover the car audio that supports the Bluetooth connection. Then, through authentication and authorization, the host device can establish a Bluetooth communication connection with the car audio. After the connection, the car audio is the Bluetooth peripheral of the host device.
[0092] S503, whether to send a media control instruction.
[0093] Referring to the introduction of S203, in some embodiments, after establishing the Bluetooth communication connection, the Bluetooth peripheral device immediately sends a media control instruction, such as a play instruction, to the host device to control the host device to play audio. In some embodiments, after establishing the Bluetooth communication connection, the Bluetooth peripheral device does not immediately send a media control instruction to the host device. During the duration of the Bluetooth communication connection, the Bluetooth peripheral device can detect a user operation acting on the Bluetooth peripheral device, and then send a media control instruction matched according to the above-mentioned user operation to the host device.
[0094] S504, confirming whether an application is currently playing audio.
[0095] After receiving the media control instruction sent by the Bluetooth peripheral device, the Bluetooth module can send a request to the identification module to obtain the audio working state.
[0096] Specifically, after receiving the above-mentioned request, the identification module can query the audio module to determine whether there is an audio stream currently. When it is determined that there is no audio stream currently, the identification module can determine that no application is currently playing audio, i.e., the audio working state = idle; when it is determined that there is an audio stream currently, the identification module can determine that an application is currently playing audio, i.e., the audio working state = playing. Further, the identification module can determine the application currently playing audio according to the identification information such as the package name of the audio stream.
[0097] After confirming that an application is currently playing audio, S505, confirming whether the application has registered the audio service.
[0098] The identification module can send a query request to the audio module to query whether the target application has registered the audio service, i.e., whether the above-mentioned target application is a registered application, i.e., whether the above-mentioned target application can receive the media control instruction sent by the Bluetooth peripheral device. The above-mentioned target application is the application currently playing audio.
[0099] The audio module can indicate which applications have registered the audio service and which applications have not registered the audio service through a registration state field. After receiving the above-mentioned query request, the audio module can obtain the registration state field of the target application, and send the registration state field to the identification module, so as to inform the identification module whether the target application has registered the audio module. For example, if the registration state field of the target application = true, it indicates that the target application has registered the audio service; if the registration state field of the target application = false, it indicates that the target application has not registered the audio service.
[0100] In the case where it is determined that the target application has registered the audio service, S506, the media control instruction is sent to the target application. The target application can execute the operation indicated by the above-mentioned media control instruction according to the preset instruction strategy.
[0101] In the case where it is confirmed that the target application has not registered the audio service, S507, discarding the media control instruction.
[0102] In this way, the host device will not pull up the registered application according to the media control instruction, and will not output multiple audio at the same time, and will not cause the problem of audio superposition playback.
[0103] In the case where it is determined that no application is currently playing audio, S508, pulling up the registered application and sending the media control instruction to the registered application. Similarly, the registered application can execute the operation indicated by the media control instruction according to the preset instruction strategy, which will not be described here.
[0104] In this scenario, since the host device does not play other audio when pulling up the registered application, after pulling up the registered application, the host device only has the audio output by the pulled-up registered application, and thus the problem of audio superposition playback does not exist, and the user's listening experience is not affected.
[0105] FIG. 5 is a schematic diagram of a hardware structure of a host device according to an embodiment of the present application.
[0106] As shown in FIG. 5, the host device includes a chip system 61, a memory 62, an audio module 63, a display 64, a camera 65, and a sensor module 66.
[0107] The chip system 61 includes one or more processor chips, such as an AP, a BP, a Bluetooth chip, a Wi-Fi chip, a graphics processing unit (GPU), an image signal processor (ISP), a video codec, a digital signal processor (DSP), and the like. The GPU, the ISP, the video codec, and the DSP are not all embodied in the figure. Different processor chips can be independent devices or integrated in a chip system.
[0108] The processor can include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, and the like. The processor communicates with other components through the above interfaces.
[0109] The memory 62 includes one or more random access memories (RAMs) and one or more non-volatile memories (NVMs). The RAM can be directly readable and writable by the processor, and can be used to store executable programs (such as machine instructions) of an operating system or other programs that are currently running, and can also be used to store data of users and application programs, and the like. The NVM can store executable programs and store user data, and the like. The executable programs and user data stored in the NVM can be loaded into the RAM for direct reading and writing by the processor.
[0110] In the embodiments of the present application, the executable program code for implementing the audio playback control method described in the present application can be stored in the NVM. After the host device is powered on, the host device can obtain the above-mentioned executable program code from the NVM, load it into the RAM, that is, run the above-mentioned audio playback control method. In this way, the host device can discard the media control instructions sent by the Bluetooth peripheral when the user browses the non-registered application, avoid the problem of audio superimposed playback caused by the output of the registered application in response to the above-mentioned media control instructions, and the like.
[0111] The host device can also include an external memory interface for connecting an external NVM to expand the storage capacity of the host device.
[0112] The audio module 63 is configured to convert digital audio information into an analog audio signal output, and to convert an analog audio input into a digital audio signal. The audio module 63 includes a speaker, a receiver, and a microphone. The speaker, also known as a "loudspeaker", is configured to convert an audio electrical signal into a sound signal. The receiver, also known as a "earpiece", is configured to convert an audio electrical signal into a sound signal. The host device can play audio through the speaker / receiver for a user to listen to. The microphone, also known as a "microphone", "mic", or "transducer", is configured to capture a sound signal and convert the sound signal into an electrical signal.
[0113] When a Bluetooth communication connection is not established, the host device can play through the speaker in the audio module 63. After the Bluetooth communication connection is established, the host device can send audio data to the external device through the Bluetooth chip, and play through the speaker of the external device. The host device can also include a headphone interface. The host device can send audio data to a wired earphone through the headphone interface, and play through the speaker of the wired earphone.
[0114] The display 64 includes a display panel. The host device can implement a display function through a GPU, the display 64, and an application processor, etc.
[0115] The camera 65 is configured to capture images. The host device can include one or more cameras 65. The host device can implement a shooting function through an ISP, the camera 65, a video codec, a GPU, the display 64, and an application processor, etc.
[0116] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the host device. In other embodiments of the present application, the host device can include more or fewer components.
[0117] As used in the specification and the appended claims of the present application, the singular forms "a", "an" and "the" are intended to include plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. As used in the above description, the term "when" can be interpreted as meaning "if" or "after" or "in response to a determination" or "in response to detecting" depending on the context. Similarly, the phrase "upon determining" or "if detecting (a stated condition or event)" can be interpreted to mean "if determined" or "in response to determining" or "upon detecting (a stated condition or event)" or "in response to detecting (a stated condition or event)" depending on the context.
[0118] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk) and the like.
[0119] Those of ordinary skill in the art understand that all or part of the processes in the above embodiments can be implemented by a computer program to instruct the relevant hardware, which can be stored in a computer readable storage medium. The program can include the processes of the above method embodiments when executed. The aforementioned storage medium includes ROM or random access memory (RAM), magnetic disk or optical disk, and various media that can store program codes.
Claims
1. An audio playing method applied to a first electronic device, comprising: The method comprises: establishing a Bluetooth communication connection with a second electronic device; receiving a first control instruction sent by the second electronic device through the Bluetooth communication connection, the first control instruction being used to instruct the first electronic device to play audio; in a first case, discarding the first control instruction, and continuing to play audio by the second electronic device, the first case comprising: when the first control instruction is received, the first electronic device is playing first audio of a first application, and the first application has not registered an audio service; and the continuing to play audio by the second electronic device comprises: continuing to play the first audio of the first application by the second electronic device.
2. The method of claim 1, wherein, The method further comprises: in a second case, sending the first control instruction to a second application, and continuing to play audio by the second electronic device, the second case comprising: when the first control instruction is received, the first electronic device is playing second audio of the second application, and the second application has registered an audio service; and the continuing to play audio by the second electronic device comprises: continuing to play the second audio of the second application by the second electronic device.
3. The method according to claim 1 or 2, characterized in that, The method further comprises: in a third case, starting a third application, sending the first control instruction to the third application, and playing audio by the second electronic device, the third application being an application that has registered an audio service, the third case comprising: when the first control instruction is received, no application on the first electronic device is playing audio; and the playing audio by the second electronic device comprises: playing third audio of the third application by the second electronic device.
4. The method according to any of claims 1 to 3, characterized in that, The first electronic device playing first audio of a first application comprises: the first electronic device playing first audio of a first application running in the foreground.
5. The method of claim 3, wherein, The starting the third application comprises: when an interface currently displayed in the foreground of the first electronic device is an interface of a desktop application, switching the interface displayed in the foreground to a user interface of the third application; or, when the interface currently displayed in the foreground of the first electronic device is a user interface of an application other than the desktop application, not switching the interface displayed in the foreground to the user interface of the third application.
6. The method of claim 2, wherein, After the continuing to play the second audio of the second application, the method further comprises: receiving a second control instruction sent by the second electronic device, the second control instruction being used to instruct to stop playing audio; sending the second control instruction to the second application, the second application stopping playing the second audio in response to the second control instruction.
7. The method according to any of claims 1 to 6, characterized in that, After the continuing to play the first audio of the first application, the method further comprises: receiving a second control instruction sent by the second electronic device, the second control instruction being used to instruct to stop playing audio; discarding the second control instruction, and continuing to play the first audio.
8. The method of claim 1, wherein, The first application belongs to: a game application, a video application, or a news information application.
9. The method of claim 1, wherein, The second application belongs to a music application or an audiobook application.
10. The method of claim 3, wherein, The first electronic device has a plurality of applications registered for audio services installed thereon, and the third application is one of the plurality of applications registered for audio services that was most recently executed.
11. An electronic device, comprising: comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are configured to store a computer program that, when executed by the one or more processors, causes performance of the method of any one of claims 1-10.
12. A chip system applied to an electronic device, the chip system comprising one or more processors, characterized in that, The processor is configured to invoke computer instructions to cause the electronic device to perform the method of any one of claims 1-10.
13. A computer readable storage medium comprising a computer program, characterized in that, The computer program, when executed on an electronic device, causes the electronic device to perform the method of any one of claims 1-10.
Citation Information
Patent Citations
Multimedia application play control method and system based on remote Bluetooth device
CN106507160A
Media playing control method and device based on wearable equipment, equipment and medium
CN113301403A
Bluetooth audio playing method, electronic equipment and storage medium
CN116828100A
Method for playing Bluetooth audio, and method and system for controlling audio playing
CN117858057A
Refining media playback
US10318236B1