Audio playing method and electronic equipment
By automatically switching the audio playback mode by detecting the direction of movement of the electronic device, the problem of low switching efficiency of audio playback mode in the prior art is solved, and more efficient audio playback mode switching and better user experience are achieved.
Patent Information
- Application Number
- CN202311428672.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2025-05-02
AI Technical Summary
In the prior art, the switching efficiency of the audio playback mode is low, especially when the user cannot operate manually, the switching of the audio playback mode cannot be completed.
Automatic switching between speaker mode and earphone mode is achieved by detecting the movement of the electronic device in a direction close to or away from the user's head.
It improves the switching efficiency of the audio playback mode, solves the problem of low switching efficiency caused by manual operation difficulties, and reduces volume changes during the switching process, improving the user experience.
Smart Images

Figure CN119922453A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic equipment, and in particular to an audio playback method and electronic equipment. Background Art
[0002] Currently, electronic devices (such as mobile phones) have two audio playback modes: receiver mode and speaker mode. For different audio playback scenarios, the electronic device may need to switch between the two audio playback modes. For example, when a user is holding something and a call comes in, the user needs to switch the receiver mode to the speaker mode to answer the call.
[0003] The existing switching method is mainly to switch through specific gestures (for example, the user clicks the speaker button in the call interface). However, since the user needs to operate manually, when the user cannot free his hands to operate (for example, while driving), the audio playback mode cannot be switched. It can be seen that the existing switching method has the problem of low switching efficiency. Summary of the invention
[0004] Embodiments of the present application provide an audio playback method and an electronic device for improving the switching efficiency of audio playback modes.
[0005] In a first aspect, an embodiment of the present application provides an audio playback method, which is applicable to an electronic device, and the method includes: receiving a playback instruction for a first audio; playing the first audio in a first audio playback mode, the first audio playback mode including a speaker mode or a receiver mode; detecting that the electronic device is moving in a direction closer to or away from a user's head; pausing playback of the first audio, or gradually reducing the volume of the first audio when played in the first audio playback mode, and playing the first audio in a second audio playback mode and gradually increasing the volume of the first audio when played in the second audio playback mode; wherein the second audio playback mode is different from the first audio playback mode.
[0006] In the above scheme, the electronic device can automatically switch the audio playback mode, which solves the problem of low efficiency caused by the need to manually switch the audio playback mode in the prior art. In addition, in an embodiment of the present application, the electronic device can adaptively adjust the audio playback state or audio playback volume when it is determined that the user has the intention to switch the audio playback mode (for example, the electronic device is close to or away from the user's head). For example, when switching the audio playback mode (for example, switching from the first audio playback mode to the second audio playback mode), pause the audio playback, or gradually reduce the volume of the audio when playing in the first audio playback mode and gradually reduce the volume of the audio when playing in the second audio playback mode, so that when switching the audio playback mode, the user experience will not be affected by the sudden change of the audio playback volume, and the user's needs are adapted.
[0007] In one possible implementation, the detecting that the electronic device is moving toward or away from the user's head includes: detecting that the electronic device is moving toward or away from the user's head at a first moment, the duration between the first moment and a second moment is less than a preset duration, and the second moment is the moment when the electronic device receives a play instruction for the first audio.
[0008] In this implementation, the electronic device can determine the user's intention, that is, whether the user is ready to switch the audio playback mode, based on whether the electronic device is detected moving in a direction closer to or away from the user's head at the first moment. For example, within 2 seconds after playing a voice message in speaker mode, if the electronic device is detected moving in a direction closer to the user's head, it can be determined that the user is ready to play the voice message in earpiece mode.
[0009] In one possible implementation, the first audio playback mode is a speaker mode, the second audio mode is a receiver mode, and the distance between the electronic device and the user's head is greater than a first distance; when it is detected that the electronic device is moving in a direction close to the user's head, the first audio is paused, or the volume of the first audio when played in the speaker mode is gradually reduced, and the first audio is played in the receiver mode and the volume of the first audio when played in the receiver mode is gradually increased.
[0010] In one possible implementation, the method further includes: when it is detected that the electronic device is moving in a direction away from the user's head, pausing the playing of the first audio, or gradually reducing the volume of the first audio when it is played in an earpiece mode, and playing the first audio in a speaker mode and gradually increasing the volume of the first audio when it is played in the speaker mode.
[0011] In this implementation, taking the example of an electronic device being away from the user's head and playing the first audio in speaker mode, when the electronic device gradually approaches the user's head, the electronic device can switch to receiver mode, that is, play the first audio in receiver mode, and the first audio can be paused when switching, or the volume of the first audio when played in speaker mode can be gradually reduced and the volume of the first audio when played in receiver mode can be gradually increased. When the electronic device approaches the user's head and then gradually moves away from the user's head again, the electronic device can switch to speaker mode again, that is, play the first audio in speaker mode, and the first audio can be paused when switching, or the volume of the first audio when played in receiver mode can be gradually reduced and the volume of the first audio when played in speaker mode can be gradually increased. Therefore, when switching the audio playback mode, the user experience will not be affected by the sudden change in the audio playback volume, and the user's needs are adapted.
[0012] In one possible implementation, the first audio playback mode is a speaker mode, the second audio mode is a receiver mode, and the distance between the electronic device and the user's head is less than the second distance; when it is detected that the electronic device is moving in a direction away from the user's head, the playback of the first audio is paused, or the volume of the first audio when played in the speaker mode is gradually increased.
[0013] In one possible implementation, the method further includes: when it is detected that the electronic device is moving in a direction close to the user's head, pausing the playing of the first audio, or gradually reducing the volume of the first audio when it is played in speaker mode, and playing the first audio in earpiece mode and gradually increasing the volume of the first audio when it is played in the earpiece mode.
[0014] In this implementation, taking the example of an electronic device approaching the user's head and playing the first audio in speaker mode, when the electronic device gradually moves away from the user's head, the electronic device may not switch to the receiver mode, that is, continue to play the first audio in speaker mode, but may pause playing the first audio, or may gradually increase the volume of the first audio when played in speaker mode. When the electronic device moves away from the user's head and gradually approaches the user's head again, the electronic device may switch to the receiver mode, that is, play the first audio in receiver mode, and may pause playing the first audio during the switch, or may gradually reduce the volume of the first audio when played in speaker mode and gradually increase the volume of the first audio when played in receiver mode. Therefore, when switching the audio playback mode, the user experience will not be affected by the sudden change in the audio playback volume, which meets the needs of the user.
[0015] In one possible implementation, the first audio playback mode is an earpiece mode, the second audio mode is a speaker mode, and the distance between the electronic device and the user's head is greater than the first distance; when it is detected that the electronic device is moving in a direction close to the user's head, the playback of the first audio is paused, or the volume of the first audio when played in the earpiece mode is gradually reduced.
[0016] In one possible implementation, the method further includes: when it is detected that the electronic device is moving in a direction away from the user's head, pausing the playing of the first audio, or gradually reducing the volume of the first audio when it is played in an earpiece mode, and playing the first audio in a speaker mode and gradually increasing the volume of the first audio when it is played in the speaker mode.
[0017] In this implementation, taking the electronic device being away from the user's head and playing the first audio in the handset mode as an example, when the electronic device gradually approaches the user's head, the electronic device may not switch to the speaker mode, that is, continue to play the first audio in the handset mode, but may pause playing the first audio, or may gradually reduce the volume of the first audio when played in the handset mode (or gradually increase the volume of the first audio when played in the handset mode, or keep the volume of the first audio when played in the handset mode unchanged). When the electronic device approaches the user's head and then gradually moves away from the user's head again, the electronic device may switch to the speaker mode, that is, play the first audio in the speaker mode, and may pause playing the first audio when switching, or may gradually reduce the volume of the first audio when played in the handset mode and gradually increase the volume of the first audio when played in the speaker mode. Therefore, when switching the audio playback mode, the user experience will not be affected by the sudden change in the audio playback volume, which adapts to the needs of the user.
[0018] In one possible implementation, the first audio playback mode is an earpiece mode, the second audio mode is a speaker mode, and the distance between the electronic device and the user's head is less than the second distance; when it is detected that the electronic device is moving in a direction away from the user's head, the playback of the first audio is paused, or the volume of the first audio when played in the earpiece mode is gradually reduced, and the first audio is played in the speaker mode and the volume of the first audio when played in the speaker mode is gradually increased.
[0019] In one possible implementation, the method further includes: when it is detected that the electronic device is moving in a direction close to the user's head, pausing the playing of the first audio, or gradually reducing the volume of the first audio when it is played in speaker mode, and playing the first audio in earpiece mode and gradually increasing the volume of the first audio when it is played in the earpiece mode.
[0020] In this implementation, taking the example of an electronic device approaching the user's head and playing the first audio in the handset mode, when the electronic device gradually moves away from the user's head, the electronic device can switch to the speaker mode, that is, play the first audio in the speaker mode, and the first audio can be paused when switching, or the volume of the first audio when played in the handset mode can be gradually reduced and the volume of the first audio when played in the speaker mode can be gradually increased. When the electronic device moves away from the user's head and gradually approaches the user's head again, the electronic device can switch to the handset mode again, that is, play the first audio in the handset mode, and the first audio can be paused when switching, or the volume of the first audio when played in the speaker mode can be gradually reduced and the volume of the first audio when played in the handset mode can be gradually increased. Therefore, when switching the audio playback mode, the user experience will not be affected by the sudden change of the audio playback volume, which adapts to the needs of the user.
[0021] In a possible implementation, after pausing the playing of the first audio, the method further includes: detecting that the distance between the electronic device and the user's head is greater than a third distance or less than a fourth distance, starting playing the first audio and playing the first audio in the second audio playing mode.
[0022] In this implementation, if the electronic device pauses playing the first audio before switching the audio playback mode, the electronic device detects that the electronic device has approached the user's head or has moved away from the user's head, starts playing the first audio and switches the audio playback mode, so that the user experience is not affected by pausing the audio after switching the audio playback mode.
[0023] In a possible implementation, the first audio includes at least one of an incoming call ringtone, multimedia audio, call voice, and a voice message.
[0024] In a possible implementation, the receiving of a play instruction for the first audio includes: receiving an incoming call; the playing of the first audio in the first audio play mode includes: playing the incoming call ringtone in the speaker mode; when detecting that the electronic device is moving in a direction close to the user's head, gradually reducing the volume of the incoming call ringtone when it is played in the speaker mode, and answering the call when determining that the distance between the electronic device and the user's head is less than a fourth distance, and playing the call voice in the receiver mode. In this implementation, the electronic device can answer the call without pressing a button.
[0025] In a second aspect, an embodiment of the present application further provides an audio playback device. The audio playback device has the function of implementing the behavior in the method embodiment described in the first aspect or any possible design of the first aspect. The audio playback device may be the electronic device described in the first aspect, or a functional module (such as a chip system) configured in the electronic device, or a larger device including the electronic device. The first device includes corresponding means (means) or modules for executing the above method. For example, the audio playback device may include a processing unit (sometimes also referred to as a processing module) and a transceiver unit (sometimes also referred to as a transceiver module).
[0026] Optionally, a processing unit is used to receive a playback instruction for a first audio; play the first audio in a first audio playback mode, the first audio playback mode including a speaker mode or a receiver mode; detect that the electronic device is moving toward or away from a user's head; pause playback of the first audio, or gradually reduce the volume of the first audio when played in the first audio playback mode, and play the first audio in a second audio playback mode and gradually increase the volume of the first audio when played in the second audio playback mode; wherein the second audio playback mode is different from the first audio playback mode.
[0027] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor, a memory, and one or more programs; wherein the one or more programs are stored in the memory, and the one or more programs include instructions, which, when executed by the processor, enable the electronic device to perform a method described in the first aspect or any possible design of the first aspect.
[0028] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which is used to store a computer program. When the computer program runs on a computer, the computer executes the method described in the first aspect or any possible design of the first aspect.
[0029] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program, which, when executed on a computer, enables the computer to execute the method described in the first aspect or any possible design of the first aspect.
[0030] In a sixth aspect, an embodiment of the present application also provides a chip system, comprising a processor and an interface, wherein the processor is used to call and run instructions from the interface so that the chip system executes a method described in the first aspect or any possible design of the first aspect.
[0031] The beneficial effects of the above-mentioned second to sixth aspects and possible designs thereof can refer to the description of the beneficial effects of the method described in the above-mentioned first aspect and any possible design thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0033] Figure 2 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0034] Figure 3A schematic diagram of an interface for starting audio playback provided in an embodiment of the present application;
[0035] Figure 4 A schematic diagram of an audio playback scenario provided in an embodiment of the present application;
[0036] Figure 5 A schematic diagram of another audio playback scenario provided in an embodiment of the present application;
[0037] Figure 6 A schematic diagram of another audio playback scenario provided in an embodiment of the present application;
[0038] Figure 7 A schematic diagram of another audio playback scenario provided in an embodiment of the present application;
[0039] Figure 8 A schematic diagram of a volume curve provided in an embodiment of the present application;
[0040] Fig. 9 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application;
[0041] Fig.10 A flowchart of an audio playback method provided in an embodiment of the present application;
[0042] Fig.11 A flowchart of another audio playback method provided in an embodiment of the present application;
[0043] Fig.12 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] Below, some terms in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0045] The at least one involved in the embodiments of the present application includes one or more; wherein, a plurality refers to greater than or equal to two. In addition, it should be understood that in the description of this specification, words such as "first" and "second" are only used for the purpose of distinguishing the description, and cannot be understood as an explicit or implicit relative importance, nor can they be understood as an explicit or implicit order. For example, the first operation and the second operation do not represent the importance of the two or the order of the two, but are only for distinguishing the description. In the embodiments of the present application, "and / or" is only a description of the association relationship, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated with each other are in an "or" relationship.
[0046] In the description of the embodiments of the present application, it should be noted that, unless otherwise clearly specified and limited, the terms "installation" and "connection" should be understood in a broad sense. For example, "connection" can be a detachable connection or a non-detachable connection; it can be a direct connection or an indirect connection through an intermediate medium. The directional terms mentioned in the embodiments of the present application, such as "upper", "lower", "left", "right", "inner", "outer", etc., are only referenced to the directions of the accompanying drawings. Therefore, the directional terms used are for better and clearer explanation and understanding of the embodiments of the present application, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present application.
[0047] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the specification. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0048] At present, general electronic devices (such as mobile phones) have two audio playback modes: receiver mode and speaker mode. In receiver mode, the user needs to put the receiver of the mobile phone close to the user's ear to hear the audio, while the speaker mode is just the opposite. The user does not need to put the receiver of the mobile phone close to the user's ear to hear the audio. The speaker mode is sometimes also called hands-free mode or external speaker mode. For different audio playback scenarios, electronic devices may need to switch from one audio playback mode to another. For example, when a user is holding something in his hand and there is an incoming call, he needs to switch the receiver mode to the speaker mode to answer the call. The existing method of switching audio playback modes is mainly to switch through specific gestures. However, since manual operation is required by the user, when the user cannot free his hands to operate (for example, while driving), the switching of the audio playback mode cannot be completed.
[0049] In view of this, an embodiment of the present application provides an audio playback method for improving the switching efficiency of the audio playback mode. In this method, the electronic device can automatically switch the audio playback mode, which solves the problem of low efficiency caused by the need to switch the audio playback mode by manual operation in the prior art. In addition, in an embodiment of the present application, the electronic device can adaptively adjust the audio playback state or the audio playback volume when it is determined that the user has the intention to switch the audio playback mode (for example, the electronic device is close to or away from the user's head), for example, when switching the audio playback mode (for example, switching from the first audio playback mode to the second audio playback mode), pause the audio playback, or gradually reduce the volume of the audio when playing in the first audio playback mode and gradually reduce the volume of the audio when playing in the second audio playback mode, so that when switching the audio playback mode, the user experience will not be affected due to the sudden change of the audio playback volume, and the user's needs are adapted.
[0050] The audio playback method provided in the embodiment of the present application is applicable to electronic devices. The electronic device has an audio playback function. In some embodiments, the electronic device can be a portable electronic device such as a mobile phone, a tablet computer, a laptop computer, etc.; it can also be a wearable device such as a watch or a bracelet; or it can also be a smart home device such as a television set or a refrigerator; or it can also be a car-mounted device, etc., or it can also be a virtual reality (VR) device, an augmented reality (AR) device, a mixed reality (MR) device, etc. In short, the embodiment of the present application does not limit the specific type of electronic device.
[0051] Figure 1 FIG. 1 shows a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. Figure 1As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, an earpiece 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0052] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Among them, different processing units may be independent devices or integrated into one or more processors. Among them, the controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. A memory may also be set in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a high-speed cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved. The execution of the audio playback method in the embodiment of the present application can be controlled by the processor 110 or called by other components to complete, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in the third-party device through the external memory interface 120, so that the electronic device 100 can automatically switch the audio playback mode, solving the problem of low efficiency caused by the need to switch the audio playback mode by manual operation in the prior art. In addition, in the embodiment of the present application, the electronic device 100 can adaptively adjust the audio playback state or the audio playback volume when determining that the user has the intention to switch the audio playback mode (for example, the electronic device 100 is close to or away from the user's head), for example, when switching the audio playback mode (for example, switching from the first audio playback mode to the second audio playback mode), pause the audio playback, or gradually reduce the volume of the audio when playing in the first audio playback mode and gradually reduce the volume of the audio when playing in the second audio playback mode, so that when switching the audio playback mode, the user experience will not be affected by the sudden change of the audio playback volume, and the user's needs are adapted.
[0053] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, and software code of at least one application (such as iQiyi application, WeChat application, etc.). The data storage area can store data (such as images, videos, etc.) generated during the use of the electronic device 100. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0054] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing files such as pictures and videos in the external memory card.
[0055] In some embodiments, the processor 110 may include one or more interfaces. The interface may include 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 USB interface 130, etc.
[0056] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0057] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0058] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0059] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0060] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0061] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0062] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0063] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0064] The wireless communication function of the electronic device 100 can be implemented by antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. For example, antenna 1 can be reused as a diversity antenna of a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0065] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0066] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering processing, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0067] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0068] The display screen 194 is used to display the display interface of the application, such as displaying the display page of the application installed on the electronic device 100. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0069] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor. Among them, ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0070] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0071] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio signals into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0072] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to external speaker scenarios such as hands-free calls through one or more speakers 170A.
[0073] The earpiece 170B, also called a "receiver", may be one or more and is used to convert an audio signal into a sound signal. When the electronic device 100 receives a call or a voice message, the voice can be received by placing the earpiece 170B close to the ear. Generally, the sound of the earpiece 170B is lower than the sound of the speaker 170A to ensure the privacy of the voice such as the call or the voice message.
[0074] In some embodiments, the speaker 170A and / or the receiver 170B may include a mono channel or multiple channels. In some embodiments, multiple channels are used to provide a stereo effect. In other embodiments, multiple channels can be merged. Taking dual channels as an example, the left channel and the right channel can play the same sound, which can increase the volume. One possible scenario is that when a user answers a call in a noisy place, the user cannot hear the caller's voice clearly due to the loud ambient sound. In this case, the user can turn on the "mono audio" function in the mobile phone, which can be used to merge multiple channels to increase the volume. Among them, there are many ways to turn on "mono audio", such as turning on the "mono audio" function in the settings application. In other embodiments, when the user answers a call in a noisy place, the "phone noise cancellation" function can also be activated. The "phone noise cancellation" function means that when answering a call through the speaker 170A or the receiver 170B, the mobile phone will use the noise reduction microphone on the back of the body to filter the surrounding noise, improve the clarity of the call, and thus improve the quality of the user's call. Among them, there are many ways to start the "Phone Noise Cancellation" function, such as voice wake-up or turning on the function in the Settings app.
[0075] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones to realize sound signal collection, noise reduction, and can also identify the sound source, realize directional recording function, etc.
[0076] The earphone interface 170D is used to connect a wired earphone, and the earphone interface may be a USB interface, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0077] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .
[0078] The gyro sensor 180B can be used to determine the motion posture of the electronic device. In some embodiments, the angular velocity of the electronic device around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting.
[0079] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0080] The magnetic sensor 180D includes a Hall sensor. The electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device is a flip phone, the electronic device can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0081] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in all directions (generally three axes). When the electronic device is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0082] The distance sensor 180F is used to measure the distance. The electronic device can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0083] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device emits infrared light outward through the light emitting diode. The electronic device uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device. When insufficient reflected light is detected, the electronic device can determine that there is no object near the electronic device. The electronic device can use the proximity light sensor 180G to detect when the user holds the electronic device close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0084] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device is in a pocket to prevent accidental touch.
[0085] The fingerprint sensor 180H is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0086] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device heats the battery 142 to avoid abnormal shutdown of the electronic device due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device boosts the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
[0087] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device, which is different from the position of the display screen 194.
[0088] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals of vibrating bones of the human body. The bone conduction sensor 180M can also contact the human body's pulse to receive blood pressure beating signals.
[0089] The button 190 includes a power button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The electronic device can receive the button input and generate a key signal input related to the user settings and function control of the electronic device. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device.
[0090] Understandably, Figure 1 The components shown do not constitute a specific limitation on the electronic device. The electronic device in the embodiment of the present invention may include Figure 1 In addition, Figure 1 The combination / connection relationship between the components can also be adjusted and modified.
[0091] Figure 2 FIG. 1 shows a schematic diagram of the software structure of the electronic device provided in the embodiment of the present application. Figure 2 As shown, the software structure of the electronic device can be a layered architecture, for example, the software can be divided into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the operating system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer (framework, FWK), the runtime (runtime) and the system library, and the kernel layer.
[0092] The application layer can include a series of application packages. Figure 2 As shown, the application layer may include camera, settings, skin module, user interface (UI), third-party applications, etc. Among them, the third-party applications may include gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0093] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer may include some predefined functions. Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager.
[0094] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make the data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0095] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0096] The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including answering, hanging up, etc.).
[0097] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0098] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0099] The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the operating system.
[0100] The core library consists of two parts: one is the function that the Java language needs to call, and the other is the core library of the operating system. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0101] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0102] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0103] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0104] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0105] A 2D graphics engine is a drawing engine for 2D drawings.
[0106] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0107] The hardware layer can include various types of sensors, such as accelerometers, gravity sensors, touch sensors, etc.
[0108] The following will combine the above Figure 1 The hardware architecture of the electronic device shown and Figure 2 The software architecture of the electronic device shown further introduces the audio playback method provided in the embodiment of the present application.
[0109] The execution process of the audio playback method provided in the embodiment of the present application includes at least two stages: starting audio playback and adjusting audio playback configuration. The methods of each stage are described in detail below.
[0110] 1. Start audio playback
[0111] In an embodiment of the present application, the electronic device may receive a play instruction for the first audio and play the first audio in the first audio play mode. The first audio may include but is not limited to one or more of the following: incoming call ringtone; multimedia audio (such as sound output by a music application, a video application, etc.); call voice; or voice message. The first audio play mode may include a speaker mode or a handset mode.
[0112] For example, the electronic device can receive an incoming call and play the incoming call ringtone in speaker mode or receiver mode. Figure 3 A schematic diagram of an interface for starting audio playback provided in an embodiment of the present application, such as Figure 3As shown, the electronic device can display two bubbles of voice messages on the display screen, namely, voice message 1 and voice message 2. The total duration of voice message 1 is 30 seconds, and the total duration of voice message 2 is 50 seconds. The user can start playing voice message 1 or voice message 2 by clicking on bubble 301 of voice message 1 or bubble 302 of voice message 2. When the electronic device detects the operation of the user clicking on bubble 301 of voice message 1, in response to the operation, the electronic device can play voice message 1 in speaker mode or receiver mode.
[0113] During the specific implementation process, the electronic device can determine the first audio playback mode according to the user's historical settings. For example, the user's historical settings are to play the incoming call ringtone in speaker mode when receiving an incoming call. Alternatively, the electronic device can also determine the first audio playback mode based on the distance between the electronic device and the user's head. For example, when the electronic device receives an incoming call, if it is detected that the distance between the electronic device and the user's head is greater than a first distance (for example, 30 cm), the incoming call ringtone is played in speaker mode. If it is detected that the distance between the electronic device and the user's head is less than a second distance (for example, 5 cm), the incoming call ringtone is played in receiver mode, wherein the first distance and the second distance can be default values, or can also be values set by the user as needed. The embodiments of the present application do not specifically limit this.
[0114] The volume of the first audio when the electronic device plays the first audio in the first audio playback mode can be the user's historical setting, for example, the first audio playback mode is the speaker mode, and the user's historical setting can be that the volume when playing the audio in the speaker mode is 50 decibels (dB). Alternatively, the volume of the first audio when the electronic device plays the first audio in the first audio playback mode can also be a default value, for example, the first audio playback mode is the speaker mode, and the default value can be the maximum volume or minimum volume when playing the audio in the speaker mode. The embodiments of the present application do not specifically limit this.
[0115] 2. Adjust audio playback configuration
[0116] In an embodiment of the present application, after the electronic device receives a play instruction for the first audio and plays the first audio in the first audio play mode, the electronic device can detect whether the electronic device moves toward or away from the user's head. After detecting that the electronic device moves toward or away from the user's head, the electronic device can adjust the audio play configuration. The audio play configuration includes one or more of the audio play state, the audio play volume, and the audio play mode.
[0117] In a possible implementation, after detecting at a first moment that the electronic device is moving toward or away from the user's head, the electronic device may adjust the audio playback configuration. The duration between the first moment and the second moment is less than a preset duration (e.g., 2 seconds, 3 seconds), and the second moment is the moment when the electronic device receives a play instruction for the first audio. The movement of the electronic device toward or away from the user's head may include the electronic device translating a third distance toward or away from the user's head and / or the electronic device rotating a first angle toward or away from the user's head. The third distance may be greater than a first threshold, for example, the first threshold may be 10 centimeters, and the first angle may be greater than a second threshold, for example, the second threshold may be 30 degrees. The first threshold and the second threshold may be default values, or may be values set by the user as needed, and the embodiments of the present application do not specifically limit this.
[0118] For example, the preset duration is 2 seconds. If within 2 seconds after the electronic device plays a voice message 1 in speaker mode or earpiece mode, it is detected that the electronic device is translated by 15 centimeters and / or rotated by 40 degrees in a direction close to or away from the user's head, due to the short detection time, the electronic device can determine that it is more likely that the user intends to adjust the audio playback configuration of playing the voice message 1, and the electronic device can adjust the audio playback configuration of playing the voice message 1; if within 10 seconds after the electronic device starts playing the voice message 1, it is detected that the electronic device is translated by 15 centimeters and / or rotated by 40 degrees in a direction close to or away from the user's head, due to the long detection time, the electronic device can determine that it is less likely that the user intends to adjust the audio playback configuration, and the electronic device may or may not adjust the audio playback configuration.
[0119] In a specific implementation process, if it is detected that the electronic device is moving in a direction close to or away from the user's head, the electronic device can pause playing the first audio (ie, adjust the audio playing state).
[0120] Among them, after the electronic device pauses playing the first audio, if it is detected that the distance between the electronic device and the user's head is greater than the third distance or less than the fourth distance, the electronic device can start playing the first audio and play the first audio in the second audio playback mode (i.e., adjust the audio playback state and the audio playback mode), wherein the second audio playback mode is different from the first audio playback mode. The third distance and the fourth distance can be default values, or can be values set by the user as needed, the third distance and the above-mentioned first distance can be different values, the fourth distance and the above-mentioned second distance can be different values, the third distance and the fourth distance can be the same value or different values, and the embodiments of the present application do not specifically limit this.
[0121] When the electronic device starts playing the first audio, it may continue to play the content that was not played by the first audio, or it may replay the first audio, which is not specifically limited in the embodiments of the present application. For example, after playing the voice message for 2 seconds, the electronic device pauses playing the voice message. When the electronic device starts playing the voice message again, it may continue to play the content after 2 seconds of the voice message, or it may replay the voice message from the 1st second of the voice message.
[0122] The volume of the first audio when the electronic device plays the second audio playback mode can be a user's historical setting, for example, the second audio playback mode is the handset mode, and the user's historical setting can be that the volume when playing the audio in the handset mode is 25dB. Alternatively, the volume of the first audio when the electronic device plays the second audio playback mode can also be a default value, for example, the second audio playback mode is the handset mode, and the default value can be the maximum volume or minimum volume when playing the audio in the handset mode. The embodiments of the present application do not specifically limit this.
[0123] Alternatively, if it is detected that the electronic device is moving in a direction closer to or away from the user's head, the electronic device may also gradually reduce the volume of the first audio when it is played in the first audio playback mode, and play the first audio in the second audio playback mode and gradually increase the volume of the first audio when it is played in the second audio playback mode (i.e., adjust the audio playback volume and the audio playback mode).
[0124] Among them, the electronic device switches from playing the first audio in the second audio playback mode to playing the first audio in the second audio playback mode only when it determines that the electronic device is close to the user's head, or, when the electronic device is close to the user's head, switches from playing the first audio in the second audio playback mode to playing the first audio in the second audio playback mode. The embodiment of the present application does not make specific limitations on this.
[0125] In one possible implementation, if the above-mentioned electronic device receives a play instruction for the first audio and plays the first audio in the first audio playback mode, that is, receives an incoming call and plays the incoming ringtone in the speaker mode, then when it is detected that the electronic device is moving in a direction close to the user's head, the electronic device can gradually reduce the volume of the incoming ringtone when it is played in the speaker mode (i.e., adjust the audio playback volume), and when it is determined that the distance between the electronic device and the user's head is less than a fourth distance, the call is connected, and the call voice is played in the handset mode (i.e., the audio playback mode is adjusted).
[0126] The following is a detailed description of the specific implementation of adjusting the audio playback configuration:
[0127] Scenario 1: Take the case where the first audio playback mode is the speaker mode, the second audio mode is the receiver mode, and the distance between the electronic device and the user's head is greater than the first distance. When the electronic device plays the first audio in the speaker mode, if it is detected that the electronic device is moving in a direction close to the user's head, the electronic device may pause playing the first audio, or the electronic device may gradually reduce the volume of the first audio when it is played in the speaker mode, and play the first audio in the receiver mode with the volume gradually increasing when the first audio is played in the receiver mode. If it is further detected that the electronic device is moving in a direction away from the user's head, the electronic device may pause playing the first audio, or the electronic device may gradually reduce the volume of the first audio when it is played in the receiver mode, and play the first audio in the speaker mode with the volume gradually increasing when the first audio is played in the speaker mode.
[0128] For example, Figure 4 The present application embodiment provides a schematic diagram of an audio playback scenario, such as Figure 4 As shown, the mobile phone is far away from the user's head, and the mobile phone plays a voice message in speaker mode. When the mobile phone gradually approaches the user's head, the mobile phone can switch to receiver mode, that is, play the voice message in receiver mode, and the voice message can be paused when switching, or the volume of the voice message when playing in speaker mode can be gradually reduced, and the volume of the voice message when playing in receiver mode can be gradually increased. When the mobile phone approaches the user's head and then gradually moves away from the user's head again, the mobile phone can switch to speaker mode again, that is, play the voice message in speaker mode, and the voice message can be paused when switching, or the volume of the voice message when playing in receiver mode can be gradually reduced, and the volume of the voice message when playing in speaker mode can be gradually increased.
[0129] Scenario 2: Take the first audio playback mode as the speaker mode, the second audio mode as the receiver mode, and the distance between the electronic device and the user's head as less than the second distance as an example. When the electronic device plays the first audio in the speaker mode, if it is detected that the electronic device is moving in a direction away from the user's head, the electronic device may pause playing the first audio, or the electronic device may gradually increase the volume of the first audio when it is played in the speaker mode. If it is further detected that the electronic device is moving in a direction close to the user's head, the electronic device may pause playing the first audio, or gradually reduce the volume of the first audio when it is played in the speaker mode, and play the first audio in the receiver mode with the volume of the first audio gradually increasing when it is played in the receiver mode.
[0130] For example, Figure 5 A schematic diagram of another audio playback scenario provided in an embodiment of the present application, such as Figure 5As shown, the mobile phone is close to the user's head, and the mobile phone plays a voice message in speaker mode. When the mobile phone gradually moves away from the user's head, the mobile phone may not switch to receiver mode, that is, continue to play the voice message in speaker mode, but may pause playing the voice message, or gradually increase the volume of the voice message when playing in speaker mode. When the mobile phone moves away from the user's head and gradually approaches the user's head again, the mobile phone may switch to receiver mode, that is, play the voice message in receiver mode, and may pause playing the voice message when switching, or gradually reduce the volume of the voice message when playing in speaker mode, and gradually increase the volume of the voice message when playing in receiver mode.
[0131] Scenario three: Take the case where the first audio playback mode is the handset mode, the second audio mode is the speaker mode, and the distance between the electronic device and the user's head is greater than the first distance. When the electronic device plays the first audio in the handset mode, if it is detected that the electronic device is moving in a direction close to the user's head, the electronic device may pause playing the first audio, or gradually reduce the volume of the first audio when it is played in the handset mode (or gradually increase the volume of the first audio when it is played in the handset mode, or keep the volume of the first audio when it is played in the handset mode unchanged). If it is further detected that the electronic device is moving in a direction away from the user's head, the electronic device may pause playing the first audio, or gradually reduce the volume of the first audio when it is played in the handset mode, and play the first audio in the speaker mode with the volume of the first audio gradually increasing when it is played in the speaker mode.
[0132] For example, Figure 6 A schematic diagram of another audio playback scenario provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the mobile phone is far away from the user's head, and the mobile phone plays the voice message in the handset mode. When the mobile phone gradually approaches the user's head, the mobile phone may not switch to the speaker mode, that is, continue to play the voice message in the handset mode, but may pause playing the voice message, or may gradually reduce the volume of the voice message when playing in the handset mode (or gradually increase the volume of the voice message when playing in the handset mode, or keep the volume of the voice message when playing in the handset mode unchanged). When the mobile phone approaches the user's head and then gradually moves away from the user's head again, the mobile phone may switch to the speaker mode, that is, play the voice message in the speaker mode, and may pause playing the voice message when switching, or may gradually reduce the volume of the voice message when playing in the handset mode, and gradually increase the volume of the voice message when playing in the speaker mode.
[0133] Scenario 4: Take the case where the first audio playback mode is the handset mode, the second audio mode is the speaker mode, and the distance between the electronic device and the user's head is less than the second distance. When the electronic device plays the first audio in the handset mode, if it is detected that the electronic device is moving in a direction away from the user's head, the electronic device may pause the first audio, or gradually reduce the volume of the first audio when it is played in the handset mode, and play the first audio in the speaker mode with the volume gradually increasing when the first audio is played in the speaker mode. If it is further detected that the electronic device is moving in a direction close to the user's head, the electronic device may pause the first audio, or gradually reduce the volume of the first audio when it is played in the speaker mode, and play the first audio in the handset mode with the volume gradually increasing when the first audio is played in the handset mode.
[0134] For example, Figure 7 A schematic diagram of another audio playback scenario provided in an embodiment of the present application is shown as follows: Figure 7 As shown, the mobile phone is close to the user's head, and the mobile phone plays a voice message in the handset mode. When the mobile phone gradually moves away from the user's head, the mobile phone can switch to the speaker mode, that is, play the voice message in the speaker mode, and the voice message can be paused when switching, or the volume of the voice message when playing in the handset mode can be gradually reduced, and the volume of the voice message when playing in the speaker mode can be gradually increased. When the mobile phone moves away from the user's head and gradually approaches the user's head again, the mobile phone can switch to the handset mode again, that is, play the voice message in the handset mode, and the voice message can be paused when switching, or the volume of the voice message when playing in the speaker mode can be gradually reduced, and the volume of the voice message when playing in the handset mode can be gradually increased.
[0135] The specific implementation of gradually reducing or increasing the volume of the first audio when it is played in the speaker mode and gradually increasing or decreasing the volume of the first audio when it is played in the earpiece mode is described in detail below with reference to specific examples:
[0136] In the above-mentioned scenarios 1, 2, 3 and 4, after the electronic device detects that the electronic device is moving toward or away from the user's head, the volume of the first audio when played in speaker mode is gradually reduced or increased. It can be understood that the volume of the first audio when played in speaker mode will change with the change of the movement trajectory of the electronic device. Similarly, the volume of the first audio when played in earpiece mode is gradually increased or decreased. It can be understood that the volume of the first audio when played in earpiece mode and the volume of the first audio when played in earpiece mode will change with the change of the movement trajectory of the electronic device.
[0137] Wherein, when gradually increasing or gradually decreasing the volume of the first audio when it is played in speaker mode or handset mode, the target volume of the first audio when it is played in speaker mode or handset mode can be the user's historical setting. For example, the user's historical setting can be that the volume when playing audio in handset mode is 25dB, when gradually increasing the volume of the first audio when it is played in handset mode, the starting volume of the first audio when it is played in handset mode is 0dB, and as the volume gradually increases, the target volume of the first audio when it is played in handset mode is 25dB. Alternatively, the target volume of the first audio when it is played in speaker mode or handset mode can also be a default value. For example, the minimum volume when playing audio in speaker mode is 30dB, when gradually increasing the volume of the first audio when it is played in speaker mode, the starting volume of the first audio when it is played in speaker mode is 0dB, and as the volume gradually increases, the target volume of the first audio when it is played in speaker mode is 30dB. The embodiments of the present application do not specifically limit this.
[0138] In a specific implementation, the corresponding relationship between the volume of the first audio when played in the speaker mode and the volume of the first audio when played in the earpiece mode and the motion trajectory of the electronic device can be the following Table 1:
[0139]
[0140] Table 1
[0141] Among them, in the above Table 1, the movement trajectory of the electronic device includes 6 positions as an example, namely from position 1 to position 2, position 2 to position 3, position 3 to position 4, position 4 to position 5 and position 5 to position 6. It should be understood that the movement trajectory of the electronic device can also include more or fewer positions, and the number of positions included in the movement trajectory of the electronic device can be a default value, or can also be a value set by the user as needed, and the embodiment of the present application does not specifically limit this. As the electronic device moves between any two positions, the volume of the first audio when played in the speaker mode will gradually decrease or increase, and the volume of the first audio when played in the earpiece mode will gradually increase or decrease.
[0142] In the above Table 1, it is taken as an example that the difference between the volumes of the first audio corresponding to two adjacent positions when played in the speaker mode or the receiver mode is equal. For example, the difference between the volumes of the first audio corresponding to two adjacent positions when played in speaker mode or receiver mode is 5dB, that is, the starting position of the electronic device is position 1, and the destination position is position 2. When the electronic device gradually moves from position 1 to position 2, the movement trajectory of the electronic device is from position 1 to position 2. The volume of the first audio when played in speaker mode can be gradually increased by 5dB and the volume of the first audio when played in receiver mode can be gradually decreased by 5dB, or the volume of the first audio when played in speaker mode can be gradually decreased by 5dB and the volume of the first audio when played in receiver mode can be gradually increased by 5dB; after the electronic device gradually moves from position 1 to position 2, the initial position of the electronic device becomes position 2, and the destination position becomes position 3. When the electronic device gradually moves from position 2 to position 3, the movement trajectory of the electronic device becomes position 2 to position 3. The volume of the first audio when played in speaker mode can be gradually increased by 5dB and the volume of the first audio when played in receiver mode can be gradually decreased by 5dB, or the volume of the first audio when played in speaker mode can be gradually decreased by 5dB and the volume of the first audio when played in receiver mode can be gradually increased by 5dB.
[0143] It should be understood that the difference between the volumes of the first audio corresponding to two adjacent positions when played in speaker mode or receiver mode may not be equal, for example, the difference between the volumes of the first audio corresponding to position 1 and position 2 when played in speaker mode or receiver mode is 4dB, the difference between the volumes of the first audio corresponding to position 2 and position 3 when played in speaker mode or receiver mode is 6dB, and so on, which is not limited in the embodiments of the present application. Among them, the difference between the volumes of the first audio corresponding to two adjacent positions when played in speaker mode or receiver mode may be related to the volume of the first audio when played in speaker mode or receiver mode before the electronic device moves (i.e., the starting volume of the first audio when played in speaker mode or receiver mode), the volume of the first audio when played in speaker mode or receiver mode after the electronic device moves (i.e., the target volume of the first audio when played in speaker mode or receiver mode), and the number of positions included in the movement trajectory of the electronic device. For example, before the electronic device moves, the starting volume of the first audio when played in the speaker mode is 25dB, and after the electronic device moves, the target volume of the first audio when played in the speaker mode is 0dB. The number of positions included in the movement trajectory of the electronic device is 6. Then the volume difference of the first audio when played in the speaker mode corresponding to two adjacent positions can be equal, which is 25dB / 5=5dB, or, the volume difference of the first audio when played in the speaker mode corresponding to two adjacent positions can also be unequal, which are 7dB, 6dB, 5dB, 4dB, and 3dB respectively, so that when the electronic device moves from position 1 to position 2, position 2 to position 3, position 3 to position 4, position 4 to position 5, and position 5 to position 6, the volume of the first audio when played in the speaker mode can gradually decrease from 25dB to 0dB.
[0144] It should be understood that the corresponding relationship between the volume of the first audio when played in the speaker mode and the volume of the first audio when played in the earpiece mode and the motion trajectory of the electronic device can be in the form of a function or a curve, etc. in addition to the form of Table 1. For example, the corresponding relationship between the volume of the first audio when played in the speaker mode or the earpiece mode and the motion trajectory of the electronic device can be respectively as follows: Figure 8 The volume curve 1 and volume curve 2 are shown in (1), wherein the volume curve 1 and volume curve 2 are located in an XY coordinate system, X represents position, Y represents volume value (in dB as an example), volume curve 1 takes the example that the volume of the first audio played in speaker mode gradually increases as the electronic device moves between any two positions, and volume curve 2 takes the example that the volume of the first audio played in earpiece mode gradually decreases as the electronic device moves between any two positions. Alternatively, the correspondence between the volume of the first audio played in speaker mode or earpiece mode and the movement trajectory of the electronic device can be respectively as follows: Figure 8 The volume curve 3 and the volume curve 4 are shown in (2), wherein the volume curve 3 and the volume curve 4 are located in an XY coordinate system, X represents the position, and Y represents the volume value (in dB as an example). The volume curve 3 takes the example that the volume of the first audio played in the earpiece mode will gradually increase as the electronic device moves between any two positions, and the volume curve 4 takes the example that the volume of the first audio played in the speaker mode will gradually decrease as the electronic device moves between any two positions.
[0145] exist Figure 8 (1) and Figure 8 In the embodiment shown in (2), the difference between the volumes of the first audio corresponding to two adjacent positions when played in speaker mode or earpiece mode may be related to the volume of the first audio when played in speaker mode or earpiece mode before the electronic device moves (i.e., the starting volume of the first audio when played in speaker mode or earpiece mode), the volume of the first audio when played in speaker mode or earpiece mode after the electronic device moves (i.e., the target volume of the first audio when played in speaker mode or earpiece mode), and the number of positions included in the movement trajectory of the electronic device. Taking the example that the difference between the volumes of the first audio corresponding to two adjacent positions when played in speaker mode or earpiece mode is equal, Figure 8 As shown in (1), before the electronic device moves, the starting volume of the first audio when played in the speaker mode is 0 dB and the starting volume of the first audio when played in the earpiece mode is 30 dB. The number of positions included in the movement trajectory of the electronic device is 7 (for example, position 0-position 6). Then, the difference between the volumes of the first audio when played in the speaker mode or the earpiece mode corresponding to two adjacent positions is 30 dB / 6=5 dB. Figure 8 As shown in (2), before the electronic device moves, the starting volume of the first audio when played in the earpiece mode is 0dB and the starting volume of the first audio when played in the speaker mode is 30dB. The number of positions included in the movement trajectory of the electronic device is 7 (for example, position 0-position 6). The difference between the volumes of the first audio when played in the speaker mode or the earpiece mode corresponding to two adjacent positions is 30dB / 6=5dB. It should be understood that in other embodiments, the difference between the volumes of the first audio when played in the speaker mode or the earpiece mode corresponding to two adjacent positions may not be equal, and the embodiments of the present application are not limited thereto. Figure 8 (1) and Figure 8 In the embodiment shown in (2), the volume curve 1 and the volume curve 2 are taken as a straight line for example. It should be understood that in other embodiments, the volume curve 1 and the volume curve 2 can also be curved lines with a certain curvature, which is not limited in the embodiment of the present application.
[0146] In a specific implementation, the speaker and the earpiece of the electronic device may be independent. For example, the electronic device may include a speaker 1 and an earpiece 1, or the speaker and the earpiece of the electronic device may not be independent. Fig. 9 As shown, the electronic device may include a speaker 2 and a speaker 3, the speaker 2 having a speaker mode and an earpiece mode, the speaker 3 having a speaker mode, wherein the lowest volume of the speaker mode of the speaker 2 is higher than the highest volume of the earpiece mode. It can be understood that when the volume of the audio played by the speaker 2 is 0dB to 25dB, the speaker 2 is in the earpiece mode, and when the volume of the audio played by the speaker 2 is greater than 25dB, the speaker 2 is in the speaker mode.
[0147] If the speaker and the earpiece of the electronic device are not independent, that is, the electronic device includes a speaker 2 and a speaker 3, then the above-mentioned gradually increasing the volume of the first audio when it is played in the speaker mode and gradually decreasing the volume of the first audio when it is played in the earpiece mode can be understood as gradually increasing the volume of the first audio played by the speaker 2 to the speaker mode of the speaker 2, and gradually increasing the volume of the first audio played by the speaker 3. The above-mentioned gradually decreasing the volume of the first audio when it is played in the speaker mode and gradually increasing the volume of the first audio when it is played in the earpiece mode can be understood as gradually decreasing the volume of the first audio played by the speaker 2 to the earpiece mode, and gradually decreasing the volume of the first audio played by the speaker 3.
[0148] For example, as mentioned above Figure 4 As shown, the mobile phone is away from the user's head, and the mobile phone plays voice messages in the speaker mode of speaker 2 and speaker 3. The starting volume of the mobile phone playing voice messages is as follows: the volume of the voice message played in the speaker mode of speaker 2 is 45dB and the volume of the voice message played by speaker 3 is 25dB.
[0149] When the mobile phone gradually approaches the user's head, the mobile phone can switch to the handset mode of speaker 2 as the movement trajectory of the mobile phone changes, that is, the voice message is played in the handset mode of speaker 2, and the volume of the voice message played in speaker 2 and speaker 3 can be gradually reduced during the switch. The target volume of the voice message played by the mobile phone is: the volume of the voice message played in the handset mode of speaker 2 is 20dB and the volume of the voice message played by speaker 3 is 0dB (taking the user's historical setting as an example), and the movement trajectory of the mobile phone includes 6 positions as an example. When the mobile phone gradually moves from position 1 to position 2, the volume of the voice message played by speaker 2 and speaker 3 gradually decreases by 5dB, so that when the mobile phone reaches position 2, the volume of the voice message played by speaker 2 becomes 40dB and the volume of the voice message played by speaker 3 becomes 20dB; when the mobile phone gradually moves from position 2 to position 3, the volume of the voice message played by speaker 2 and speaker 3 gradually decreases by 5dB, so that when the mobile phone reaches position 3, the volume of the voice message played by speaker 2 becomes 35dB and the volume of the voice message played by speaker 3 becomes 15dB; and so on, when the mobile phone reaches position 6, the volume of the voice message played by speaker 2 becomes 20dB and the volume of the voice message played by speaker 3 becomes 0dB.
[0150] When the mobile phone approaches the user's head and then gradually moves away from the user's head again, the mobile phone can switch to the speaker mode of speaker 2 and speaker 3 again, that is, the voice message is played in the speaker mode of speaker 2 and speaker 3, and the volume of the voice message played in speaker 2 and speaker 3 can be gradually increased during the switching. The target volume of the mobile phone playing the voice message is: the volume of the voice message played in the handset mode of speaker 2 is 45dB and the volume of the voice message played in speaker 3 is 25dB (taking the user's historical setting as an example), and the movement trajectory of the mobile phone includes 6 positions as an example. When the mobile phone gradually moves from position 6 to position 5, the volume of the voice message played by speaker 2 and speaker 3 gradually increases by 5dB, so that when the mobile phone reaches position 5, the volume of the voice message played by speaker 2 becomes 25dB and the volume of the voice message played by speaker 3 becomes 5dB; when the mobile phone gradually moves from position 5 to position 4, the volume of the voice message played by speaker 2 and speaker 3 gradually increases by 5dB, so that when the mobile phone reaches position 3, the volume of the voice message played by speaker 2 becomes 30dB and the volume of the voice message played by speaker 3 becomes 10dB; and so on, when the mobile phone reaches position 1, the volume of the voice message played by speaker 2 becomes 45dB and the volume of the voice message played by speaker 3 becomes 25dB.
[0151] Based on the above embodiments, the electronic device can automatically switch the audio playback mode, which solves the problem of low efficiency caused by the need to manually switch the audio playback mode in the prior art. In addition, in the embodiments of the present application, the electronic device can adaptively adjust the audio playback state or audio playback volume when it is determined that the user has the intention to switch the audio playback mode (for example, the electronic device is close to or away from the user's head), for example, when switching the audio playback mode (for example, switching from the first audio playback mode to the second audio playback mode), pause the audio playback, or gradually reduce the volume of the audio when playing in the first audio playback mode and gradually reduce the volume of the audio when playing in the second audio playback mode, so that when switching the audio playback mode, the user experience will not be affected by the sudden change of the audio playback volume, and the user's needs are adapted.
[0152] Based on the above embodiments and the same concept, the present application also provides an audio playback method. The method can be Figure 1-Figure 2 The electronic device shown performs.
[0153] Fig.10 A flowchart of an audio playback method provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the electronic device can start playing the first audio. For details about the way in which the electronic device starts playing the first audio, please refer to the description in "1. Start audio playback", which will not be repeated here. After starting to play the first audio, the electronic device can also determine whether it has detected that the electronic device is moving in a direction close to or away from the user's head. If the electronic device is detected to be moving in a direction close to or away from the user's head, the electronic device can adjust the audio playback configuration of the first audio; if the electronic device is not detected to be moving in a direction close to or away from the user's head, the electronic device may not adjust the audio playback configuration of the first audio. If the electronic device detects that the electronic device is moving in a direction close to or away from the user's head, the way to adjust the audio playback configuration of the first audio is described in "2. Adjust audio playback configuration", which will not be repeated here.
[0154] Fig.11 A flowchart of another audio playback method provided in an embodiment of the present application. Fig.11 , the method comprises the following steps:
[0155] S1101: Receive a play instruction for a first audio.
[0156] S1102: Play the first audio in the first audio playback mode.
[0157] The first audio playback mode includes a speaker mode or a handset mode. The S1101 and S1102 may be specifically described in “1. Starting audio playback” and will not be described in detail here.
[0158] S1103: Detecting that the electronic device is moving toward or away from the user's head.
[0159] S1104: Pause the playing of the first audio, or gradually reduce the volume of the first audio when it is played in the first audio playing mode, and play the first audio in the second audio playing mode and gradually increase the volume of the first audio when it is played in the second audio playing mode.
[0160] The second audio playback mode is different from the first audio playback mode. For details of S1103 and S1104, please refer to the description in “II. Adjusting the audio playback configuration”, which will not be repeated here.
[0161] It should be noted that the specific implementation process provided in the above example is only an example of the method process applicable to the embodiment of the present application. The execution order of each step can be adjusted accordingly according to actual needs, and other steps can be added or some steps can be reduced.
[0162] Based on the above embodiments and the same concept, an embodiment of the present application further provides an electronic device, which is used to implement the method performed by the electronic device provided in the embodiment of the present application.
[0163] like Fig.12 As shown, the electronic device 1200 may include: a memory 1201, one or more processors 1202, and one or more computer programs (not shown in the figure). The above-mentioned devices may be coupled via one or more communication buses 1203. Optionally, when the electronic device 1200 is used to implement the method performed by the electronic device provided in the embodiment of the present application, the electronic device 1200 may also include a display screen 1204.
[0164] The memory 1201 stores one or more computer programs (codes), and the one or more computer programs include computer instructions; the one or more processors 1202 call the computer instructions stored in the memory 1201, so that the electronic device 1200 executes the audio playback method provided in the embodiment of the present application. The display screen 1204 is used to display images, videos, application interfaces and other related user interfaces.
[0165] In a specific implementation, the memory 1201 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices or other non-volatile solid-state storage devices. The memory 1201 may store an operating system (hereinafter referred to as system), such as an embedded operating system such as ANDROID, IOS, WINDOWS, or LINUX. The memory 1201 may be used to store the implementation program of the embodiment of the present application. The memory 1201 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more user devices, and one or more network devices. One or more processors 1202 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0166] It should be noted that Fig.12 This is only one implementation of the electronic device 1200 provided in the embodiment of the present application. In actual applications, the electronic device 1200 may also include more or fewer components, which is not limited here.
[0167] Based on the above embodiments and the same concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the computer executes the method performed by the electronic device in the method provided in the above embodiment.
[0168] Based on the above embodiments and the same concept, an embodiment of the present application also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the computer executes the method performed by the electronic device in the method provided in the above embodiments.
[0169] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0170] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0171] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0172] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0173] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An audio playback method, characterized in that: Used in electronic equipment, including: Receiving a play instruction for the first audio; Play the first audio in a first audio playback mode, where the first audio playback mode includes a speaker mode or a receiver mode; Detecting that the electronic device moves toward or away from the user's head; Pause the first audio, or gradually reducing the volume of the first audio when it is played in the first audio playback mode, and playing the first audio in the second audio playback mode and gradually increasing the volume of the first audio when it is played in the second audio playback mode; The second audio playback mode is different from the first audio playback mode.
2. The method according to claim 1, characterized in that The detecting that the electronic device moves toward or away from the user's head includes: At a first moment, it is detected that the electronic device moves towards or away from the user's head, the duration between the first moment and the second moment is less than a preset duration, and the second moment is the moment when the electronic device receives a play instruction for the first audio.
3. The method according to claim 1 or 2, characterized in that: The first audio playback mode is a speaker mode, the second audio mode is a receiver mode, and the distance between the electronic device and the user's head is greater than the first distance; When it is detected that the electronic device is moving in a direction close to the user's head, the first audio is paused, or the volume of the first audio when played in speaker mode is gradually reduced, and the first audio is played in earpiece mode and the volume of the first audio when played in the earpiece mode is gradually increased.
4. The method according to claim 3, characterized in that The method further comprises: When it is detected that the electronic device is moving in a direction away from the user's head, the first audio is paused, or the volume of the first audio when played in the earpiece mode is gradually reduced, and the first audio is played in the speaker mode and the volume of the first audio when played in the speaker mode is gradually increased.
5. The method according to claim 1 or 2, characterized in that: The first audio playback mode is a speaker mode, the second audio mode is a receiver mode, and the distance between the electronic device and the user's head is less than a second distance; When it is detected that the electronic device moves in a direction away from the user's head, the playing of the first audio is paused, or the volume of the first audio when played in speaker mode is gradually increased.
6. The method according to claim 5, characterized in that The method further comprises: When it is detected that the electronic device is moving in a direction close to the user's head, the first audio is paused, or the volume of the first audio when played in speaker mode is gradually reduced, and the first audio is played in earpiece mode and the volume of the first audio when played in the earpiece mode is gradually increased.
7. The method according to claim 1 or 2, characterized in that: The first audio playback mode is a handset mode, the second audio mode is a speaker mode, and the distance between the electronic device and the user's head is greater than the first distance; When it is detected that the electronic device moves toward a direction close to the user's head, the playing of the first audio is paused, or the volume of the first audio when played in the earpiece mode is gradually reduced.
8. The method according to claim 7, characterized in that The method further comprises: When it is detected that the electronic device is moving in a direction away from the user's head, the first audio is paused, or the volume of the first audio when played in the earpiece mode is gradually reduced, and the first audio is played in the speaker mode and the volume of the first audio when played in the speaker mode is gradually increased.
9. The method according to claim 1 or 2, characterized in that: The first audio playback mode is a handset mode, the second audio mode is a speaker mode, and the distance between the electronic device and the user's head is less than a second distance; When it is detected that the electronic device is moving in a direction away from the user's head, the first audio is paused, or the volume of the first audio when played in the earpiece mode is gradually reduced, and the first audio is played in the speaker mode and the volume of the first audio when played in the speaker mode is gradually increased.
10. The method according to claim 9, characterized in that The method further comprises: When it is detected that the electronic device is moving in a direction close to the user's head, the first audio is paused, or the volume of the first audio when played in speaker mode is gradually reduced, and the first audio is played in earpiece mode and the volume of the first audio when played in the earpiece mode is gradually increased.
11. The method according to any one of claims 1 to 10, characterized in that: After pausing the playing of the first audio, the method further includes: It is detected that the distance between the electronic device and the user's head is greater than the third distance or less than the fourth distance, and the first audio is started to be played and the first audio is played in the second audio playback mode.
12. The method according to any one of claims 1 to 11, characterized in that: The first audio includes at least one of an incoming call ringtone, multimedia audio, call voice, and voice message.
13. The method according to any one of claims 1 to 12, characterized in that: The receiving of a play instruction for the first audio includes: receiving an incoming call; Playing the first audio in the first audio playback mode includes: playing an incoming call ringtone in a speaker mode; When it is detected that the electronic device is moving in a direction close to the user's head, the volume of the incoming call ringtone when played in the speaker mode is gradually reduced, and when it is determined that the distance between the electronic device and the user's head is less than a fourth distance, the call is answered and the call voice is played in the handset mode.
14. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and one or more programs; The one or more programs are stored in the memory, and the one or more programs include instructions, and when the instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-13.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 13.