CN109413527B - Audio device control method and device, earphone and electronic device - Google Patents
Audio device control method and device, earphone and electronic device Download PDFInfo
- Publication number
- CN109413527B CN109413527B CN201811163064.8A CN201811163064A CN109413527B CN 109413527 B CN109413527 B CN 109413527B CN 201811163064 A CN201811163064 A CN 201811163064A CN 109413527 B CN109413527 B CN 109413527B
- Authority
- CN
- China
- Prior art keywords
- earphone
- state
- electronic equipment
- audio output
- connection
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R1/00—Details of transducers, loudspeakers or microphones
- H04R1/10—Earpieces; Attachments therefor ; Earphones; Monophonic headphones
- H04R1/1041—Mechanical or electronic switches, or control elements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04R—LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
- H04R29/00—Monitoring arrangements; Testing arrangements
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Acoustics & Sound (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Otolaryngology (AREA)
- Telephone Function (AREA)
Abstract
The embodiment of the application discloses an audio device control method and device, an earphone and an electronic device. The method comprises the following steps: the earphone detects whether the earphone is in a wearing state; if the earphone is detected to be in an unworn state, detecting whether the electronic equipment connected with the earphone is in an audio output state; and if the electronic equipment is detected not to be in the audio output state, disconnecting the electronic equipment from the connection. According to the method, when the earphone is not worn and the electronic equipment is not in audio output, the connection between the earphone and the electronic equipment is disconnected, so that the electric quantity of the electronic equipment and the earphone can be saved, the earphone can be flexibly switched between the state of establishing connection with the electronic equipment and the state of not establishing connection with the electronic equipment, and the user experience is improved.
Description
Technical Field
The present application relates to the field of electronic devices, and in particular, to an audio device control method and apparatus, an earphone, and an electronic device.
Background
With the popularization of more external audio output devices, users of electronic devices have more choices to transmit audio to be played to the external audio output devices for playing. For example, when the electronic device can transmit audio to a headset, the audio is played by using the headset. However, the user experience of headset state switching still remains to be improved.
Disclosure of Invention
In view of the above problems, the present application provides an audio device control method, apparatus, earphone and electronic device to achieve improvement of the above problems.
In a first aspect, the present application provides an audio device control method, applied to a headset, the method including: the earphone detects whether the earphone is in a wearing state; if the earphone is detected to be in an unworn state, detecting whether the electronic equipment connected with the earphone is in an audio output state; and if the electronic equipment is detected not to be in the audio output state, disconnecting the electronic equipment from the connection.
In a second aspect, the present application provides an audio device control method, applied to an electronic device, the method including: the electronic equipment detects whether an earphone connected with the electronic equipment is in a wearing state;
if the earphone is detected to be in an unworn state, detecting whether the electronic equipment is in an audio output state; and if the electronic equipment is detected not to be in the audio output state, disconnecting the connection.
In a third aspect, the present application provides an audio device control apparatus, operable on a headset, the apparatus comprising: the earphone state detection unit is used for detecting whether the earphone is in a wearing state; the audio output detection unit is used for detecting whether the electronic equipment which is connected with the earphone is in an audio output state or not if the earphone state detection unit detects that the electronic equipment is in an unworn state; and the connection control unit is used for disconnecting the connection with the electronic equipment if the audio output detection unit detects that the electronic equipment is not in the audio output state.
In a fourth aspect, the present application provides an audio device control apparatus, operable on an electronic device, the apparatus comprising: a wearing state detection unit for detecting whether an earphone connected to the electronic device is in a wearing state; the audio output detection unit is used for detecting whether the electronic equipment is in an audio output state or not if the earphone is detected to be in an unworn state; and the connection control unit is used for disconnecting the connection if the electronic equipment is detected not to be in the audio output state.
In a fifth aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the methods described above.
In a sixth aspect, the present application provides a headset comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the methods described above.
In a seventh aspect, the present application provides a computer-readable storage medium, in which a program code is stored, wherein the above method is performed when the program code runs.
According to the audio equipment control method and device, the earphone and the electronic equipment, whether the earphone is in a wearing state or not is detected, if the earphone is detected to be in an unworn state, whether the electronic equipment connected with the earphone is in an audio output state or not is detected, and when the electronic equipment is detected not to be in the audio output state, the connection between the electronic equipment and the earphone is disconnected. Therefore, when the earphone is not worn and the electronic equipment is not in audio output, the connection between the earphone and the electronic equipment is disconnected, so that the electric quantity of the electronic equipment and the earphone can be saved, the earphone can be flexibly switched between a state of establishing connection with the electronic equipment and a state of not establishing connection with the electronic equipment, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a schematic diagram of an electronic device according to the present application connected to a headset;
fig. 2 shows a schematic view of another electronic device proposed by the present application in connection with a headset;
fig. 3 shows a flow chart of an audio device control method proposed by the present application;
fig. 4 shows a flow chart of another audio device control method proposed by the present application;
fig. 5 is a flowchart illustrating still another audio device control method proposed by the present application;
fig. 6 is a block diagram showing a structure of an audio device control apparatus proposed in the present application;
fig. 7 is a block diagram showing the structure of another audio device control apparatus proposed in the present application;
fig. 8 is a block diagram showing a structure of still another audio device control apparatus proposed in the present application;
fig. 9 shows a block diagram of an electronic device proposed in the present application;
fig. 10 is a storage unit of an embodiment of the present application for storing or carrying program codes for implementing an audio device control method according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the increase of the types of audio playing devices and the improvement of playing sound effects, more users can select to output audio played by electronic devices such as mobile phones and tablet computers to the audio playing devices for playing. Common audio playing devices include a vehicle-mounted music player, a sound box, an earphone, and the like. Wherein, the earphone comprises a wired earphone or a wireless earphone.
Take an earphone as an example. If the earphone is a wired earphone, after the wired earphone is connected with the electronic device, the electronic device can transmit the audio to the wired earphone through a physical line of the wired earphone, so that the wired earphone can play the audio conveniently. Furthermore, if the earphone is a wireless earphone, the wireless earphone proposes a communication link according to a wireless communication protocol supported by the wireless earphone and the electronic device in advance, and then the electronic device transmits the audio to the wireless earphone through the communication link so that the wireless earphone can play the audio. For example, as shown in fig. 1, in one case, the wireless headset includes a first headset 110 and a second headset 120, the electronic device 100 suggests a communication link with the first headset 110 and the second headset 120, respectively, based on the aforementioned wireless communication protocol. Furthermore, as shown in fig. 2, the electronic device 100 may directly suggest a communication link based on the aforementioned wireless communication protocol for the first earphone 100, and then suggest a communication link based on the aforementioned wireless communication protocol for the first earphone 110 and the second earphone 120. The wireless communication protocol may include a Wlan protocol, a bluetooth protocol, a ZigBee protocol, or the like.
However, the electronic device and the headset are usually connected or disconnected, and thus the electronic device and the headset are switched between the connection and disconnection modes. For example, when the headset enters a sleep state, the headset may be disconnected from the electronic device, and when the headset switches from the sleep state to a wake state, the headset may be connected to the electronic device.
The inventor finds that, in the prior art, the electronic device is not flexible to switch between the two modes of the connection state and the disconnection state with the headset, and therefore, the user experience is poor. Therefore, the inventor provides an audio device control method and device, an earphone and an electronic device, which can improve the switching flexibility of earphone states and improve user experience in the application.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Referring to fig. 3, an audio output method provided by the present application is applied to a headset, and the method includes:
step S110: the headset detects whether it is in a wearing state.
As one mode, whether the earphone is in a wearing state may be detected by an infrared sensor provided to the earphone. It should be noted that, when the earphone is worn on the ear of a person, some areas may be blocked, and in this case, in a manner that the infrared sensor is disposed in the area that is blocked after the earphone is in the wearing state, whether the infrared signal emitted by the infrared sensor is blocked is determined by detecting the returned state value of the infrared sensor, so as to determine whether the earphone is in the wearing state or the non-wearing state. It will be appreciated that the headset is determined to be in a worn state when the returned state value indicates that the infrared signal is occluded and in an unworn state when the returned state value indicates that the infrared signal is not occluded.
Then, as one approach, the headset may detect what is characterized by the status value returned by the infrared sensor at a set period. Alternatively, the headset may store a variable, e.g., headset _ status, in memory. If the headset detects that the headset is in a wearing state, 1 may be assigned to the variable headset _ status, and if the headset detects that the headset is in an unworn state, 0 may be assigned to the variable headset _ status. The headset may determine whether the headset is in a wearing state by detecting the value of the variable headset _ status.
It should be noted that, in addition to the aforesaid detection of whether the earphone is in the wearing state by the infrared sensor, other elements may be provided to determine whether the earphone is in the wearing state. For example, a component may be disposed at a portion of the earphone that contacts with the skin of the human body after the earphone is worn, and a resistance value of the component may change after the component contacts with the skin of the human body (for example, a thermistor). Optionally, in this manner, after the earphone determines whether the earphone is in the wearing state through the current change of the path, the detected result may be sent to the electronic device.
Step S120: and if the earphone is detected to be in the unworn state, detecting whether the electronic equipment connected with the earphone is in an audio output state.
Wherein, the electronic device can determine whether the electronic device is currently in the audio output state in various ways.
Alternatively, the electronic device may determine whether it is currently in an audio output state by querying the currently running application. As one mode, if the electronic device is an Android operating system, the name of the application program currently running in the foreground may be obtained by executing a getreporting tasks method of the ActivityManager. In addition, the electronic device may further acquire a list of programs used by the user through the usagetstatsmanager, and identify a most recently used application program recorded in the list as a current foreground application. Moreover, the Android can monitor the change of the focus of the window through the barrier-free function of the Android, and the package name corresponding to the focus window is taken as the application program which runs in the foreground at the present time.
After the electronic device obtains the currently running application program, whether the electronic device is currently in an audio output state can be determined according to the name of the currently running application program. The electronic equipment can store and establish an application program list with audio output in advance, after the electronic equipment obtains the application program currently running, whether the application program currently running belongs to the list can be detected, and if the application program currently running belongs to the list, the electronic equipment is judged to be in an audio output state.
Besides, whether the electronic device is in the audio output state can be detected by detecting the currently running application program, and whether the electronic device is in the audio output state can be detected by detecting whether an audio stream exists. For example, if the operating system of the electronic device is an Android system, the electronic device may determine whether the electronic device is in an audio output state according to a return value of the isMusicActive () method by executing the isMusicActive () method of the AudioManager class.
In addition, as another way, the electronic device can avoid misjudging whether the electronic device is in the audio output state or not due to the fact that the electronic device makes an error when executing the isMusicActive () method of the AudioManager class. The electronic device may determine whether the electronic device is in an audio output state in conjunction with the currently running application and the return value of the isMusicActive () method.
For example, when the memory of the electronic device is insufficient or the processing resources of the CPU are tight, the electronic device may be caused to process data incorrectly. Optionally, the electronic device may determine that the currently running application belongs to the application in the aforementioned list when detecting that the current memory of the electronic device is smaller than the set threshold, and when the return value of the isMusicActive () method represents that an audio stream exists, determine that the current electronic device is in the audio output state, thereby avoiding that the electronic device misjudges whether the electronic device is in the audio output state due to an error occurring when the electronic device executes the isMusicActive () method of the AudioManager class because of insufficient memory.
Then, in the manner described above, the electronic device may locally configure a text document for storing the audio output state of the electronic device detected based on the manner described above. For example, a variable music _ status may be configured in the text document, and assigned to 1 if the electronic device is detected to be in an audio output state, and assigned to 0 if the electronic device is detected not to be in an audio output state. The electronic device may periodically send the value of the variable music _ status to the headset so that the headset acquires in real time whether the electronic device is in an audio output state.
Furthermore, the earphone may periodically request the electronic device to detect whether the electronic device is in the audio output state, and if the electronic device receives the request, the electronic device returns the value of the variable music _ status in response to the request.
Further, as another mode, the electronic apparatus may detect whether the electronic apparatus is in an audio output state by the following mode. Specifically, the electronic device may detect whether the currently running application program of the electronic device meets a set audio output condition, and determine that the electronic device is not in an audio output state if it is detected that the currently running application program does not meet the set audio output condition.
Optionally, the audio output condition includes: the application is outputting audio; the application program supports an audio output function; or the application supports audio output functionality and is not in a mute state. Wherein whether the application is outputting audio can be detected by executing the isMusicActive () method of AudioManager class as described above. And whether the application supports the audio output function can be detected by detecting whether it requires the audio output authority. Specifically, whether the application time sequence has the following permission requirements or not can be detected: "android. If so, the application program is judged to support the audio output function. In addition, as one mode, a configuration file of each application program may be stored in the electronic device, and a configuration state of the corresponding application program, for example, a UI style of the application program, an update cycle of the application program, or an audio output state of the application program, may be stored in the configuration file. The audio output state includes a mute state or a non-mute state. The mute state refers to the sound content of the audio file that is not output even if the application is playing the audio file.
Step S130: and if the electronic equipment is detected not to be in the audio output state, disconnecting the electronic equipment from the connection.
It can be understood that, if the electronic device needs to send audio to the headset, the electronic device needs to establish a connection with the headset to construct a data transmission channel, and then output the audio to the headset based on the data transmission channel. For example, a connection established between the electronic device and the headset based on the bluetooth protocol is taken as an example. In the process of establishing the connection, a link connection, that is, a connection of the ACL link, is first established between the electronic device and the headset. After the ACL link connection is established, the electronic device initiates a request for establishing a channel connection, that is, the connection of the L2CAP, and completes all connection procedures in the connection mode after the connection of the L2CAP is established. Then after the channel connection is established, audio transmission can begin.
In this case, after the earphone detects that the electronic device is not in the audio output state, part of the connection process established as described above can be directly disconnected. In particular, only the second portion may be disconnected, leaving the remaining first portion connected. For example, the link connection and the channel connection are successively performed in the process based on the bluetooth connection. The headset may either disconnect only the channel connection (the connection of the second part) while maintaining the link connection (the connection of the first part) or disconnect both the link connection and the channel connection.
It should be noted that, generally, for a connection including a first partial connection and a second partial connection in the whole process, after the first partial connection is completed, a request for sending the second partial connection is started, and in a case that no response is received in relation to the request for the second partial connection within a set time period, it is determined that the connection fails, and the request for resending the second partial connection is continued, and if the number of failures exceeds a set number, the connection is abandoned, and at the same time, the already established first partial connection is disconnected. In order to avoid the influence of this situation on the disconnection of only a part of the connection between the electronic device and the headset in the present solution, the length of the aforementioned set time period may be adaptively modified to be longer, or set to be infinitely long, so that the part of the connection that has not been disconnected may be continuously maintained without being disconnected for the aforementioned reason.
It should be noted that, as one mode, the earphones may include a first earphone and a second earphone as shown in fig. 1 or fig. 2. In a case where the first earphone and the second earphone are respectively connected to the electronic device, the steps included in the audio device control method provided in the present application may be performed by any one of the first earphone and the second earphone. And after the first earphone and the second earphone are respectively detected to be in the unworn state, the audio equipment control method provided by the application starts to be executed.
Whereas for the case where the second headset is data interactive with the electronic device through the first headset as shown in fig. 2. The audio device control method provided by the present application may be performed only when the first headphone detects that it is in an unworn state.
According to the audio equipment control method, whether the earphone is in a wearing state or not is detected, if the earphone is detected to be in an unworn state, whether the electronic equipment connected with the earphone is in an audio output state or not is detected, and when the electronic equipment is detected not to be in the audio output state, the connection between the electronic equipment and the electronic equipment is disconnected. Therefore, when the earphone is not worn and the electronic equipment is not in audio output, the connection between the earphone and the electronic equipment is disconnected, so that the electric quantity of the electronic equipment and the earphone can be saved, the earphone can be flexibly switched between a state of establishing connection with the electronic equipment and a state of not establishing connection with the electronic equipment, and the user experience is improved.
Referring to fig. 4, an audio output method provided by the present application is applied to a headset, and the method includes:
step S210: the headset detects whether it is in a wearing state.
Step S220: and if the earphone is detected to be in the unworn state, detecting whether the electronic equipment connected with the earphone is in an audio output state.
Step S230: and if the electronic equipment is detected not to be in the audio output state, disconnecting the electronic equipment from the connection.
Step S240: and if the electronic equipment is detected to be in the audio output state, keeping the connection with the electronic equipment.
Step S250: and if the earphone is detected to be in a wearing state, the connection with the electronic equipment is restored.
It should be noted that, after the user wears the headset, the headset may detect that the headset is in a worn state, and then the headset may further detect the recently paired connected device, and if the recently paired connected electronic device may be detected within a coverage range of a wireless signal emitted by the headset, then the connection with the electronic device may be reestablished.
In some cases, in order to facilitate quick connection between the electronic device and the headset, a partial link may be established with the electronic device after detecting that the headset tends to be worn. And then after detecting that the earphone is actually worn, establishing the link connection of the rest part, thereby completing the whole connection process.
As a way, after detecting that the posture information of the headset in the unworn state meets a preset condition, the electronic device establishes a first part of link with the electronic device, and if further detecting that the headset is in the worn state, completes subsequent link connection of a second part based on the first part of link to establish the connection with the electronic device.
It will be appreciated that the headset will store an acceleration directed vertically downwards as the user removes the headset from the ear. Correspondingly, when the user holds the headset from a low position to the ear during wearing of the headset, there is a corresponding vertical upward acceleration of the headset. Then, based on the foregoing principle, in the case where the audio output is performed with the headphones in the unworn state, it is determined that the headphones have a tendency to be worn after the headphones are detected to have an acceleration in a vertically upward direction (i.e., the foregoing first direction). Then the headset may establish a first part of the link with the electronic device after detecting a tendency to be worn.
It should be noted that, sometimes, a user may hold the earphone in a hand, and in this case, the earphone swings with the hand of the user, and further, acceleration is generated in the first direction, so that the electronic device misjudges that the user is about to wear the earphone. In order to improve the problem, as one way, after detecting the acceleration in the first direction, the electronic device continuously detects whether there is an acceleration in the second direction, and if it is detected that there is no acceleration in the second direction, a link of the first portion is established with the electronic device. Wherein the second direction may be a direction opposite to the first direction. For example, after the electronic device detects that the headset has a vertical upward acceleration, it detects whether a vertical downward acceleration occurs within a set time period, if no vertical downward acceleration is detected within the set time period, a first part of link is established between the electronic device and the headset, and if a vertical downward acceleration is detected within the set time period, it is determined that the headset is only shaking.
After the first part of the link is established, the earphone can start to complete the establishment of the rest link after detecting that the earphone is in a wearing state, thereby completing the whole connection process. For example, if the connection between the headset and the electronic device is established based on the bluetooth protocol, the first portion of the link may be a physical link (e.g., an ACL link), and the second portion of the link may include the establishment of a logical link and the establishment of an application link.
Furthermore, as another mode, if the connection between the headset and the electronic device is established based on a wlan protocol (for example, Wi-fi direct mode), after the headset detects that there is a wearing trend, a hotspot search may be performed first to search for a device that is connected most recently before, and after a device that is connected most recently (i.e., the electronic device in the present application) is searched for, after further detecting that the headset is in a wearing state, a subsequent connection process is completed with the device that is searched for and connected most recently, so as to complete the entire connection.
The trend of detecting whether the earphone is worn can be determined by other methods besides the acceleration. For example, when the user wears the earphone again, the user can hold the earphone in advance, shaking of the earphone can be caused in the holding process, and then the user can judge that the earphone is in a shaking state when detecting angle change through a gyroscope or a level meter arranged on the earphone, and further judge that the earphone has a wearing trend. In addition, a sound collection module can be arranged in the earphone, and when the set sound is collected, the wearing trend is judged. For example, the sound of the earphone colliding with the object may be configured as a set sound, and after the user holds the earphone and continuously collides with the electronic device or other objects, the earphone detects the set collision sound for a plurality of times, and determines that the earphone has sounded too much collision, thereby determining that the earphone has a wearing tendency.
After the headset is connected with the electronic device, in order to save power, as a manner, after it is detected that the posture information of the headset in the unworn state meets a preset condition, the step of establishing a link with the electronic device, after which the step of establishing the link with the first portion, further includes: and if the earphone is detected to be in an unworn state within a set time period after the link of the first part is established, disconnecting the link of the first part.
Note that, in the case where the headphones include the first headphone and the second headphone. If the first earphone and the second earphone are respectively connected with the electronic device, the method can be implemented when any one of the first earphone and the second earphone detects that the earphone is in a wearing state. For example, when the first earphone and the second earphone are both currently in an unworn state, if the first earphone detects that the first earphone tends to be worn, the first earphone may start to establish a partial connection (for example, the aforementioned link of the first part) with the electronic device, or the first earphone starts to establish a connection with the electronic device after detecting that the first earphone is in a worn state. If the second headset detects that the second headset is wearing the electronic device, the second headset may start to establish a partial connection (e.g., the aforementioned link of the first portion) with the electronic device. Of course, the first earphone and the second earphone may also start to establish connection with the electronic device after detecting that the first earphone and the second earphone are in the wearing state respectively.
Furthermore, the connection mode between the first earphone and the second earphone and the electronic device is the case shown in fig. 2. The connection of the parts can be established before the first earphone detects the wearing tendency, or the connection with the electronic equipment is started to be established after the first earphone is detected to be in the wearing state. If the second earphone detects that the wearing trend is prior to the first earphone, a trigger instruction can be sent to the first earphone first to trigger the first earphone to be partially connected with the electronic equipment, and after the first earphone detects that the second earphone is in a wearing state, subsequent connection is completed.
According to the audio equipment control method, whether the earphone is in a wearing state or not is detected, if the earphone is detected to be in an unworn state, whether the electronic equipment connected with the earphone is in an audio output state or not is detected, when the electronic equipment is detected not to be in the audio output state, the connection between the electronic equipment and the electronic equipment is disconnected, and when the earphone is detected to be in the wearing state, the connection between the electronic equipment and the electronic equipment is recovered. Therefore, when the earphone is not worn and the electronic equipment is not in audio output, the connection between the earphone and the electronic equipment is disconnected, the earphone is connected with the electronic equipment after being worn, and the earphone is disconnected with the electronic equipment after the condition that the electronic equipment does not have the audio output requirement is determined, so that the electric quantity of the electronic equipment and the earphone can be saved, the earphone can be flexibly switched between the state of establishing connection with the electronic equipment and the state of not establishing connection with the electronic equipment, and the user experience is improved.
Referring to fig. 5, an audio output method provided by the present application is applied to an electronic device, and the method includes:
step S310: the electronic equipment detects whether an earphone connected with the electronic equipment is in a wearing state.
Step S320: and if the earphone is detected to be in an unworn state, detecting whether the electronic equipment is in an audio output state.
Step S330: and if the electronic equipment is detected not to be in the audio output state, disconnecting the connection.
Step S340: and if the electronic equipment is detected to be in an audio output state, keeping the connection.
It should be noted that the main difference between the present embodiment and the foregoing embodiment is that the method provided by the present embodiment is executed by an electronic device, and the specific principle in the execution process of the method is similar to that described above.
According to the audio equipment control method, whether the earphone is in a wearing state or not is detected through the electronic equipment, if the earphone is detected to be in an unworn state, whether the electronic equipment connected with the earphone is in an audio output state or not is detected, and when the electronic equipment is detected not to be in the audio output state, the connection between the electronic equipment and the electronic equipment is disconnected. Therefore, when the earphone is not worn and the electronic equipment is not in audio output, the connection between the earphone and the electronic equipment is disconnected, so that the electric quantity of the electronic equipment and the earphone can be saved, the earphone can be flexibly switched between a state of establishing connection with the electronic equipment and a state of not establishing connection with the electronic equipment, and the user experience is improved.
Referring to fig. 6, the present application provides an audio device control apparatus 400, operating on a headset, where the apparatus 400 includes: a headphone state detection unit 410, an audio output detection unit 420, and a connection control unit 430.
A headphone state detection unit 410 for detecting whether the headphone is in a wearing state.
An audio output detection unit 420, configured to detect whether the electronic device connected to the headset is in an audio output state if the headset state detection unit 410 detects that the electronic device is in an unworn state.
As one mode, the audio output detecting unit 420 is specifically configured to detect whether an application currently running on the electronic device meets a set audio output condition; and if the currently running application program is detected not to be in accordance with the set audio output condition, judging that the electronic equipment is not in an audio output state.
Wherein, optionally, the audio output condition includes: the application is outputting audio; the application program supports an audio output function; or the application supports audio output functionality and is not in a mute state.
A connection control unit 430, configured to disconnect the connection with the electronic device if the audio output detection unit 420 detects that the electronic device is not in the audio output state.
Referring to fig. 7, an audio device control apparatus 500 provided by the present application operates on a headset, where the apparatus 500 includes: a headphone state detection unit 510, an audio output detection unit 520, a connection control unit 530, and a headphone posture detection unit 540.
A headphone state detection unit 510 for detecting whether the headphone is in a wearing state.
An audio output detection unit 520, configured to detect whether the electronic device connected to the headset is in an audio output state if the headset state detection unit 510 detects that the electronic device is in an unworn state.
A connection control unit 530, configured to disconnect the connection with the electronic device if the audio output detection unit 520 detects that the electronic device is not in the audio output state.
The connection control unit 530 is further configured to resume the connection with the electronic device if the earphone state detection unit 510 detects that the earphone is in the wearing state.
A headset posture detecting unit 540, configured to detect a posture of the headset.
As one way, the connection control unit 530 includes:
the first connection control unit 531 is configured to establish a first part of link with the electronic device after the headset posture detection unit 540 detects that the posture information of the headset in the unworn state meets a preset condition.
A second connection control unit 532, configured to complete a subsequent link connection of a second part based on the link of the first part to establish the connection with the electronic device if the headset state detection unit 510 detects that the headset is in the wearing state.
Wherein the preset condition comprises at least one of the following conditions: detecting that the earphone shakes excessively; detecting that the earphone has acceleration along a set direction; and detecting that the earphone has collided.
The first connection control unit 531 is further configured to, if it is detected that the headset is in an unworn state within a set time period after the first part of the links is established, disconnect the first part of the links by the headset state detection unit 510.
Referring to fig. 8, an audio device control apparatus 600 provided by the present application runs on an electronic device, and the apparatus 600 includes: a wearing state detection unit 610, an audio output detection unit 620, and a connection control unit 630.
A wearing state detection unit 610, configured to detect whether an earphone connected to the electronic device is in a wearing state.
An audio output detection unit 620, configured to detect whether the electronic device is in an audio output state if it is detected that the earphone is in an unworn state.
A connection control unit 630, configured to disconnect the connection if it is detected that the electronic device is not in an audio output state.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling. In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
In summary, according to the audio device control method and apparatus, the earphone and the electronic device provided by the application, by detecting whether the earphone is in a wearing state, if the earphone is detected to be in a non-wearing state, the electronic device connected with the earphone is detected to be in an audio output state, and when the electronic device is detected not to be in the audio output state, the electronic device is disconnected from the electronic device. Therefore, when the earphone is not worn and the electronic equipment is not in audio output, the connection between the earphone and the electronic equipment is disconnected, so that the electric quantity of the electronic equipment and the earphone can be saved, the earphone can be flexibly switched between a state of establishing connection with the electronic equipment and a state of not establishing connection with the electronic equipment, and the user experience is improved.
An electronic device provided by the present application will be described below with reference to fig. 9.
Referring to fig. 9, based on the audio device control method and apparatus, another electronic device 100 capable of executing the audio device control method is further provided in the embodiment of the present application. The electronic device 100 includes one or more processors 102 (only one shown), a memory 104, a wireless module 106, an audio module 108, a gesture sensing module 110, and a sound collection module 112 coupled to one another. The memory 104 stores programs that can execute the content of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104.
The Memory 104 may include a Random Access Memory (RAM) or a Read-only Memory (Read-only Memory). The memory 104 may be used to store instructions, programs, code sets, or instruction sets. The memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
The wireless module 106 is configured to receive and transmit electromagnetic waves, and achieve interconversion between the electromagnetic waves and the electrical signals, so as to communicate with a communication network or other devices, for example, an audio playing device. The wireless module 106 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The wireless module 106 may communicate with various networks, such as the internet, an intranet, a wireless network, or with other electronic devices via a wireless network. The wireless network may comprise a cellular telephone network, a wireless local area network, or a metropolitan area network. The wireless network described above may use various communication standards, protocols, and technologies, including but not limited to the IEEE 802 protocol and the bluetooth protocol, and may even include those that are not yet developed.
Furthermore, the audio module 108 can be used to process the audio obtained by the wireless module 106 from other electronic devices, and then play the processed audio.
The gesture sensing module 110 may be used to detect a gesture or acceleration of the electronic device 100.
The sound collection module 112 may collect external sound information. For example, external sound information may be collected and transmitted to the processor 102, so that the processor 102 detects whether the sound information includes the set sound content.
Referring to fig. 10, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 800 has stored therein a program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 800 includes a non-volatile computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (11)
1. An audio device control method applied to a headphone, the method comprising:
the earphone detects whether the earphone is in a wearing state;
if the earphone is detected to be in an unworn state, detecting whether the electronic equipment connected with the earphone is in an audio output state;
if the electronic equipment is detected not to be in the audio output state, disconnecting the electronic equipment from the connection;
after detecting that the posture information of the headset in the unworn state meets a preset condition, establishing a first part link with the electronic equipment;
and if the earphone is detected to be in a wearing state, completing the subsequent link connection of the second part based on the link of the first part so as to establish the connection with the electronic equipment.
2. The method of claim 1, wherein the step of detecting whether the electronic device connected to the headset is in an audio output state comprises:
detecting whether the currently running application program of the electronic equipment meets the set audio output condition;
and if the currently running application program is detected not to be in accordance with the set audio output condition, judging that the electronic equipment is not in an audio output state.
3. The method of claim 2, wherein the audio output conditions comprise:
the application is outputting audio;
the application program supports an audio output function;
or the application supports audio output functionality and is not in a mute state.
4. The method according to claim 1, wherein the preset condition comprises at least one of the following conditions:
detecting that the earphone shakes excessively;
detecting that the earphone has acceleration along a set direction; and
detecting that the earphone has collided.
5. The method of claim 1, wherein the step of detecting that the headset establishes the link with the electronic device after the posture information of the headset in the unworn state meets the preset condition further comprises:
and if the earphone is detected to be in an unworn state within a set time period after the link of the first part is established, disconnecting the link of the first part.
6. An audio device control method applied to an electronic device, the method comprising:
the electronic equipment detects whether an earphone connected with the electronic equipment is in a wearing state;
if the earphone is detected to be in an unworn state, detecting whether the electronic equipment is in an audio output state;
if the electronic equipment is detected not to be in an audio output state, disconnecting the connection;
after detecting that the posture information of the headset in the unworn state meets a preset condition, establishing a first part of link with the headset;
and if the earphone is detected to be in a wearing state, completing the subsequent link connection of the second part based on the link of the first part so as to establish the connection with the earphone.
7. An audio device control apparatus, operable with a headset, the apparatus comprising:
the earphone state detection unit is used for detecting whether the earphone is in a wearing state;
the audio output detection unit is used for detecting whether the electronic equipment which is connected with the earphone is in an audio output state or not if the earphone state detection unit detects that the electronic equipment is in an unworn state;
the connection control unit is used for disconnecting the connection with the electronic equipment if the audio output detection unit detects that the electronic equipment is not in the audio output state; after detecting that the posture information of the headset in the unworn state meets a preset condition, establishing a first part link with the electronic equipment; and if the earphone is detected to be in a wearing state, completing the subsequent link connection of the second part based on the link of the first part so as to establish the connection with the electronic equipment.
8. An audio device control apparatus, operable with an electronic device, the apparatus comprising:
a wearing state detection unit for detecting whether an earphone connected to the electronic device is in a wearing state;
the audio output detection unit is used for detecting whether the electronic equipment is in an audio output state or not if the earphone is detected to be in an unworn state;
the connection control unit is used for disconnecting the connection if the electronic equipment is detected not to be in an audio output state; after detecting that the posture information of the headset in the unworn state meets a preset condition, establishing a first part of link with the headset; and if the earphone is detected to be in a wearing state, completing the subsequent link connection of the second part based on the link of the first part so as to establish the connection with the earphone.
9. An electronic device comprising one or more processors and memory;
one or more programs stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-5.
10. An earphone comprising one or more processors and memory;
one or more programs stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of claim 6.
11. A computer-readable storage medium, having program code stored therein, wherein the program code when executed by a processor performs the method of any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811163064.8A CN109413527B (en) | 2018-09-30 | 2018-09-30 | Audio device control method and device, earphone and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811163064.8A CN109413527B (en) | 2018-09-30 | 2018-09-30 | Audio device control method and device, earphone and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109413527A CN109413527A (en) | 2019-03-01 |
CN109413527B true CN109413527B (en) | 2020-05-19 |
Family
ID=65466733
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811163064.8A Active CN109413527B (en) | 2018-09-30 | 2018-09-30 | Audio device control method and device, earphone and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109413527B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112437334A (en) * | 2020-11-10 | 2021-03-02 | 青岛海信传媒网络技术有限公司 | Display device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106506846A (en) * | 2016-11-22 | 2017-03-15 | 广东小天才科技有限公司 | Method and device for controlling audio playing state of terminal |
CN107683459A (en) * | 2015-06-05 | 2018-02-09 | 苹果公司 | Based on the state change of wearable device with communication equipment behavior |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103024193A (en) * | 2012-12-25 | 2013-04-03 | 北京百度网讯科技有限公司 | Mobile terminal and play control method and play control device for same |
CN104378493A (en) * | 2013-08-16 | 2015-02-25 | 联想(北京)有限公司 | Mode switching method and electronic device |
KR101687623B1 (en) * | 2015-06-15 | 2016-12-19 | 엘지전자 주식회사 | Wireless sound equipment |
CN108076209A (en) * | 2016-11-14 | 2018-05-25 | 中兴通讯股份有限公司 | Control the method and device of media file |
CN106791191A (en) * | 2017-02-07 | 2017-05-31 | 广东小天才科技有限公司 | Play control method and device |
-
2018
- 2018-09-30 CN CN201811163064.8A patent/CN109413527B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107683459A (en) * | 2015-06-05 | 2018-02-09 | 苹果公司 | Based on the state change of wearable device with communication equipment behavior |
CN106506846A (en) * | 2016-11-22 | 2017-03-15 | 广东小天才科技有限公司 | Method and device for controlling audio playing state of terminal |
Also Published As
Publication number | Publication date |
---|---|
CN109413527A (en) | 2019-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109413555B (en) | Audio output method and device, earphone and electronic equipment | |
CN109151212B (en) | Equipment control method and device and electronic equipment | |
CN109347581B (en) | Bluetooth headset connection method and device, electronic equipment and storage medium | |
CN109257732B (en) | Equipment control method and device and electronic equipment | |
CN109107158B (en) | Sound effect processing method and device, electronic equipment and computer readable storage medium | |
CN109413526B (en) | Earphone control method, earphone control device, electronic equipment and storage medium | |
CN108111977B (en) | Network scanning method, device, storage medium and electronic equipment | |
CN109151211B (en) | Voice processing method and device and electronic equipment | |
CN108650699B (en) | Network searching method of mobile terminal and mobile terminal | |
CN109547897B (en) | Wireless earphone connection method, device and system and wireless earphone box | |
US11425520B2 (en) | Method for detecting blocking of microphone and related products | |
CN108882210A (en) | Communication control method, ears wireless headset, communication equipment, system and medium | |
CN108012291B (en) | Rate control method, device, storage medium and electronic equipment | |
US11425519B2 (en) | Method for detecting blocking of microphone and related products | |
CN107613126B (en) | UART (Universal asynchronous receiver transmitter) and USB (Universal Serial bus) multiplexing circuit and mobile terminal | |
CN105246074A (en) | Method and device for establishing connections | |
CN109819489B (en) | Terminal calling method and terminal | |
US11617177B2 (en) | Beam failure recovery method and terminal | |
KR20210049585A (en) | Electronic device for providing communication service and method thereof | |
CN109814798B (en) | Ear return function control method and device and mobile terminal | |
CN109413527B (en) | Audio device control method and device, earphone and electronic device | |
CN108449787B (en) | Connection control method and device and electronic equipment | |
CN109151669B (en) | Earphone control method, earphone control device, electronic equipment and storage medium | |
CN109041141B (en) | Transmission link switching control method and related product | |
CN107431524A (en) | A kind of antenna allocation method and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |