WO2023116768A1 - Audio playback method and related apparatus - Google Patents

Audio playback method and related apparatus Download PDF

Info

Publication number
WO2023116768A1
WO2023116768A1 PCT/CN2022/140714 CN2022140714W WO2023116768A1 WO 2023116768 A1 WO2023116768 A1 WO 2023116768A1 CN 2022140714 W CN2022140714 W CN 2022140714W WO 2023116768 A1 WO2023116768 A1 WO 2023116768A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
electronic device
audio
window
playing
Prior art date
Application number
PCT/CN2022/140714
Other languages
French (fr)
Chinese (zh)
Inventor
宋孟
李洪江
庾能国
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023116768A1 publication Critical patent/WO2023116768A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output
    • G06F3/167Audio in a user interface, e.g. using voice commands for navigating, audio feedback
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/16Sound input; Sound output
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Definitions

  • the technical field of audio processing of the present application in particular, relates to an audio playback method and related devices.
  • many electronic devices can smoothly play the audio files in the application when only one audio application is running, but when multiple audio applications of different types are running together, although they can all be played normally , but multiple applications of different types output different audio files at the same time, which may interfere with each other and bring confusion to the user.
  • the present application provides an audio playback method and a related device, which realize the output of one and only one audio file at the same time, avoid confusion caused by simultaneous output of multiple audio channels due to sound mixing, and improve user experience.
  • the present application provides an audio playback method, including: the electronic device plays the first audio file in the first application, and obtains the playback process number of the first application and the process number of the window displayed by the electronic device; The device receives the user's first operation, and the first operation is used to control the second application to play the second audio file; in response to the first operation, the electronic device determines the process number from the window displayed on the electronic device as the playing process number of the first application the target window; the electronic device controls the playing process of the first application corresponding to the target window to pause and play the first audio file, and controls the second application to play the second audio file.
  • the window displayed by the electronic device includes a parent window displayed by the electronic device, and a child window associated with the parent window displayed by the electronic device.
  • the parent window displayed by the electronic device may include multiple, and the child windows associated with each parent window displayed by the electronic device may also include multiple.
  • the electronic device may determine based on the playing sequence that the first application is paused for playing. Exemplarily, since the playing time of the second application is later than the playing time of the first application, the electronic device determines that it is the first application that is suspended for playing.
  • the electronic device may determine based on preset application priorities that the first application is paused for playback. Exemplarily, because the priority of the second application is the priority of the first application, the electronic device determines that the first application is paused.
  • the electronic device may determine, based on the type of the audio file played by the application, that the first application is paused.
  • the electronic device may determine, based on the preset application priority and the type of the audio file played by the application, that it is the first application that is paused for playback.
  • one and only one audio file is output at the same time, avoiding confusion caused by simultaneous output of multiple audio channels due to sound mixing, and improving user experience.
  • the electronic device controls the playback process of the first application corresponding to the target window to pause the playback of the first audio file, which specifically includes: the electronic device obtains the identifier of the target window, and simulates a virtual The space key value of the space key; the electronic device sends the identification of the target window and the virtual space key value to the playback process of the first application; the electronic device uses the playback process of the first application corresponding to the target window based on the identification of the target window and the virtual space key The space key value controls the first application to pause playing the first audio file.
  • the electronic device simulates a virtual space key value, and can automatically control the first application to pause and play the first audio file without the user operating the space bar on the keyboard to obtain the space key value.
  • the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: responding to In the first operation, the electronic device determines the target window whose process number is the playback process number of the first application from the windows displayed by the electronic device based on the priority of the first application and the priority of the second application. In this way, the electronic device can automatically control the application to pause and play audio based on the preset application priority.
  • the electronic device determines the process number from the window displayed on the electronic device as the playback process number of the first application
  • the target window specifically includes: when the priority of the first application is lower than that of the second application, the electronic device determines the target window whose process number is the playback process number of the first application from the windows displayed on the electronic device .
  • the electronic device when the priority of the first application is higher than the priority of the second application, the electronic device continues to play the first audio file in the first application, and does not play the first audio file in the first application.
  • a second audio file in the second application when the priority of the first application is higher than the priority of the second application, when the electronic device receives the first operation for controlling the second application to play the second audio file After that, the electronic device can first play the second audio file in the second application, that is, play the first audio file and the second audio file at the same time; The program pauses playing the second audio file. That is, the target window of the second application is obtained by traversing, and then the simulated space key value is sent to make the second application pause and play the second audio file. The electronic device is made to continue playing the first audio file without playing the second audio file.
  • the method further includes: when the priority of the first application is the same as that of the second application, the electronic device outputs first prompt information, and the first prompt information uses Before prompting the user to play the second audio file in the second application, playing the first audio file in the first application is paused. In this way, the user may be prompted to pause playing the first audio file in the first application.
  • the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: responding to In the first operation, based on the type of the first audio file and the type of the second audio file, the electronic device determines the target window whose process number is the playing process number of the first application from the windows displayed by the electronic device. In this way, the electronic device can also automatically control the application to pause playing audio based on the type of the audio file played in the application.
  • the electronic device may also display from the electronic device based on the priority of the first application and the priority of the second application, the type of the first audio file, and the type of the second audio file
  • the target window whose process ID is the playing process ID of the first application is determined from the windows.
  • the electronic device can also automatically control the application to pause and play audio based on the preset priority of the application and the type of the audio file played in the application.
  • the electronic device determines the process number from the window displayed on the electronic device as the playback process number of the first application
  • the target window specifically includes: when the type of the first audio file is a non-real-time audio file and the type of the second audio file is a real-time audio file, the electronic device determines that the process number is The target window of the playback process ID of the first application. In other words, real-time audio files have the highest priority.
  • the method further includes: when the type of the first audio file is real-time In the case of an audio file, the electronic device outputs second prompt information, and the second prompt information is used to instruct the user to pause playing the first audio file of the first application; the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file.
  • controlling the second application to play the second audio file specifically includes: the electronic device receives the user's second operation, and in response to the second operation, the electronic device controls the playback process of the first application corresponding to the target window to pause playing the first audio file, and control the second application to play the second audio file.
  • the electronic device can avoid switching the real-time audio file to a non-real-time audio file, thereby affecting user experience.
  • the electronic device controls the playback process of the first application corresponding to the target window to stop playing the first audio file, specifically including: the electronic device sequentially traverses each parent window displayed on the electronic device , determine the target parent window whose process number is the playing process number of the first application; the electronic device controls the playing process of the first application corresponding to the target parent window to stop playing the first audio file; or, the electronic device sequentially traverses each A parent window, determine the target parent window whose process number is the playback process number of the first application; when the electronic device fails to control the playback process of the first application corresponding to the target parent window to stop playing the first audio file, the electronic device sequentially Traverse each child window associated with each parent window displayed by the electronic device, and obtain the target child window whose process number is the playback process number, or, the electronic device sequentially traverses each child window associated with the target parent window displayed by the electronic device, and obtain Go to the target sub-window whose process ID is the playback process ID;
  • the electronic device first judges whether the target parent window can pause and play audio, and if so, it does not need to traverse the target sub-window, which saves the time for the electronic device to search for the target sub-window. If not, the electronic device traverses the target sub-window again.
  • the electronic device controls the playback process of the first application corresponding to the target window to stop playing the first audio file, specifically including: the electronic device sequentially traverses each parent window displayed on the electronic device , determine the target parent window whose process number is the playing process number of the first application; the electronic device sequentially traverses each child window displayed in the electronic device, and determine the target child window whose process number is the playing process number of the first application, or , the electronic device sequentially traverses each sub-window associated with the target parent window displayed by the electronic device, and determines the target sub-window whose process number is the playback process number of the first application; The playing process of the application stops playing the first audio file.
  • the window implementing the playing logic is either the target child window or the target parent window, and the electronic device can directly obtain the target parent window and the target child window, so that the control application agrees to play audio.
  • the method further includes: the electronic device receives a third operation of the user, and the third operation is used to control the second audio file in the second application.
  • the second application pauses playing the second audio file; in response to the third operation, the electronic device controls the second application to pause playing the second audio file, and controls the first application to continue playing the first audio file.
  • the electronic device can control the application that pauses playing the audio due to the system device instead of the user actively triggering the operation to automatically start playing the audio again, which saves user operations.
  • the electronic device receives a user's fourth operation, and the fourth operation is used to control the first application to pause playing the first audio file; in response to the fourth operation, the electronic device controls the first The application pauses to play the first audio file, and controls the second application to continue to pause and play the second audio file.
  • the electronic device will not control the application that pauses to play the audio due to the active trigger operation of the user to automatically start playing the audio again, so as to avoid conflicts with the user's wishes.
  • the embodiment of the present application provides an electronic device, the electronic device includes: one or more processors, one or more memories; one or more memories are coupled with one or more processors, one or more
  • the memory is used to store computer program codes, the computer program codes include computer instructions, and one or more processors call the computer instructions to make the electronic device execute the audio playing method provided in the first aspect.
  • the embodiment of the present application provides an electronic device, a computer-readable storage medium, which is used to store computer instructions, and when the computer instructions are run on the electronic device, the audio playback method provided by the first aspect of the electronic device is made .
  • an embodiment of the present application provides a computer program product, which, when the computer program product is run on the electronic device, enables the electronic device to perform the audio playback method provided in the first aspect.
  • FIG. 1A-FIG. 1E are schematic diagrams of a set of electronic devices 100 playing multiple channels of audio at the same time provided by the embodiment of the present application;
  • FIG. 2 is a timing diagram of an electronic device 100 playing multiple channels of audio simultaneously according to an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of an electronic device 100 provided in an embodiment of the present application.
  • Fig. 4 is a schematic diagram of functional modules of how an electronic device 100 controls only one channel of audio to be played at the same time provided by the embodiment of the present application;
  • FIG. 5 is a schematic diagram of how to control the audio application 1 to continue playing music after the cross-process management module 430 in the embodiment of the present application controls the audio application 1 to stop playing music;
  • 6A-6B are schematic diagrams of a parent window and a child window provided by the embodiment of the present application.
  • FIG. 7A is a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction provided by the embodiment of the present application;
  • FIG. 7B is a schematic diagram of how another cross-process management module 430 according to the embodiment of the present application controls the audio application 1 to stop playing audio based on the process number one and the pause instruction;
  • FIG. 7C is a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction provided by the embodiment of the present application;
  • FIG. 7D is a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction provided by the embodiment of the present application;
  • 8A-8B are schematic diagrams of how the electronic device 100 outputs audio when a group of low-priority audio applications are switched to high-priority audio applications provided by the embodiment of the present application;
  • 9A-9C are schematic diagrams of how the electronic device 100 outputs audio when a group of high-priority audio applications are switched to low-priority audio applications provided by the embodiment of the present application;
  • 10A-10C are schematic diagrams of how the electronic device 100 outputs audio when a group of audio applications with the same priority are switched according to the embodiment of the present application;
  • FIG. 11 is another timing diagram for playing multiple channels of audio at the same time provided by the embodiment of the present application.
  • FIG. 12 is a schematic flowchart of an audio playback method provided by an embodiment of the present application.
  • first and second are used for descriptive purposes only, and cannot be understood as implying or implying relative importance or implicitly specifying the quantity of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more.
  • UI user interface
  • the term "user interface (UI)” in the following embodiments of this application is a medium interface for interaction and information exchange between an application program or an operating system and a user, and it realizes the difference between the internal form of information and the form acceptable to the user. conversion between.
  • the user interface is the source code written in a specific computer language such as java and extensible markup language (XML).
  • the source code of the interface is parsed and rendered on the electronic device, and finally presented as content that can be recognized by the user.
  • the commonly used form of user interface is the graphical user interface (graphic user interface, GUI), which refers to the user interface related to computer operation displayed in a graphical way. It may be text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, Widgets, and other visible interface elements displayed on the display screen of the electronic device.
  • an electronic device 100 such as a personal computer (PC)
  • PC personal computer
  • Windows @ or other operating systems since the operating system on the electronic device 100 does not have a multi-channel audio playback control strategy, the electronic device 100 is playing multiple audio channels at the same time. When there are multiple channels of audio, the electronic device 100 will play multiple channels of audio at the same time, and the audio effect heard by the user is a sound mixing effect.
  • FIG. 1A-FIG. 1E exemplarily show schematic diagrams in which the electronic device 100 plays multiple channels of audio at the same time.
  • FIG. 1A exemplarily shows a desktop of an electronic device 100 .
  • the desktop may include icons for one or more applications, a notification bar, and the like.
  • the icons of one or more application programs include, but are not limited to, icons of computer applications, icons of recycle bin applications, icons of instant messaging applications, icons of music applications, and icons of video applications.
  • the talk bar can include time indicators, volume indicators, search areas, and more.
  • the electronic device 100 receives an input operation (for example, a double-click operation) on an icon of a music application, and the electronic device 100 displays a user interface 1001 of the music application on the desktop as shown in FIG. 1B .
  • the user interface 1001 can be understood as the main user interface of the music application.
  • the user interface 1001 includes a music application theme area, a recommended song area and a music playing area.
  • the theme area includes singers, rankings, song lists and radio stations.
  • the music playing area includes the name of the song "song A", a pause/play control 1002, a previous song control, a next song control, a volume adjustment progress bar, and the like. It can be seen from FIG. 1A that the song "Song A" to be played in the music playing area has been paused.
  • the electronic device 100 receives an input operation (such as a click operation) on the pause/play control 1002 in the music playing area, and as shown in FIG. 1C , the electronic device 100 starts to play the song "song A". In this way, the user can hear the song played by the electronic device 100 .
  • an input operation such as a click operation
  • the electronic device 100 when the electronic device 100 is playing music, the electronic device 100 receives a voice call request sent by other electronic devices, and the electronic device 100 displays a prompt bar 1003 on the desktop.
  • the prompt bar 1003 includes a prompt message "Lily invites you to make a voice call", and the prompt bar 1003 also includes a receiving control 1004 and a rejecting control 1005 .
  • the electronic device 100 receives the user's input operation (such as clicking) on the receiving control 1004 in the prompt bar 1003, and the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily".
  • the electronic device 100 displays a voice call user interface 1006 on the desktop.
  • the user interface 1006 can display the call duration (for example, the duration is 8 seconds), and the user interface 1006 also includes a mute control, a rejection control, a volume control, and the like.
  • the electronic device 100 will not pause the music being played by the music application, and the electronic device 100 will continue to play the song "Song A” .
  • the electronic device 100 may also play the voice of the contact "Lily", and the content of the voice may be "wait for two minutes and wait for other people to go online”.
  • FIG. 2 exemplarily shows a timing diagram of the electronic device 100 playing multiple channels of audio at the same time.
  • the electronic device 100 receives the user's operation and starts to play the song in the music application. After a period of time (for example, 360 ms), the electronic device 100 receives the user's operation and accesses the electronic device sent by the contact "Lily". voice calls. As shown in FIG. 2 , after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 may play the voice of the contact "Lily". For example, if the call duration is 480ms, when the electronic device 100 plays the voice of the contact "Lily" within 0ms-480ms, the electronic device 100 continues to play the songs in the music application.
  • the electronic device 100 overlaps and plays the song between 360ms-840ms in the music application and the real-time voice between 0ms-480ms in the call application, and what the user hears during this period is the sound mixing effect.
  • the voice call ends, and the electronic device 100 suspends playing the real-time voice in the calling application.
  • the electronic device 100 still continues to play the songs in the music application.
  • the electronic device 100 plays multiple channels of audio, the electronic device 100 plays the multiple channels of audio overlappingly, and what the user hears is a sound mixing effect, and the user experience is not good. While the user is listening to music or watching a movie, the user accesses a voice call through the electronic device 100 . When the user is making a voice call, music or movies are still playing continuously, which will cause the user to miss nice music clips or perfect movie clips, and the user experience is not good.
  • the embodiment of the present application provides an audio playback method, which can be applied to an electronic device 100 installed with Windows @ or other operating systems, the method includes: the electronic device plays the first audio file in the first application, and Obtain the playback process number of the first application and the process number of the window displayed by the electronic device; the electronic device receives the first operation of the user, and the first operation is used to control the second application to play the second audio file; in response to the first operation, the electronic device The device determines from the windows displayed by the electronic device the target window whose process number is the playback process number of the first application; the electronic device controls the playback process of the first application corresponding to the target window to pause and play the first audio file, and controls the second application to play the second audio file. In this way, only one channel of audio can be played by the electronic device 100 at the same time without active triggering by the user, which improves user experience.
  • FIG. 3 exemplarily shows a schematic structural diagram of the electronic device 100 .
  • the electronic device 100 can be a portable terminal device equipped with Windows® or other operating systems, such as a personal computer (personal computer), a notebook computer, a handheld computer, a tablet computer, a desktop computer, etc.
  • Non-portable terminal devices such as laptop computers (Laptop), ultra-mobile personal computers (ultra-mobile personal computer, UMPC), etc.
  • the embodiment of the present application does not specifically limit the specific type of the electronic device 100 .
  • the electronic device 100 may include a processor 110 , an internal memory 120 , a wireless communication module 130 , a sensor module 150 , an audio module 160 , a display screen 170 , a power switch 180 , a motor 190 and a key 1000 .
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the internal memory 120 may include one or more random access memories (random access memory, RAM) and one or more non-volatile memories (non-volatile memory, NVM).
  • RAM random access memory
  • NVM non-volatile memory
  • Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (synchronous dynamic random access memory, SDRAM), double data rate synchronous Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as the fifth generation DDR SDRAM is generally called DDR5 SDRAM), etc.; non-volatile memory can include disk storage devices, flash memory (flash memory) .
  • SRAM static random-access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • non-volatile memory can include disk storage devices, flash memory (flash memory) .
  • flash memory can include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc.
  • it can include single-level storage cells (single-level cell, SLC), multi-level storage cells (multi-level cell, MLC), triple-level cell (TLC), quad-level cell (QLC), etc.
  • SLC single-level storage cells
  • MLC multi-level storage cells
  • TLC triple-level cell
  • QLC quad-level cell
  • UFS universal flash storage
  • embedded multimedia memory card embedded multi media Card
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • the non-volatile memory can also store executable programs and data of users and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
  • the wireless communication function of the electronic device 100 can be realized by the antenna 130A, the wireless communication module 130 , the modem processor, the baseband processor, and the like.
  • the antenna 130A can be used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • the wireless communication module 130 can provide wireless local area networks (wireless local area networks, WLAN), bluetooth (bluetooth, BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 130 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 130 receives electromagnetic waves via the antenna 130A, frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 130 can also receive the signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and convert it into electromagnetic wave and radiate it through the antenna 130A.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low-frequency baseband signal is passed to the application processor after being processed by the baseband processor.
  • the application processor outputs sound signals through an audio device, or displays images or videos through the display screen 170 .
  • the sensor module 150 includes an acceleration sensor 1501, a temperature sensor 1502, a touch sensor 1503, a pressure sensor 1504, and the like.
  • the acceleration sensor 1501 can be used to detect the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the temperature sensor 1502 is used to detect temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 1502 to implement a temperature treatment strategy. For example, when the temperature reported by the temperature sensor 1502 exceeds the threshold, the electronic device 100 may reduce the performance of a processor located near the temperature sensor 1502, so as to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery, so as to prevent the electronic device 100 from being shut down abnormally due to the low temperature.
  • the electronic device 100 boosts the output voltage of the battery to avoid abnormal shutdown caused by low temperature.
  • the touch sensor 1503 is also called “touch device”.
  • the touch sensor 1503 may be disposed on the display screen 170, and the touch sensor 1503 and the display screen 170 form a touch screen, also called a “touch screen”.
  • the touch sensor 1503 is used to detect a touch operation acting on or near it.
  • the touch sensor 1503 can transmit the detected touch operation to the application processor to determine the type of the touch event.
  • Visual output related to the touch operation can be provided through the display screen 170 .
  • the touch sensor 1503 may also be disposed on the surface of the electronic device 100 , which is different from the position of the display screen 170 .
  • the pressure sensor 1504 is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • the pressure sensor 1504 may be disposed on the display screen 170 .
  • pressure sensors 1504 such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors.
  • a capacitive pressure sensor may be comprised of at least two parallel plates with conductive material. When a force is applied to the pressure sensor 1504, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of pressure according to the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 1504 .
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 1504 .
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view short messages is executed. When a touch operation whose intensity is greater than or equal to the first pressure threshold acts on the icon of the short message application, the instruction of creating a new short message is executed.
  • the audio module 160 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal.
  • the audio module 160 may also be used to encode and decode audio signals.
  • the audio module 160 may be set in the processor 110 , or some functional modules of the audio module 160 may be set in the processor 110 .
  • Speaker 1601 also called “horn” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 1601 .
  • the microphone 1602 also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user may input a sound signal to the microphone 1602 when transmitting voice information.
  • the electronic device 100 may be provided with at least one microphone 1602 .
  • the electronic device 100 may be provided with two microphones 1602, which may also implement a noise reduction function in addition to collecting sound signals.
  • the electronic device 100 can also be provided with three, four or more microphones 1602 to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions, etc.
  • the electronic device 100 realizes the display function through the GPU, the display screen 170 , and the application processor.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 170 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 170 is used to display images, videos and the like.
  • the display screen 170 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 (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • the electronic device 100 may include 1 or N display screens 170 , where N is a positive integer greater than 1.
  • the power switch 180 can be used to control power supply to the electronic device 100 .
  • the motor 190 can generate vibration prompts.
  • the motor 190 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
  • touch operations applied to different applications may correspond to different vibration feedback effects.
  • the motor 190 can also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 170 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the key 1000 includes a power key, a volume key and the like.
  • the key 1000 may be a mechanical key. It can also be a touch button.
  • the electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100 .
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components.
  • the illustrated components can be realized in hardware, software or a combination of software and hardware.
  • FIG. 4 exemplarily shows a functional module schematic diagram of how the electronic device 100 controls only one channel of audio to be played at the same time.
  • the electronic device 100 includes an audio notification manager module (audio notification manager module) 410, a process manager module (process manager module) 420 and a cross-process management module (remote control module) 430.
  • audio notification manager module audio notification manager module
  • process manager module process manager module
  • cross-process management module remote control module
  • the audio notification management module 410 is used to monitor the running state of the audio application in the electronic device 100.
  • the running state of the audio application can be divided into an open state and an unopened state, and the open state can be divided into a play state and a pause state.
  • the audio application is in the open state, the electronic device 100 has created a process of the audio application and configured a corresponding process number.
  • the audio application is not opened, the process of the unopened audio application is not created.
  • the playing state refers to that the electronic device 100 is playing an audio file in a certain audio application.
  • the pause state means that a certain audio application has been opened, but the electronic device 100 has not played the audio file in the certain audio application, or the electronic device 100 has played the audio file in the certain audio application before, However, currently the electronic device 100 pauses playing the audio file in the certain audio application.
  • the audio notification management module 410 is configured to send the audio application in the open state and the process number of the audio application to the process management module 420 .
  • the audio notification management module 410 also uses Then, the changed open state of the audio application is sent to the process management module 420 again.
  • the electronic device 100 receives the user operation to open the music application 1, but does not play the audio file in the music application 1, the electronic device 100 will create the process number of the music application 1, and the electronic device 100 will set the open state of the music application 1 (pause state) and the process number of the music application 1 are sent to the process management module 420.
  • the electronic device 100 After the electronic device 100 starts the music application 1, the electronic device 100 receives a user operation to open the video application 1, and plays the video file in the video application 1, the electronic device 100 will create a process number for playing the video application 1, The electronic device 100 sends the start state (playing state) of the video application 1 and the process number of the video application 1 to the process management module 420 .
  • the electronic device 100 receives a user operation to suspend playing the video file in the video application 1, then the open state of the video application 1 changes from the playing state to the paused state. Since the opening state of the video application 1 has also changed, the audio notification management module 410 sends the opening state (suspended state) of the video application 1 and the process number of the video application 1 to the process management module 420 again.
  • the function of the process management module 420 is to control multiple audio applications at the same time, only one audio application can play audio.
  • the process management module 420 is configured to receive the start status of the audio application and the process number of the audio application sent by the audio notification management module 410 . And based on the open state of the audio application and the preset priority policy, it is determined which audio application needs to be controlled.
  • the process management module 420 may also determine which audio application needs to be controlled based on the whitelist policy and the preset priority policy.
  • a whitelist policy is a collection of preset applications that need to be controlled. Only when the application is in the white list, the process management module 420 will control the process of the application. If the application is not in the white list, the process management module 420 will not control the process of the application. In this way, it is possible to prevent the process management module 420 from controlling all the applications in the electronic device 100 , which would lead to an excessive load on the process management module 420 .
  • the process management module 420 may control the applications in the whitelist based on the frequency of use of the user. For example, if the user does not use a certain application within a certain period of time (for example, one month), the process management module 420 may remove the certain application from the white list. After the process management module 420 removes this certain application from the white list, the process management module 420 detects that the number of times the user uses the certain application within a certain period of time (for example, within a week) is greater than the preset value, then the process management module 420 You can add this certain application to the white list again.
  • a certain period of time for example, one month
  • the process management module 420 detects that two audio applications are in the playing state at the same time, for example, the audio application 1 and the audio application 2 are both in the playback state, then the process management module 420 will start from the two audio applications based on the preset
  • the set priority strategy determines an audio application with a lower priority, for example, the priority of audio application 1 is lower than that of audio application 2, and the process management module 420 will obtain the process number of audio application 1 , and send the process number one to the cross-process management module 430 .
  • the audio application 1 may be a music application 1
  • the audio application 2 may be a video application 1.
  • the process management module 420 monitors that the music application 1 and the video application 1 are both in the playing state, then the process management module 420 will determine the priority from the music application 1 and the video application 1 based on the preset priority policy For a lower audio application, for example, if the process management module 420 determines that the priority of the music application 1 is low, then the process management module 420 will obtain the process number of the music application 1, and send the process number of the music application 1 and the pause instruction Sent to the cross-process management module 430.
  • the cross-process management module 430 is used to receive the process number one of the audio application 1 and the pause instruction sent by the process management module 420, and control the audio application 1 to stop playing audio based on the process number one of the audio application 1 and the pause instruction. In this way, through the control of audio applications, only one audio channel can be played at the same time. Specifically, how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number of the audio application 1 will be described in detail in subsequent embodiments, and will not be repeated in this embodiment of the application.
  • the cross-process management module 430 receives the process number of the music application 1 sent by the process management module 420 , and the cross-process management module 430 will control the music application 1 to stop playing music based on the process number of the music application 1 .
  • the cross-process management module 430 will control the music application 1 to stop playing music based on the process number of the music application 1 .
  • only video application 1 has audio output. It is realized that the electronic device 100 can only play the audio in one audio application at the same time.
  • FIG. 5 exemplarily shows a functional module diagram of how the cross-process management module 430 controls the audio application 1 to continue playing music after controlling the audio application 1 to stop playing music.
  • the process management module 420 when the process management module 420 determines to control the audio application 1 to suspend playing audio based on the playback priority policy, the process management module 420 also needs to mark the process number one of the audio application 1, Make the process management module 420 record that the audio application 1 pauses playing the audio due to the playback priority policy, and the audio application 1 is not triggered to pause the audio by the user.
  • the process management module 420 may store the process number one of the audio application 1 locally, so that when the process management module 420 controls the audio application 1 from the state of pausing the audio to the state of continuing to play the audio, Whether the process number 1 of the audio application 1 that needs to continue to play audio can be found from the process number of the audio application stored locally.
  • the process management module 420 will audio The process number one and the play instruction of the class application 1 are sent to the cross-process management module 430, and after the cross-process management module 430 receives the process number one and the play instruction of the audio class application 1 sent by the process management module Control audio application 1 to continue playing audio. If it is not found, it means that the process management module 420 did not control the audio application 1 to suspend playing audio based on the playback policy before, but the audio application 1 paused playing the audio due to the user's active trigger. In this case, the process management module 420 will not send the process number one of the audio application 1 and the playback instruction to the cross-process management module 430, so as to avoid conflicts with the user's willingness to actively trigger the audio application 1 to pause playing audio.
  • process management module 420 can also mark the process number 1 of the audio application 1 based on other methods, not limited to the method of saving the process number 1 of the audio application 1 locally. There is no limit to this.
  • the audio notification management module 410 will obtain that the audio application 1 is in the open state from the playback state to the pause state, then the audio notification management module 410 will send the audio
  • the open state (ie, paused state) of the class application 1 and the process number of the audio class application 1 are sent to the process management module 420 .
  • the open state of the audio application 1 detected by the process management module 420 is the pause state, and the open state of the audio application 2 is the play state. That is, the process management module 420 detects that there is only one audio output.
  • the audio notification management module 410 will obtain the open state of the audio application 2 from the play state to the pause state, and the audio notification management module 410 will obtain the open state (ie, pause state) of the audio application 2 and the process number of the audio application 2. Sent to the process management module 420. Then, the open state of the audio application 1 detected by the process management module 420 is the suspended state, and the open state of the audio application 2 is also the suspended state.
  • the process management module 420 detects that the audio application 2 changes from the playing state to the paused state, then the process management module 420 based on the preset priority policy, the process number of the audio application stored in the process management module 420 and the The open state of other audio-type applications other than type-application 2 determines the audio-type application that needs to continue playing.
  • the process management module 420 if in addition to the audio application 2, the process management module 420 only monitors that the audio application 1 is in a suspended state, and the process number of the audio application stored by the process management module 420 includes the audio application 1 If the process number is one, then the process management module 420 determines that the audio application that continues to play is the audio application 1, and the process management module 420 sends the process number one and the playback instruction of the audio application 1 to the cross-process management module 430.
  • the cross-process management module 430 When the cross-process management module 430 receives the process number one and the play instruction of the audio application 1 sent by the process management module 420, the cross-process management module 430 will control the audio application 1 to continue playing audio based on the process number one and the play instruction.
  • the process management module 420 if in addition to the audio application 2, the process management module 420 only detects that the audio application 1 is in a suspended state, but the audio application 1 is not included in the process number of the audio application stored by the process management module 420
  • the process number is one, which means that it was not the process management module 420 that controlled the audio application 1 to suspend audio playback based on the playback priority policy. It may be that the user actively triggered the audio application 1 to suspend audio playback. It will not control the audio application 1 to continue playing audio, so as to avoid conflicts with the user's willingness to actively trigger the audio application 1 to suspend playing audio, and the process management module 420 will not send the process number 1 and the playback instruction of the audio application 1 to A cross-process management module 430 .
  • the cross-process management module 430 When the cross-process management module 430 receives the process number one and the play instruction of the audio application 1 sent by the process management module 420, the cross-process management module 430 will control the audio application 1 to continue playing audio based on the process number one and the play instruction.
  • the process management module 420 detects that both the audio application 1 and the audio application 3 are in a suspended state, but the priority of the audio application 1 is higher than that of the audio application 3. Priority, and the process number of the audio class application stored by the process management module 420 includes the process number one of the audio class application 1, then the process management module 420 determines that the audio class application that continues to play is the audio class application 1, and the process management module 420 Send the process number one of the audio application 1 and the play instruction to the cross-process management module 430 .
  • the cross-process management module 430 When the cross-process management module 430 receives the process number one and the play instruction of the audio application 3 sent by the process management module 420, the cross-process management module 430 will control the audio application 1 to continue playing audio based on the process number one and the play instruction.
  • the process management module 420 only detects that the audio application 1 and the audio application 3 are in a suspended state, the priority of the audio application 1 is higher than that of the audio application 3 , but the process number of the audio application saved by the process management module 420 does not include the process number one of the audio application 1, but includes the process number three of the audio application 3, which means that the process management module 420 was not based on the playback priority strategy before.
  • the audio application 1 is controlled to suspend audio playback, which may be triggered by the user to suspend audio application 1, but the process management module 420 controls audio application 3 to suspend audio playback based on the playback priority policy.
  • the process management module 420 determines that even if the priority of the audio application 1 is higher than that of the audio application 3, the process management module 420 will not control the audio application 1 to continue playing audio, so as to avoid actively triggering the audio application with the user. 1 There is a conflict in the desire to pause playing audio, but the process management module 420 will control the audio application 3 to continue playing audio, and the process management module 420 sends the process number three of the audio application 3 and the playback instruction to the cross-process management module 430.
  • the cross-process management module 430 When the cross-process management module 430 receives the process number three and the play instruction of the audio application 3 sent by the process management module 420, the cross-process management module 430 will control the audio application 3 to continue playing audio based on the process number three and the play instruction.
  • cross-process management module 430 controls the audio application to continue playing audio based on the process number and the playback instruction will be described in detail in subsequent embodiments, and will not be repeated in this embodiment of the application.
  • the cross-process management module 430 is generally used to control an audio application of a non-real-time voice call or a non-real-time video call to continue playing audio after suspending.
  • the electronic device 100 essentially caches the audio files to be played by the audio applications of non-real-time voice calls or non-real-time video calls completely or partially in the Locally, the cross-process management module 430 can control the audio application of the non-real-time voice call or non-real-time video call to continue playing audio based on the complete or partial cached audio file.
  • cross-process management module 430 controls the audio application to pause playing audio based on the process number and the playback instruction.
  • each application has a different definition of a parent window and a child window.
  • Each application program corresponds to one or more parent windows, and the parent window is used to host the child windows.
  • a parent window can have one or more child windows.
  • the electronic device 100 starts the music application, and displays the user interface 1001 of the music application shown in FIG. 1B . After the electronic device 100 starts the music application, the parent window of the music application has been established, but the electronic device 100 does not display the parent window of the music application.
  • the music application is based on functional modules, and the user interface 1001 is divided into several sub-windows.
  • the area 601 in the user interface 1001 is a sub-window 1
  • the function of the sub-window 1 is to realize a search function, such as searching for songs, singers, music videos (music video, MV) and the like.
  • the area 602 in the user interface 1001 is the sub-window 2
  • the function of the sub-window 2 is to realize the song list display function, such as singer popularity ranking, popular song list, personal favorite song list, radio station and so on.
  • the area 603 in the user interface 1001 is the sub-window 3.
  • the function of the sub-window 3 is to realize the recommendation function, such as recommending the music that the user likes to listen to based on the user's preference, or recommending currently popular singles or MVs based on big data analysis.
  • the area 604 in the user interface 1001 is a sub-window 4, and the function of the sub-window 4 is to realize playing/pausing music.
  • the sub-window 4 includes a play/pause control, a previous song control, a next song control, a volume adjustment control and the like.
  • FIG. 6B shows a schematic diagram of the relationship between a parent window and multiple child windows in a music application.
  • the parent window in the music application is the bearer of all the child windows in the music application, and the child windows associated with the parent window may include child window 1, child window 2, child window 3 and child window 4.
  • the electronic device 100 receives the user's first input operation in the sub-window 1 , the electronic device 100 will overlay and display other user interfaces on the user interface 1001 .
  • other user interfaces displayed by the electronic device 100 may include one or more sub-windows, for example, other user interfaces include sub-window 5 and sub-window 6 , and both sub-window 5 and sub-window 6 belong to sub-windows of sub-window 1 .
  • both the parent window and the child window in the application include a unique window identifier, and the window identifier is used to indicate which parent window or which child window it is.
  • the window identifier may include but not limited to window handle and other information.
  • the window handle may be understood as the number of the window, and the number of each window is different. In this way, the electronic device 100 can find the corresponding window based on the handle of the window.
  • FIG. 7A exemplarily shows a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
  • the cross-process management module 430 traverses each parent window in turn, and acquires all parent windows whose process number is process number one as target parent windows.
  • all parent windows can be divided into system parent windows and application parent windows. Since the electronic device 100 generally plays audio through applications, the cross-process management module 430 can filter all parent windows to obtain application-type parent windows.
  • All parent windows acquired by the cross-process management module 430 may include the parent window of application 1, the parent window of application 2 and the system parent window. Since the electronic device 100 generally plays audio through the application, the cross-process management module 430 can obtain the parent window of the application 1 and the parent window of the application 2 from the parent window of the application 1, the parent window of the application 2 and the system parent window.
  • all parent windows can be divided into system parent windows and application parent windows. Since the electronic device 100 generally plays audio through audio applications, the cross-process management module 430 can filter all parent windows to obtain the application parent window, and then filter the application parent windows to obtain the audio application parent window.
  • All parent windows acquired by the cross-process management module 430 may include the parent window of application 1, the parent window of application 2 and the system parent window. Since the electronic device 100 generally plays audio through audio applications, the cross-process management module 430 can filter and obtain the parent window of application 1 from the parent window of application 1, the parent window of application 2 and the system parent window.
  • the process number of the application program has been created.
  • the application program corresponds to one or more processes, and each process corresponds to a parent window. Therefore, the opened application program may have one parent window, or may have multiple parent windows, which is not limited in this embodiment of the present application.
  • the application program on the electronic device 100 is opened only once, then the application program has a parent window, and the parent window corresponds to a process number. If the same application program on the electronic device 100 is opened multiple times at the same time, then the application program has multiple parent windows, and the process ID of each of the multiple parent windows of the same application program is different.
  • the electronic device 100 can start an application program, then there is at least one parent window of the application program. If the electronic device 100 has opened two or more application programs, then there are at least two or more parent windows.
  • the cross-process management module 430 needs to traverse each parent window in turn to find all parent windows.
  • the electronic device 100 starts the music application 1 and the video application 1 , then there is at least one parent window of the music application 1 and at least one parent window of the video application 1 in the electronic device 100 .
  • the cross-process management module 430 traverses each parent window in turn, and if the process number of the current parent window is process number one, the cross-process management module 43 takes the parent window as the target parent window.
  • the cross-process management module 430 can stop traversing other windows, so that the time for the cross-process management module 430 to find the target parent window can be saved.
  • the cross-process management module 430 can continue to traverse other windows until all parent windows have been traversed. In this way, the situation that the cross-process management module 430 misses to find the target parent window can be avoided.
  • the cross-process management module 430 obtains the identifier of the target parent window.
  • the cross-process management module 430 sends the pause command and the target parent window identifier to the process with process number one.
  • the cross-process management module 430 obtains the target parent window after obtaining the parent window of process number one.
  • the cross-process management module 430 obtains the identifier of the target parent window, and sends a pause command and the identifier of the target parent window to the process with process number one.
  • the cross-process management module 430 cannot obtain in advance which parent window or which child window the window implementing the play/pause function is. Therefore, the cross-process management module 430 first sends a pause instruction to the target parent window, and judges whether it is possible to control the current audio to pause and play.
  • the pause command can be a simulated space key value.
  • the simulated space bar value is equivalent to the electronic device 100 receiving the user's click operation on the space bar on the keyboard.
  • the process management module 420 sends the simulated space key value to the process of process number one, so that the process of process number one can control the audio application 1 to play audio, which is equivalent to simulating the user manually clicking the space bar on the keyboard. Automatically pause the playback of audio application 1.
  • the cross-process management module 430 judges whether the audio application 1 stops playing audio?
  • the cross-process management module 430 determines that the audio application 1 stops playing audio, it means that the window of the audio application 1 that implements the play/pause function is the parent window of the audio application 1, and the process ends.
  • the cross-process management module 430 determines that the audio application 1 has not stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is not the parent window of the audio application 1, and the cross-process management module 430 executes S705.
  • the cross-process management module 430 sequentially traverses all child windows under each parent window, and acquires all child windows whose process number is process number one as target child windows.
  • the cross-process management module 430 Since the cross-process management module 430 cannot know which sub-window implements the pause/play function, the cross-process management module 430 needs to obtain all the sub-windows whose process number is process number one as the target sub-window.
  • Cross-process management module 430 traverses the child windows associated under each parent window in turn, if the process number of the child window associated under the current parent window is process number one, then the cross-process management module 43 uses the child window associated under the current parent window as The target subwindow.
  • the cross-process management module 430 can stop the associated sub-windows under other parent windows. In this way, the time for the cross-process management module 430 to find the target sub-window can be saved.
  • the cross-process management module 430 can continue to traverse the associated sub-windows under other parent windows until all the associated sub-windows under all parent windows have been traversed, so that the cross-process management module 430 can avoid the situation that the target sub-window is missed occur.
  • the number of all child windows under each parent window may be one, or two or more.
  • the electronic device 100 starts the music application 1 and the video application 1 , then there is a parent window of the music application 1 and a parent window of the video application 1 in the electronic device 100 .
  • the cross-process management module 430 needs to find all the child windows in the parent window of the music application 1 first, and then, the cross-process management module 430 searches for all the child windows in the parent window of the video application 1.
  • the cross-process management module 430 finds all child windows in the parent window of music application 1, and obtains the process numbers of all child windows of music application 1, when the process numbers of all child windows of music application 1 are process number one , all sub-windows of the music application 1 are used as target sub-windows. When the process numbers of some of the sub-windows of the music application 1 are process number 1, all the sub-windows of the music application 1 are used as the target sub-windows. When the process numbers of some of the sub-windows of the music application 1 are not process number 1, it means that the sub-windows in the music application 1 do not include the target sub-window.
  • the cross-process management module 430 continues to search for all child windows in the parent window of the video application 1 .
  • the cross-process management module 430 finds all child windows whose process number is process number one in the parent window of the music application 1 .
  • the cross-process management module 430 also needs to search for all sub-windows in the parent window of the video application 1, and obtain the process numbers of all sub-windows of the video application 1.
  • the process IDs of all the sub-windows of the video application 1 are process ID 1
  • all the sub-windows of the video application 1 are used as the target sub-windows.
  • the process number of some of the sub-windows of the video application 1 is process number 1
  • all the sub-windows of the video application 1 are used as the target sub-windows.
  • the cross-process management module 430 When the cross-process management module 430 first finds the target sub-window in the sub-window of the music application 1, the cross-process management module 430 can also continue to search for whether the target sub-window exists in the video application 1 until it traverses all the parent windows in turn. child window. In this way, the situation that the cross-process management module 430 fails to find the target sub-window can be avoided, and the accuracy of cross-process audio playback control is improved.
  • the cross-process management module 430 obtains the identifier of the target sub-window.
  • the identifier of the target sub-window may be one or multiple.
  • the identifier of the target sub-window may be information such as a handle of the target sub-window.
  • the handle of the target sub-window can be understood as the number of the target sub-window, and the labels of each target sub-window are different. In this way, the cross-process management module 430 can find the corresponding target sub-window based on the handle of the target sub-window.
  • the cross-process management module 430 sends the pause instruction and the target sub-window identifier to the process with process number one.
  • the cross-process management module 430 After obtaining the identification of the target sub-window, the cross-process management module 430 sends the suspension instruction and the identification of the target sub-window to the process of the process number one, and after the process of the process number one receives the suspension instruction and the identification of the target sub-window, The target sub-window corresponding to the identifier of the target sub-window will be controlled to pause playing audio. In this way, the cross-process management module 430 realizes the function of controlling audio pause across processes, avoiding multiple audio outputs at the same time and bringing bad user experience to the user.
  • FIG. 7B exemplarily shows another schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
  • the cross-process management module 430 traverses each parent window in turn, and obtains all parent windows whose process number is process number one as target parent windows.
  • the cross-process management module 430 sequentially traverses all child windows under each parent window, and acquires all child windows whose process number is process number one as target child windows.
  • the cross-process management module 430 acquires the identifier of the target parent window and the identifier of the target child window.
  • the cross-process management module 430 sends the pause command, the identifier of the target parent window and the identifier of the target child window to the process with process number one.
  • FIG. 7B and FIG. 7A The difference between FIG. 7B and FIG. 7A is that the cross-process management module 430 does not need to execute the judgment step of S704A in FIG. 7A, because the cross-process management module 430 cannot obtain in advance which parent window or Which child window, and the window that implements the play/pause function is either in the parent window or in the child window. Therefore, the cross-process management module 430 directly sends pause commands to all target child windows and target parent windows, so that the audio application 1 can stop playing audio.
  • FIG. 7C exemplarily shows another schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
  • the cross-process management module 430 traverses each parent window in turn, and obtains all parent windows whose process ID is process ID 1 as target parent windows.
  • the cross-process management module 430 acquires the identifier of the target parent window.
  • the cross-process management module 430 sends the pause command and the target parent window identifier to the process with process number one.
  • the cross-process management module 430 judges whether the audio application 1 stops playing audio?
  • the cross-process management module 430 determines that the audio application 1 stops playing audio, it means that the window of the audio application 1 that implements the play/pause function is the parent window of the audio application 1, and the process ends.
  • the cross-process management module 430 determines that the audio application 1 has not stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is not the parent window of the audio application 1, and the cross-process management module 430 executes S705C.
  • cross-process management module 430 traverses to each child window associated with the target parent window in turn, and obtains all child windows whose process number is process number one as the target child window.
  • the cross-process management module 430 obtains the identifier of the target sub-window.
  • the cross-process management module 430 sends the pause command and the target sub-window identifier to the process with process number one.
  • FIG. 7C The difference between FIG. 7C and FIG. 7A is that the cross-process management module 430 does not need to execute step S705A in FIG. 7A , but replaces S705A with S705C.
  • the cross-process management module 430 does not need to traverse each child window under each parent window in turn, and then obtain the child window whose process number is process number one from all the child windows.
  • the cross-process management module 430 can directly traverse from the child window associated with the target parent window to the child window whose process number is one, as the target child window, saving the time for the cross-process management module 430 to find the child window whose process number is one,
  • the efficiency of the cross-process management module 430 controlling the audio application 1 to stop playing audio is improved.
  • FIG. 7D exemplarily shows another schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
  • the cross-process management module 430 traverses each parent window in turn, and traverses to the next parent window.
  • the cross-process management module 430 judges whether the audio application 1 stops playing audio?
  • the cross-process management module 430 determines that the audio application 1 has not stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is not the parent window of the audio application 1, and the cross-process management module 430 executes S704D.
  • the cross-process management module 430 determines that the audio application 1 has stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is the parent window of the audio application 1, and the process ends.
  • the cross-process management module 430 sequentially traverses the child windows associated with the next parent window.
  • the cross-process management module 430 judges that the process number of the child window associated with the next parent window is process number one?
  • the window implementing the play/pause function of the audio application 1 may be a child window associated with the next parent window, and the cross-process management module 430 executes S706D. If not, it means that the window implementing the play/pause function of the audio application 1 is not a child window associated with the next parent window, and the cross-process management module 430 executes S701D.
  • the cross-process management module 430 sends the pause command and the identifier of the child window associated with the next parent window of the process number one to the process of the process number one.
  • the cross-process management module 430 After the cross-process management module 430 sends the pause command and the identifier of the child window associated with the next parent window of the process number one to the process of the process number one, the cross-process management module 430 executes the judgment step of S703D. If the audio application 1 stops playing audio, it means that the window implementing the play/pause function of the audio application 1 is a child window associated with the next parent window, and the process ends.
  • the cross-process management module 430 executes S701D, and the cross-process management module 430 continues to search for the next parent window and the next parent window Associated child windows until the cross-process management module 430 finds the parent window that causes the audio application 1 to stop playing audio or the child window associated with the parent window.
  • Fig. 7C The difference between Fig. 7C and Fig. 7A is that, firstly, the cross-process management module 430 does not need to judge the process number of the parent window, but when traversing to each parent window, it directly gives the identification and pause of the parent window being traversed.
  • the instruction is sent to the process whose process ID is process ID one.
  • the cross-process management module 430 does not find all the child windows associated with the parent window at one time, but only traverses the child windows associated with the parent window being traversed, and the cross-process management module 430 uses the identifier of the child window associated with the parent window being traversed and suspend instruction is sent to the process whose process number is process number one, if this operation causes the audio application 1 to suspend playing audio, then the cross-process management module 430 does not need to traverse other parent windows and child windows, which is the same as S705A in FIG. 7A In comparison, the cross-process management module 430 saves time for traversing all child windows associated with the parent window. If the operation does not cause the audio application 1 to suspend playing audio, the cross-process management module 430 continues to execute S701D.
  • the cross-process management module 430 may also automatically control the audio application 1 to continue playing the audio.
  • the principle of how the cross-process management module 430 controls the audio application 1 to continue playing audio based on the process number one is similar to the principle of how the cross-process management module 430 controls the audio application 1 to pause playing audio based on the process number one. Specifically, reference may be made to related descriptions in FIG. 7A-FIG. 7C. It’s just that the former continues to play the audio, and the latter pauses the audio. The difference between the two is that before the cross-process management module 430 controls the audio application 1 to continue playing the audio, the cross-process management module 430 needs to determine the previous audio application.
  • the cross-process management module 430 determines that the previous trigger operation of the audio application 1 to suspend audio playback is actively triggered by the user, then the cross-process management module 430 will not control the audio application 1 to continue playing audio, so as to avoid conflicts with the user's wishes. If the cross-process management module 430 determines that the previous trigger operation of the audio application 1 to suspend playing audio is triggered by the system's playback priority policy, then the cross-process management module 430 will control the audio application 1 to continue playing audio.
  • the cross-process management module 430 determines whether the audio application 1 pauses the audio playback trigger operation is triggered by the user, or is triggered by the system's playback priority policy.
  • the preset priority policy is set for audio applications, that is, the electronic device 100 can divide audio applications into different priorities.
  • Way 1 Divide the applications in the electronic device 100 into different priority levels. For example, it can be divided into the first level, the second level, the third level and the fourth level, etc., wherein the priority of the first level is greater than the priority of the second level, and the priority of the second level is greater than the priority of the third level level, the priority of the third level is higher than that of the fourth level.
  • the electronic device 100 divides different applications into different priority levels.
  • Table 1 exemplarily shows the result of the priority level division of the applications in the electronic device 100 .
  • the priority level of real-time voice/real-time video applications is the first level, and real-time voice/real-time video applications may include but not limited to telephone applications and social applications (such as instant messaging applications, etc.).
  • the priority level of the navigation application is the second level, and the navigation application may include but not limited to the Baidu map application and the like.
  • the priority level of game applications is the third level, and game applications may include, but are not limited to, applications such as Honor of Kings.
  • the priority level of music applications is the fourth level, and music applications may include but not limited to Netease cloud music applications.
  • the priority level of video applications is also the fourth level, and video applications may include but not limited to Tencent video applications.
  • Table 1 only exemplarily shows the results of the priority division of some applications. In a specific implementation, it may include more levels of priority than those in Table 1, and there may be more categories of audio applications, which are not limited in this embodiment of the present application.
  • the electronic device 100 may periodically update the priority levels of the applications in the electronic device 100 .
  • the electronic device 100 may change the priority level of the applications in the electronic device 100 based on the user's usage frequency and the user's usage habits. That is to say, the priority levels of the applications in the electronic device 100 can be changed.
  • the electronic device 100 can also customize the priority levels of the applications in the electronic device 100 by receiving the user's operation. In this way, the priority levels of unused applications can be set according to the user's wishes, which further improves the user experience.
  • the electronic device 100 defaults that the audio application with a later playback time can continue to play audio, and the audio application with an earlier playback time Pause audio playback.
  • the electronic device 100 receives a user operation and starts playing audio through the audio application 2. Since the playback time of the audio application 2 is later than that of the audio application 1, the electronic device 100 The audio application 1 will be controlled to pause playback, and the audio application 2 will be controlled to start playing audio.
  • the electronic device 100 can give a prompt message, which is used to prompt the user to suspend the high priority application first.
  • the electronic device 100 receives a user operation to start playing audio through the audio application 2. Since the priority of the audio application 1 is higher than that of the audio application 2, the electronic device 100 Cannot control audio application 1 to pause playback, and control audio application 2 to start playing audio.
  • the electronic device 100 may output prompt information, which is used to prompt the user that the audio application 2 cannot be controlled to start playing audio.
  • the electronic device 100 may also output prompt information, which is used to prompt the user to pause the audio played by the audio application 1 if he wants to start playing audio through the audio application 2 .
  • the electronic device 100 can directly suspend the audio playback of the low priority audio application, and control the high priority audio application Audio apps play audio.
  • the electronic device 100 receives a user operation and starts playing audio through the audio application 2. Since the priority of the audio application 1 is lower than that of the audio application 2, the electronic device 100 The device 100 may directly pause the audio played by the audio application 1, and control the audio application 2 to start playing the audio.
  • Method 2 the electronic device 100 does not prioritize the audio applications in the electronic device 100, but determines whether to switch based on the playing time.
  • the electronic device 100 always has a higher priority of an audio application with a later playback time than an audio application with an earlier playback time.
  • the electronic device 100 receives a user operation and starts playing audio through the audio application 2. Since the playback time of the audio application 2 is later than that of the audio application 1, the electronic device 100 The audio application 1 will be controlled to pause playback, and the audio application 2 will be controlled to start playing audio.
  • 8A-8B exemplarily show how the electronic device 100 outputs audio when switching from a low-priority audio application to a high-priority audio application.
  • the audio application 1 may be a music application
  • the audio application 2 may be an instant messaging application.
  • the priority of music applications is lower than that of instant messaging applications.
  • the instant messaging application has the function of voice chat or video chat.
  • the electronic device 10 plays music through a music application, and the electronic device 100 displays a user interface 1001 of the music application on the desktop.
  • the electronic device 100 receives a voice call request sent by other electronic devices, and the electronic device 100 receives the user's input operation on the receiving control 1004 in the prompt bar 1003 ( For example, click), the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily".
  • the electronic device 100 since the priority of instant messaging applications is higher than that of music applications, in order to control only one audio output at the same time, the electronic device The 100 will control low-priority applications to suspend playing audio, that is, the electronic device 100 controls the music application to suspend playing audio.
  • the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a paused state.
  • the electronic device 100 displays the voice call user interface 1006, and the electronic device 100 controls the instant messaging application to play the voice of the contact "Lily".
  • the electronic device 100 After the electronic device 100 finishes establishing a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 stops displaying the voice call user interface 1006, and the electronic device 100 still displays the user interface 1001 on the desktop, and the electronic device 100 will The display form of the pause/play control 1002 in the user interface 1001 is displayed as a playing state, that is, after the voice call is ended, if the electronic device 100 previously caused the music application to pause playing the audio due to the playback priority policy, rather than the user actively If the trigger operation causes the music application to pause playing audio, the electronic device 100 can automatically continue playing the audio in the music application.
  • 9A-9C exemplarily show how the electronic device 100 outputs audio when switching from a high-priority audio application to a low-priority audio application.
  • the audio application 1 may be an instant messaging application
  • the audio application 2 may be a music application.
  • the priority of music applications is lower than that of instant messaging applications.
  • the electronic device 100 first establishes a voice call connection with the electronic device used by the contact "Lily", and displays the message shown in FIG. 9A on the desktop.
  • the electronic device 100 displays the user interface 1001 of the music application as shown in FIG. 9B on the desktop.
  • the electronic device 100 receives the user's input operation (for example, click) on the pause/play control 1002 in the user interface 1001, and in response to the user's input operation, the electronic device 100 displays on the desktop as shown in Figure 9C
  • the prompt bar 901 of the music application can be "before playing music, please end the ongoing voice call first", and the prompt content in the prompt bar 901 can also be "the current ongoing voice call cannot play music” and so on.
  • the electronic device 100 can output a prompt message to prevent the electronic device 100 from directly switching to a low-priority audio application to play audio, and the application user experience.
  • 10A-10C exemplarily show how the electronic device 100 outputs audio when audio applications of the same priority are switched.
  • the audio application 1 may be a music application
  • the audio application 2 may be a video application.
  • Music apps have the same priority as video apps.
  • the electronic device 10 plays music through a music application.
  • the electronic device 100 displays a user interface 1001 of a music application as shown in FIG. 10A on the desktop.
  • the electronic device 100 receives the user's input operation (for example, double-click) on the video icon on the desktop, and the electronic device 100 displays the main user interface 1101 of the video application as shown in FIG. 10B .
  • the main user interface 1101 includes icons of multiple videos, such as the icon 1102 of Video A.
  • the electronic device 100 receives the user's input operation on the icon 1102 , and the electronic device 100 will display the playback interface of the video A. Since the priority of the music application is the same as that of the video application, as shown in FIG. 10C , the electronic device 100 can directly control the music application to pause playing music.
  • the display form of the pause/play control 1002 in the user interface 1001 is displayed as a paused state.
  • the electronic device 100 displays a video playback interface 1103 of the video A, and the video playback interface 1103 may include a playback control, a previous episode control, a next episode control, a collection control, and the like. While the electronic device 100 displays the video playing interface 1103 , the electronic device 100 controls the video application to play the audio in the video A.
  • the electronic device 100 finishes playing the video by the video application, if the electronic device 100 previously made the music application pause playing the audio due to the playback priority policy, rather than the user actively triggering an operation to make the music application pause playing the audio, the electronic device 100
  • the audio in the music application can be played automatically, and the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a playing state, that is, after the video is played, the electronic device 100 can automatically continue to play the music Audio in the app.
  • the electronic device 100 makes a voice call with the contact through the real-time voice/real-time video application one, and then, the real-time voice/real-time video
  • the contact person of the second real-time video application also initiates a voice call request to the user.
  • a prompt message is first output, which is used to remind the user that after accepting the voice call request from a contact in real-time voice/real-time video application 2, the communication with the real-time voice /Real-time video application one and contact one voice call.
  • the electronic device 100 can output prompt information, prompting whether to switch the voice call, which improves user experience.
  • the electronic device 100 determines whether to switch based on the playing time. That is to say, the priority of the audio played later is always higher than that of the audio played before. In the case of switching between non-real-time voice/real-time video applications, the electronic device 100 may directly switch. When it is necessary to switch the real-time audio/real-time video application to another audio application, the electronic device 100 may output a prompt message, so as to avoid sudden switching of the voice call and affect user experience.
  • FIG. 11 exemplarily shows another timing diagram for playing multiple channels of audio at the same time provided by the embodiment of the present application.
  • the low-priority application may be a music application
  • the high-priority application may be a real-time voice/real-time video application.
  • the electronic device 100 receives the user's operation and starts to play the song in the music application. After a period of time (for example, 360 ms), the electronic device 100 receives the user's operation and accesses the electronic device sent by the contact "Lily". voice calls. As shown in FIG. 11 , after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 can play the voice of the contact "Lily", and at the same time, the electronic device 100 pauses playing music in the application. song.
  • the electronic device 100 pauses playing the songs in the music application. That is to say, when the electronic device 100 is playing the audio in the high-priority application, it will pause the audio in the low-priority application, so as to prevent the user from hearing the sound mixing effect caused by multiple channels of audio playing at the same time.
  • the voice call in the real-time voice/real-time video application lasts for 480ms, for example, at 840ms, the voice call ends, and the electronic device 100 pauses playing the real-time voice in the call application. The electronic device 100 continues to play the songs in the music application.
  • FIG. 12 exemplarily shows a schematic flowchart of an audio playback method provided by an embodiment of the present application.
  • the electronic device 100 plays a first audio file in a first application, and acquires a playing process number of the first application and a process number of a window displayed by the electronic device.
  • the electronic device receives a first operation of the user, where the first operation is used to control the second application to play the second audio file.
  • the first application may be the audio application 1 (such as a music application) introduced in the foregoing embodiments.
  • the playing process number of the first application may be the process number one of the audio application 1 introduced in the foregoing embodiments.
  • the first operation may be an input operation (eg, click) on the receiving control 1004 in FIG. 8A .
  • the second application may be the audio application 2 (such as an instant messaging application) introduced in the foregoing embodiments.
  • the first application may also be the audio application 2 (such as an instant messaging application) introduced in the foregoing embodiments.
  • the playback process number of the first application may be the process number two of the audio application 2 described in the foregoing embodiments.
  • the first operation may be an input operation (eg, click) on the pause/play control 1002 in FIG. 9B .
  • the second application may be the audio application 1 (such as a music application) introduced in the foregoing embodiments.
  • the first application may also be the audio application 1 (such as a music application) introduced in the foregoing embodiments.
  • the playing process number of the first application may be the process number one of the audio application 1 introduced in the foregoing embodiments.
  • the first operation may be an input operation for the icon 1102 in 10B.
  • the second application may be the audio application 2 (such as a video application) introduced in the foregoing embodiments.
  • the electronic device determines, from the windows displayed by the electronic device, a target window whose process ID is the playing process ID of the first application.
  • the window displayed by the electronic device includes a parent window displayed by the electronic device, and a child window associated with the parent window displayed by the electronic device.
  • the parent window displayed by the electronic device may include multiple, and the child windows associated with each parent window displayed by the electronic device may also include multiple.
  • the electronic device may determine based on the playing sequence that the first application is paused for playing. Exemplarily, since the playing time of the second application is later than the playing time of the first application, the electronic device determines that it is the first application that is suspended for playing.
  • the electronic device may determine based on preset application priorities that the first application is paused for playback. Exemplarily, because the priority of the second application is the priority of the first application, the electronic device determines that the first application is paused.
  • the electronic device may determine, based on the type of the audio file played by the application, that the first application is paused.
  • the electronic device may determine, based on the preset application priority and the type of the audio file played by the application, that it is the first application that is paused for playback.
  • the electronic device determines, from the windows displayed by the electronic device, the target window whose process number is the playing process number of the first application, specifically including: in response to the first operation, the electronic device determines, based on the priority of the first application and The priority of the second application determines the target window whose process number is the playback process number of the first application from the windows displayed on the electronic device. In this way, the electronic device can automatically control the application to pause and play audio based on the preset application priority.
  • the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: If the priority is lower than that of the second application, the electronic device determines the target window whose process number is the playing process number of the first application from the windows displayed on the electronic device.
  • the electronic device continues to play the first audio file in the first application, and does not play the second audio file in the second application.
  • the electronic device When the priority of the first application is the same as that of the second application, the electronic device outputs first prompt information, and the first prompt information is used to prompt the user to pause the playback before playing the second audio file in the second application A first audio file in a first application. In this way, the user may be prompted to pause playing the first audio file in the first application.
  • the electronic device determines, from the windows displayed by the electronic device, the target window whose process number is the playing process number of the first application, which specifically includes: in response to the first operation, the electronic device determines, based on the first audio The type of the file and the type of the second audio file determine the target window whose process number is the playing process number of the first application from the windows displayed on the electronic device. In this way, the electronic device can also automatically control the application to pause playing audio based on the type of the audio file played in the application.
  • the electronic device may also determine from the window displayed by the electronic device that the process number is the first based on the priority of the first application and the priority of the second application, the type of the first audio file, and the type of the second audio file.
  • the target window of the application's playback process ID In this way, the electronic device can also automatically control the application to pause and play audio based on the preset priority of the application and the type of the audio file played in the application.
  • the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: If the second audio file is a non-real-time audio file and the type of the second audio file is a real-time audio file, the electronic device determines the target window whose process ID is the playback process ID of the first application from the windows displayed on the electronic device. In other words, real-time audio files have the highest priority.
  • the method further includes: when the type of the first audio file is a real-time audio file, the electronic device outputs second prompt information, The second prompt information is used to instruct the user to pause playing the first audio file of the first application; the electronic device controls the playback process of the first application corresponding to the target window to stop playing the first audio file, and controls the second application to play the second audio file, Specifically, the electronic device receives the user's second operation, and in response to the second operation, the electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, and controls the second application to play the second audio file. In this way, since the real-time audio file has the highest priority, the electronic device can avoid switching the real-time audio file to a non-real-time audio file, thereby affecting user experience.
  • the electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, and controls the second application to play the second audio file.
  • the electronic device controls the playback process of the first application corresponding to the target window to pause the playback of the first audio file, specifically including: the electronic device obtains the identifier of the target window, and simulates a virtual space key value; the electronic device will The identification of the target window and the virtual space key value are sent to the playback process of the first application; the electronic device controls the first application to pause the playback of the first application based on the identification of the target window and the virtual space key value through the playback process of the first application corresponding to the target window an audio file.
  • the electronic device simulates a virtual space key value, and the user does not need to operate the space key on the keyboard to obtain the space key value, which reduces user operations.
  • the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, which specifically includes: the electronic device sequentially traverses each parent window displayed in the electronic device, and determines that the process number is the first application's The target parent window of the playback process number; the electronic device controls the playback process of the first application corresponding to the target parent window to stop playing the first audio file; or, the electronic device traverses each parent window in the electronic device in turn, and determines that the process number is the first The target parent window of the playback process number of an application; in the case that the electronic device fails to control the playback process of the first application corresponding to the target parent window to stop playing the first audio file, the electronic device traverses in turn each parent window associated with the electronic device display For each sub-window of each sub-window, obtain the target sub-window whose process ID is the playback process ID, or, the electronic device sequentially traverses each sub-window associated with the target parent window displayed by the electronic device, and acquires the target
  • the electronic device first judges whether the target parent window can pause and play audio, and if so, it does not need to traverse the target sub-window, which saves the time for the electronic device to search for the target sub-window. If not, the electronic device traverses the target sub-window again.
  • the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, which specifically includes: the electronic device sequentially traverses each parent window displayed in the electronic device, and determines that the process number is the first application's The target parent window of the playback process number; the electronic device traverses each sub-window displayed in the electronic device in turn, and determines the target sub-window whose process number is the playback process number of the first application, or the electronic device traverses the target displayed by the electronic device in turn For each child window associated with the parent window, determine the target child window whose process number is the playing process number of the first application; the electronic device controls the playing process of the first application corresponding to the target parent window and the target child window to stop playing the first audio file .
  • the window implementing the playing logic is either the target child window or the target parent window, and the electronic device can directly obtain the target parent window and the target child window, so that the control application agrees to play audio.
  • the method further includes: the electronic device receives a third user operation, and the third operation is used to control the second application to pause playing the second audio file; responding In the third operation, the electronic device controls the second application to pause playing the second audio file, and controls the first application to continue playing the first audio file.
  • the electronic device can control the application that pauses playing the audio due to the system device instead of the user actively triggering the operation to automatically start playing the audio again, which saves user operations.
  • the electronic device receives a fourth user operation, and the fourth operation is used to control the first application to pause playing the first audio file; in response to the fourth operation, the electronic device controls the first application to pause playing the first audio file, and controls the first application The second application continues to pause and play the second audio file. In this way, the electronic device will not control the application that pauses to play the audio due to the active trigger operation of the user to automatically start playing the audio again, so as to avoid conflicts with the user's wishes.
  • the embodiment of the present application also provides an electronic device, the electronic device includes: one or more processors, one or more memories; one or more memories are coupled with one or more processors, and one or more memories are used for Computer program codes are stored, and the computer program codes include computer instructions, and one or more processors call the computer instructions to make the electronic device execute an audio playback method shown in FIG. 12 .
  • a computer program product includes one or more computer instructions.
  • Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g. Coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) to another website site, computer, server or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server, a data center, etc. integrated with one or more available media.
  • the usable medium may be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (solid state disk, SSD)), etc.
  • the processes can be completed by computer programs to instruct related hardware.
  • the programs can be stored in computer-readable storage media.
  • When the programs are executed may include the processes of the foregoing method embodiments.
  • the aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk, and other various media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)
  • Telephone Function (AREA)

Abstract

An audio playback method and a related apparatus. The method comprises: when an electronic device detects that audios in two different applications are output at a same moment, the electronic device determines, on the basis of a factor such as preset priority, or a playback sequence, or an audio type, which application needs to be paused to pause playback of the audio; then, the electronic device determines, on the basis of windows displayed by the application needing to pause the playback of the audio, a target window implementing playback logic; and finally, the electronic device controls, on the basis of a playback progress corresponding to the target window, the application to pause playback of the audio, and controls the other application to start the playback of the audio. In this way, the electronic device controls that only one audio can be played back at the same moment, thereby improving user experience.

Description

一种音频播放方法及相关装置A kind of audio playing method and related device
本申请要求于2021年12月24日提交中国专利局、申请号为202111605105.6、申请名称为“一种音频播放方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202111605105.6 and the application title "An Audio Playing Method and Related Device" submitted to the China Patent Office on December 24, 2021, the entire contents of which are incorporated by reference in this application middle.
技术领域technical field
本申请音频处理技术领域,尤其涉及一种音频播放方法及相关装置。The technical field of audio processing of the present application, in particular, relates to an audio playback method and related devices.
背景技术Background technique
目前,许多电子设备(例如个人电脑)在仅运行一个音频应用程序时,可以流畅地播放该应用中的音频文件,但是当多个不同类型的音频应用程序一起运行时,虽然都可以正常的播放,但是多个不同类型的应用同时输出不同的音频文件,相互之间可能产生干扰而给用户带来比较混乱的感觉。At present, many electronic devices (such as personal computers) can smoothly play the audio files in the application when only one audio application is running, but when multiple audio applications of different types are running together, although they can all be played normally , but multiple applications of different types output different audio files at the same time, which may interfere with each other and bring confusion to the user.
因此,如何避免多路音频同时输出因混音而导致混乱是亟待解决的问题。Therefore, it is an urgent problem to be solved how to avoid confusion caused by simultaneous output of multiple audio channels due to sound mixing.
发明内容Contents of the invention
本申请提供了一种音频播放方法及相关装置,实现了在同一时刻有且仅有一路音频文件输出,避免了多路音频同时输出因混音而导致混乱,提高了用户体验。The present application provides an audio playback method and a related device, which realize the output of one and only one audio file at the same time, avoid confusion caused by simultaneous output of multiple audio channels due to sound mixing, and improve user experience.
第一方面,本申请提供了一种音频播放方法,包括:电子设备播放第一应用中的第一音频文件,并获取到第一应用的播放进程号和电子设备显示的窗口的进程号;电子设备接收用户的第一操作,第一操作用于控制第二应用播放第二音频文件;响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口;电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,并控制第二应用播放第二音频文件。In the first aspect, the present application provides an audio playback method, including: the electronic device plays the first audio file in the first application, and obtains the playback process number of the first application and the process number of the window displayed by the electronic device; The device receives the user's first operation, and the first operation is used to control the second application to play the second audio file; in response to the first operation, the electronic device determines the process number from the window displayed on the electronic device as the playing process number of the first application the target window; the electronic device controls the playing process of the first application corresponding to the target window to pause and play the first audio file, and controls the second application to play the second audio file.
其中,电子设备显示的窗口包括电子设备显示的父窗口,和电子设备显示的父窗口关联的子窗口。电子设备显示的父窗口可以包括多个,电子设备显示的每一个父窗口关联的子窗口也可以包括多个。Wherein, the window displayed by the electronic device includes a parent window displayed by the electronic device, and a child window associated with the parent window displayed by the electronic device. The parent window displayed by the electronic device may include multiple, and the child windows associated with each parent window displayed by the electronic device may also include multiple.
可选的,电子设备可以基于播放顺序确定出暂停播放的是第一应用。示例性的,由于第二应用的播放时间晚于第一应用的播放时间,则电子设备确定出暂停播放的是第一应用。Optionally, the electronic device may determine based on the playing sequence that the first application is paused for playing. Exemplarily, since the playing time of the second application is later than the playing time of the first application, the electronic device determines that it is the first application that is suspended for playing.
可选的,电子设备可以基于预设的应用优先级确定出暂停播放的是第一应用。示例性的,由于第二应用的优先级第一应用的优先级,则电子设备确定出暂停播放的是第一应用。Optionally, the electronic device may determine based on preset application priorities that the first application is paused for playback. Exemplarily, because the priority of the second application is the priority of the first application, the electronic device determines that the first application is paused.
可选的,电子设备可以基于应用播放的音频文件类型确定出暂停播放的是第一应用。Optionally, the electronic device may determine, based on the type of the audio file played by the application, that the first application is paused.
可选的,电子设备可以同时基于预设的应用优先级和应用播放的音频文件类型确定出暂停播放的是第一应用。Optionally, the electronic device may determine, based on the preset application priority and the type of the audio file played by the application, that it is the first application that is paused for playback.
通过第一方面提供的一种音频播放方法,实现了在同一时刻有且仅有一路音频文件输出,避免了多路音频同时输出因混音而导致混乱,提高了用户体验。Through the audio playback method provided in the first aspect, one and only one audio file is output at the same time, avoiding confusion caused by simultaneous output of multiple audio channels due to sound mixing, and improving user experience.
结合第一方面,在一种可能的实现方式中,电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,具体包括:电子设备获取到目标窗口的标识,并模拟出虚拟 的空格键space key值;电子设备将目标窗口的标识和虚拟的space key值发送至第一应用的播放进程;电子设备通过目标窗口对应的第一应用的播放进程基于目标窗口的标识和虚拟的space key值控制第一应用暂停播放第一音频文件。这样,电子设备模拟出虚拟的space key值,不需要用户操作键盘上的空格键得到space key值,即可自动控制第一应用暂停播放第一音频文件。With reference to the first aspect, in a possible implementation manner, the electronic device controls the playback process of the first application corresponding to the target window to pause the playback of the first audio file, which specifically includes: the electronic device obtains the identifier of the target window, and simulates a virtual The space key value of the space key; the electronic device sends the identification of the target window and the virtual space key value to the playback process of the first application; the electronic device uses the playback process of the first application corresponding to the target window based on the identification of the target window and the virtual space key The space key value controls the first application to pause playing the first audio file. In this way, the electronic device simulates a virtual space key value, and can automatically control the first application to pause and play the first audio file without the user operating the space bar on the keyboard to obtain the space key value.
结合第一方面,在一种可能的实现方式中,响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:响应于第一操作,电子设备基于第一应用的优先级和第二应用的优先级,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。这样,电子设备可以基于预设的应用优先级,实现自动控制应用暂停播放音频。With reference to the first aspect, in a possible implementation manner, in response to the first operation, the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: responding to In the first operation, the electronic device determines the target window whose process number is the playback process number of the first application from the windows displayed by the electronic device based on the priority of the first application and the priority of the second application. In this way, the electronic device can automatically control the application to pause and play audio based on the preset application priority.
结合第一方面,在一种可能的实现方式中,电子设备基于第一应用的优先级和第二应用的优先级,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:在第一应用的优先级低于第二应用的优先级的情况下,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。With reference to the first aspect, in a possible implementation manner, based on the priority of the first application and the priority of the second application, the electronic device determines the process number from the window displayed on the electronic device as the playback process number of the first application The target window specifically includes: when the priority of the first application is lower than that of the second application, the electronic device determines the target window whose process number is the playback process number of the first application from the windows displayed on the electronic device .
结合第一方面,在一种可能的实现方式中,在第一应用的优先级高于第二应用的优先级的情况下,电子设备继续播放第一应用中的第一音频文件,不播放第二应用中的第二音频文件。可选的,在一种实现方式中,在第一应用的优先级高于第二应用的优先级的情况下,在电子设备接收导用于控制第二应用播放第二音频文件的第一操作之后,电子设备可以先播放第二应用中的第二音频文件,即同时播放第一音频文件和第二音频文件;然后再采取与本申请各实施例中描述的暂停播放第一音频文件类似的方案暂停播放第二音频文件。即,遍历得到第二应用的目标窗口,然后发送模拟的space key值使得第二应用暂停播放第二音频文件。使得电子设备继续播放第一音频文件,而不播放第二音频文件。With reference to the first aspect, in a possible implementation manner, when the priority of the first application is higher than the priority of the second application, the electronic device continues to play the first audio file in the first application, and does not play the first audio file in the first application. A second audio file in the second application. Optionally, in an implementation manner, when the priority of the first application is higher than the priority of the second application, when the electronic device receives the first operation for controlling the second application to play the second audio file After that, the electronic device can first play the second audio file in the second application, that is, play the first audio file and the second audio file at the same time; The program pauses playing the second audio file. That is, the target window of the second application is obtained by traversing, and then the simulated space key value is sent to make the second application pause and play the second audio file. The electronic device is made to continue playing the first audio file without playing the second audio file.
结合第一方面,在一种可能的实现方式中,方法还包括:在第一应用的优先级与第二应用的优先级相同的情况下,电子设备输出第一提示信息,第一提示信息用于提示用户在播放第二应用中的第二音频文件之前,暂停播放第一应用中的第一音频文件。这样,可以提示用户暂停播放第一应用中的第一音频文件。With reference to the first aspect, in a possible implementation manner, the method further includes: when the priority of the first application is the same as that of the second application, the electronic device outputs first prompt information, and the first prompt information uses Before prompting the user to play the second audio file in the second application, playing the first audio file in the first application is paused. In this way, the user may be prompted to pause playing the first audio file in the first application.
结合第一方面,在一种可能的实现方式中,响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:响应于第一操作,电子设备基于第一音频文件的类型和第二音频文件的类型,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。这样,电子设备还可以基于应用中播放的音频文件的类型,实现自动控制应用暂停播放音频。With reference to the first aspect, in a possible implementation manner, in response to the first operation, the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: responding to In the first operation, based on the type of the first audio file and the type of the second audio file, the electronic device determines the target window whose process number is the playing process number of the first application from the windows displayed by the electronic device. In this way, the electronic device can also automatically control the application to pause playing audio based on the type of the audio file played in the application.
结合第一方面,在一种可能的实现方式中,电子设备还可以基于第一应用的优先级和第二应用的优先级、第一音频文件的类型和第二音频文件的类型从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。这样,电子设备还可以基于应用预设的优先级和应用中播放的音频文件的类型,实现自动控制应用暂停播放音频。With reference to the first aspect, in a possible implementation, the electronic device may also display from the electronic device based on the priority of the first application and the priority of the second application, the type of the first audio file, and the type of the second audio file The target window whose process ID is the playing process ID of the first application is determined from the windows. In this way, the electronic device can also automatically control the application to pause and play audio based on the preset priority of the application and the type of the audio file played in the application.
结合第一方面,在一种可能的实现方式中,电子设备基于第一音频文件的类型和第二音频文件的类型,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:在第一音频文件的类型为非实时类音频文件,第二音频文件的类型为实时类音频文件的情况下,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。也就是说,实时类音频文件的优先级最高。With reference to the first aspect, in a possible implementation manner, based on the type of the first audio file and the type of the second audio file, the electronic device determines the process number from the window displayed on the electronic device as the playback process number of the first application The target window specifically includes: when the type of the first audio file is a non-real-time audio file and the type of the second audio file is a real-time audio file, the electronic device determines that the process number is The target window of the playback process ID of the first application. In other words, real-time audio files have the highest priority.
结合第一方面,在一种可能的实现方式中,在电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件之前,方法还包括:在第一音频文件的类型为实时类音频文件的情况下,电子设备输出第二提示信息,第二提示信息用于指示用户暂停播放第一应用的第一音频文件;电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件,并控制第二应用播放第二音频文件,具体包括:电子设备接收用户的第二操作,响应于第二操作,电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,并控制第二应用播放第二音频文件。这样,由于实时类音频文件的优先级最高,可以避免电子设备将实时类音频文件切换为非实时类音频文件,影响用户体验。With reference to the first aspect, in a possible implementation manner, before the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, the method further includes: when the type of the first audio file is real-time In the case of an audio file, the electronic device outputs second prompt information, and the second prompt information is used to instruct the user to pause playing the first audio file of the first application; the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file. audio file, and controlling the second application to play the second audio file, specifically includes: the electronic device receives the user's second operation, and in response to the second operation, the electronic device controls the playback process of the first application corresponding to the target window to pause playing the first audio file, and control the second application to play the second audio file. In this way, since the real-time audio file has the highest priority, the electronic device can avoid switching the real-time audio file to a non-real-time audio file, thereby affecting user experience.
结合第一方面,在一种可能的实现方式中,电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件,具体包括:电子设备依次遍历电子设备中显示的每一个父窗口,确定出进程号为第一应用的播放进程号的目标父窗口;电子设备控制目标父窗口对应的第一应用的播放进程停止播放第一音频文件;或者,电子设备依次遍历电子设备中的每一个父窗口,确定出进程号为第一应用的播放进程号的目标父窗口;在电子设备控制目标父窗口对应的第一应用的播放进程停止播放第一音频文件失败的情况下,电子设备依次遍历电子设备显示的每一个父窗口关联的每一个子窗口,获取到进程号为播放进程号的目标子窗口,或者,电子设备依次遍历电子设备显示的目标父窗口关联的每一个子窗口,获取到进程号为播放进程号的目标子窗口;电子设备控制目标子窗口对应的第一应用的播放进程停止播放第一音频文件。这样,电子设备先判断目标父窗口是否可以实现暂停播放音频,如果可以,则不需要遍历目标子窗口了,节省了电子设备查找目标子窗口的时间。若不可以,电子设备再遍历目标子窗口。With reference to the first aspect, in a possible implementation manner, the electronic device controls the playback process of the first application corresponding to the target window to stop playing the first audio file, specifically including: the electronic device sequentially traverses each parent window displayed on the electronic device , determine the target parent window whose process number is the playing process number of the first application; the electronic device controls the playing process of the first application corresponding to the target parent window to stop playing the first audio file; or, the electronic device sequentially traverses each A parent window, determine the target parent window whose process number is the playback process number of the first application; when the electronic device fails to control the playback process of the first application corresponding to the target parent window to stop playing the first audio file, the electronic device sequentially Traverse each child window associated with each parent window displayed by the electronic device, and obtain the target child window whose process number is the playback process number, or, the electronic device sequentially traverses each child window associated with the target parent window displayed by the electronic device, and obtain Go to the target sub-window whose process ID is the playback process ID; the electronic device controls the playback process of the first application corresponding to the target sub-window to stop playing the first audio file. In this way, the electronic device first judges whether the target parent window can pause and play audio, and if so, it does not need to traverse the target sub-window, which saves the time for the electronic device to search for the target sub-window. If not, the electronic device traverses the target sub-window again.
结合第一方面,在一种可能的实现方式中,电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件,具体包括:电子设备依次遍历电子设备中显示的每一个父窗口,确定出进程号为第一应用的播放进程号的目标父窗口;电子设备依次遍历电子设备中显示的每一个子窗口,确定出进程号为第一应用的播放进程号的目标子窗口,或者,电子设备依次遍历电子设备显示的目标父窗口关联的每一个子窗口,确定出进程号为第一应用的播放进程号的目标子窗口;电子设备控制目标父窗口和目标子窗口对应的第一应用的播放进程停止播放第一音频文件。这样,实现播放逻辑的窗口要么是目标子窗口要么是目标父窗口,电子设备直接获取到目标父窗口和目标子窗口,即可实现控制应用赞同播放音频。With reference to the first aspect, in a possible implementation manner, the electronic device controls the playback process of the first application corresponding to the target window to stop playing the first audio file, specifically including: the electronic device sequentially traverses each parent window displayed on the electronic device , determine the target parent window whose process number is the playing process number of the first application; the electronic device sequentially traverses each child window displayed in the electronic device, and determine the target child window whose process number is the playing process number of the first application, or , the electronic device sequentially traverses each sub-window associated with the target parent window displayed by the electronic device, and determines the target sub-window whose process number is the playback process number of the first application; The playing process of the application stops playing the first audio file. In this way, the window implementing the playing logic is either the target child window or the target parent window, and the electronic device can directly obtain the target parent window and the target child window, so that the control application agrees to play audio.
结合第一方面,在一种可能的实现方式中,在电子设备开始输出第二应用中的第二音频文件之后,方法还包括:电子设备接收用户的第三操作,第三操作用于控制第二应用暂停播放第二音频文件;响应于第三操作,电子设备控制第二应用暂停播放第二音频文件,控制第一应用继续播放第一音频文件。这样,电子设备可以将控制由于系统设备导致应用暂停播放音频而不是用户主动触发操作导致应用暂停播放音频的应用再次自动开始播放音频,节省了用户操作。With reference to the first aspect, in a possible implementation manner, after the electronic device starts to output the second audio file in the second application, the method further includes: the electronic device receives a third operation of the user, and the third operation is used to control the second audio file in the second application. The second application pauses playing the second audio file; in response to the third operation, the electronic device controls the second application to pause playing the second audio file, and controls the first application to continue playing the first audio file. In this way, the electronic device can control the application that pauses playing the audio due to the system device instead of the user actively triggering the operation to automatically start playing the audio again, which saves user operations.
结合第一方面,在一种可能的实现方式中,电子设备接收用户的第四操作,第四操作用于控制第一应用暂停播放第一音频文件;响应于第四操作,电子设备控制第一应用暂停播放第一音频文件,控制第二应用继续暂停播放第二音频文件。这样,电子设备不会将控制由于用户主动触发操作导致应用暂停播放音频的应用再次自动开始播放音频,避免与用户的意愿发生冲突。With reference to the first aspect, in a possible implementation manner, the electronic device receives a user's fourth operation, and the fourth operation is used to control the first application to pause playing the first audio file; in response to the fourth operation, the electronic device controls the first The application pauses to play the first audio file, and controls the second application to continue to pause and play the second audio file. In this way, the electronic device will not control the application that pauses to play the audio due to the active trigger operation of the user to automatically start playing the audio again, so as to avoid conflicts with the user's wishes.
第二方面,本申请实施例提供了一种电子设备,电子设备包括:一个或多个处理器、一个或多个存储器;一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器调用计算机指令以使得电子设备执行第一方面提供的一种音频播放方法。In the second aspect, the embodiment of the present application provides an electronic device, the electronic device includes: one or more processors, one or more memories; one or more memories are coupled with one or more processors, one or more The memory is used to store computer program codes, the computer program codes include computer instructions, and one or more processors call the computer instructions to make the electronic device execute the audio playing method provided in the first aspect.
第三方面,本申请实施例提供了一种电子设备,计算机可读存储介质,用于存储计算机指令,当计算机指令在电子设备上运行时,使得电子设备第一方面提供的一种音频播放方法。In the third aspect, the embodiment of the present application provides an electronic device, a computer-readable storage medium, which is used to store computer instructions, and when the computer instructions are run on the electronic device, the audio playback method provided by the first aspect of the electronic device is made .
第四方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备第一方面提供的一种音频播放方法。In a fourth aspect, an embodiment of the present application provides a computer program product, which, when the computer program product is run on the electronic device, enables the electronic device to perform the audio playback method provided in the first aspect.
其中,第二方面至第四方面的有益效果,请参考第一方面的有益效果,本申请实施例在此不再赘述。For the beneficial effects of the second aspect to the fourth aspect, please refer to the beneficial effects of the first aspect, which will not be repeated in this embodiment of the present application.
附图说明Description of drawings
图1A-图1E为本申请实施例提供的一组电子设备100同时播放多路音频的示意图;FIG. 1A-FIG. 1E are schematic diagrams of a set of electronic devices 100 playing multiple channels of audio at the same time provided by the embodiment of the present application;
图2为本申请实施例提供的一种电子设备100同时播放多路音频的时序图;FIG. 2 is a timing diagram of an electronic device 100 playing multiple channels of audio simultaneously according to an embodiment of the present application;
图3为本申请实施例提供的一种电子设备100的结构示意图;FIG. 3 is a schematic structural diagram of an electronic device 100 provided in an embodiment of the present application;
图4为本申请实施例提供的一种电子设备100如何控制在同一时刻仅有一路音频可以播放出来的功能模块示意图;Fig. 4 is a schematic diagram of functional modules of how an electronic device 100 controls only one channel of audio to be played at the same time provided by the embodiment of the present application;
图5为本申请实施例提供的一种跨进程管理模块430在控制音频类应用1停止播放音乐后,如何控制音频类应用1继续播放音乐的功能模块示意图;FIG. 5 is a schematic diagram of how to control the audio application 1 to continue playing music after the cross-process management module 430 in the embodiment of the present application controls the audio application 1 to stop playing music;
图6A-图6B为本申请实施例提供的一种父窗口和子窗口的示意图;6A-6B are schematic diagrams of a parent window and a child window provided by the embodiment of the present application;
图7A为本申请实施例提供的一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图;FIG. 7A is a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction provided by the embodiment of the present application;
图7B为本申请实施例提供的另一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图;FIG. 7B is a schematic diagram of how another cross-process management module 430 according to the embodiment of the present application controls the audio application 1 to stop playing audio based on the process number one and the pause instruction;
图7C为本申请实施例提供的又一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图;FIG. 7C is a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction provided by the embodiment of the present application;
图7D为本申请实施例提供的再一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图;FIG. 7D is a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction provided by the embodiment of the present application;
图8A-图8B为本申请实施例提供的一组由低优先级的音频类应用切换为高优先级的音频类应用时,电子设备100如何输出音频的示意图;8A-8B are schematic diagrams of how the electronic device 100 outputs audio when a group of low-priority audio applications are switched to high-priority audio applications provided by the embodiment of the present application;
图9A-图9C为本申请实施例提供的一组由高优先级的音频类应用切换为低优先级的音频类应用时,电子设备100如何输出音频的示意图;9A-9C are schematic diagrams of how the electronic device 100 outputs audio when a group of high-priority audio applications are switched to low-priority audio applications provided by the embodiment of the present application;
图10A-图10C为本申请实施例提供的一组相同优先级的音频类应用在切换时,电子设备100如何输出音频的示意图;10A-10C are schematic diagrams of how the electronic device 100 outputs audio when a group of audio applications with the same priority are switched according to the embodiment of the present application;
图11为本申请实施例提供的另一种同时播放多路音频的时序图;FIG. 11 is another timing diagram for playing multiple channels of audio at the same time provided by the embodiment of the present application;
图12为本申请实施例提供的一种音频播放方法的流程示意图。FIG. 12 is a schematic flowchart of an audio playback method provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图对本申请实施例中的技术方案进行清楚、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. Among them, in the description of the embodiments of this application, unless otherwise specified, "/" means or means, for example, A/B can mean A or B; "and/or" in the text is only a description of associated objects The association relationship indicates that there may be three kinds of relationships, for example, A and/or B, which may indicate: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiment of the present application , "plurality" means two or more than two.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are used for descriptive purposes only, and cannot be understood as implying or implying relative importance or implicitly specifying the quantity of indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present application, unless otherwise specified, the "multiple" The meaning is two or more.
本申请以下实施例中的术语“用户界面(user interface,UI)”,是应用程序或操作系统与用户之间进行交互和信息交换的介质接口,它实现信息的内部形式与用户可以接受形式之间的转换。用户界面是通过java、可扩展标记语言(extensible markup language,XML)等特定计算机语言编写的源代码,界面源代码在电子设备上经过解析,渲染,最终呈现为用户可以识别的内容。用户界面常用的表现形式是图形用户界面(graphic user interface,GUI),是指采用图形方式显示的与计算机操作相关的用户界面。它可以是在电子设备的显示屏中显示的文本、图标、按钮、菜单、选项卡、文本框、对话框、状态栏、导航栏、Widget等可视的界面元素。The term "user interface (UI)" in the following embodiments of this application is a medium interface for interaction and information exchange between an application program or an operating system and a user, and it realizes the difference between the internal form of information and the form acceptable to the user. conversion between. The user interface is the source code written in a specific computer language such as java and extensible markup language (XML). The source code of the interface is parsed and rendered on the electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is the graphical user interface (graphic user interface, GUI), which refers to the user interface related to computer operation displayed in a graphical way. It may be text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, Widgets, and other visible interface elements displayed on the display screen of the electronic device.
目前,对于搭载Windows @或者其它操作系统的电子设备100(例如个人电脑(personal computer,PC)),由于电子设备100上的操作系统没有多路音频播放控制策略,导致电子设备100在同时播放多路音频时,电子设备100会将多路音频同时播放出来,用户听到的音频效果为混音效果。 At present, for an electronic device 100 (such as a personal computer (PC)) equipped with Windows @ or other operating systems, since the operating system on the electronic device 100 does not have a multi-channel audio playback control strategy, the electronic device 100 is playing multiple audio channels at the same time. When there are multiple channels of audio, the electronic device 100 will play multiple channels of audio at the same time, and the audio effect heard by the user is a sound mixing effect.
示例性的,图1A-图1E示例性示出了电子设备100同时播放多路音频的示意图。Exemplarily, FIG. 1A-FIG. 1E exemplarily show schematic diagrams in which the electronic device 100 plays multiple channels of audio at the same time.
图1A示例性示出了电子设备100的桌面。桌面可以包括一个或多个应用程序的图标、通知栏等。其中,一个或多个应用程序的图标包括但不仅限于此电脑应用的图标、回收站应用的图标、即时通信类应用的图标、音乐应用的图标和视频应用的图标。通话栏可以包括时间指示符、音量指示符、搜索区域等等。FIG. 1A exemplarily shows a desktop of an electronic device 100 . The desktop may include icons for one or more applications, a notification bar, and the like. Wherein, the icons of one or more application programs include, but are not limited to, icons of computer applications, icons of recycle bin applications, icons of instant messaging applications, icons of music applications, and icons of video applications. The talk bar can include time indicators, volume indicators, search areas, and more.
如图1A所示,电子设备100接收针对音乐应用的图标的输入操作(例如双击操作),电子设备100在桌面上显示如图1B所示的音乐应用的用户界面1001。用户界面1001可以理解为音乐应用的主用户界面。用户界面1001包括有音乐应用的主题区域、推荐歌曲区域和音乐播放区域。其中,主题区域包括歌手、排行、歌单和电台等。推荐歌曲区域宝库有多个推荐的歌曲,例如“歌曲1-歌手1”、“歌曲2-歌手2”和“歌曲3-歌手3”。音乐播放区域包括有歌曲的名称“歌曲A”,暂停/播放控件1002、上一曲控件、下一曲控件、音量调节进度条等等。从图1A可以看出,音乐播放区域中的待播放歌曲“歌曲A”已暂停播放。As shown in FIG. 1A , the electronic device 100 receives an input operation (for example, a double-click operation) on an icon of a music application, and the electronic device 100 displays a user interface 1001 of the music application on the desktop as shown in FIG. 1B . The user interface 1001 can be understood as the main user interface of the music application. The user interface 1001 includes a music application theme area, a recommended song area and a music playing area. Among them, the theme area includes singers, rankings, song lists and radio stations. There are multiple recommended songs in the recommended song area treasure house, such as "song 1-singer 1", "song 2-singer 2" and "song 3-singer 3". The music playing area includes the name of the song "song A", a pause/play control 1002, a previous song control, a next song control, a volume adjustment progress bar, and the like. It can be seen from FIG. 1A that the song "Song A" to be played in the music playing area has been paused.
如图1B所示,电子设备100接收针对音乐播放区域中暂停/播放控件1002的输入操作(例如单击操作),如图1C所示,电子设备100开始播放歌曲“歌曲A”。这样,用户可以听见电子设备100播放的歌曲。As shown in FIG. 1B , the electronic device 100 receives an input operation (such as a click operation) on the pause/play control 1002 in the music playing area, and as shown in FIG. 1C , the electronic device 100 starts to play the song "song A". In this way, the user can hear the song played by the electronic device 100 .
如图1D所示,在电子设备100播放音乐的过程中,电子设备100接收到其他电子设备发送的语音通话请求,电子设备100在桌面上显示提示栏1003。提示栏1003包括有提示信息“Lily邀请你进行语音通话”,提示栏1003还包括有接收控件1004和拒绝控件1005。如 图1D所示,电子设备100接收用户针对提示栏1003中的接收控件1004的输入操作(例如单击),电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接。As shown in FIG. 1D , when the electronic device 100 is playing music, the electronic device 100 receives a voice call request sent by other electronic devices, and the electronic device 100 displays a prompt bar 1003 on the desktop. The prompt bar 1003 includes a prompt message "Lily invites you to make a voice call", and the prompt bar 1003 also includes a receiving control 1004 and a rejecting control 1005 . As shown in FIG. 1D , the electronic device 100 receives the user's input operation (such as clicking) on the receiving control 1004 in the prompt bar 1003, and the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily".
如图1E所示,电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接后,电子设备100在桌面上显示语音通话用户界面1006。用户界面1006可显示通话时长(例如时长为8秒),用户界面1006还包括静音控件、拒绝控件和音量控件等。如图1E所示,在电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接后,电子设备100不会暂停音乐应用正在播放的音乐,电子设备100继续播放歌曲“歌曲A”。同时,电子设备100也可以播放出联系人“Lily”的语音,语音内容可以是“稍等两分钟,等待其他人上线”。As shown in FIG. 1E , after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 displays a voice call user interface 1006 on the desktop. The user interface 1006 can display the call duration (for example, the duration is 8 seconds), and the user interface 1006 also includes a mute control, a rejection control, a volume control, and the like. As shown in FIG. 1E , after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 will not pause the music being played by the music application, and the electronic device 100 will continue to play the song "Song A" . At the same time, the electronic device 100 may also play the voice of the contact "Lily", and the content of the voice may be "wait for two minutes and wait for other people to go online".
为了更清楚的展示电子设备100是同时播放多路音频的,图2示例性示出了电子设备100同时播放多路音频的时序图。In order to more clearly show that the electronic device 100 plays multiple channels of audio at the same time, FIG. 2 exemplarily shows a timing diagram of the electronic device 100 playing multiple channels of audio at the same time.
在图2中,0ms时,电子设备100接收用户的操作开始播放音乐应用中的歌曲,一段时间(例如360ms)后,电子设备100接收用户操作接入了联系人“Lily”使用的电子设备发送的语音通话。如图2所示,在电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接后,电子设备100可以播放出联系人“Lily”的语音。例如,若通话时长为480ms,那么电子设备100在0ms-480ms内播放联系人“Lily”的语音时,电子设备100还在继续播放音乐应用中的歌曲。也就是说,电子设备100将音乐应用中360ms-840ms之间的歌曲与通话应用中0ms-480ms之间的实时语音重叠播放,用户在这段时间内听到的是混音效果。在实时语音/实时视频类中的实时语音持续了480ms后,语音通话结束,电子设备100暂停播放通话应用中的实时语音。电子设备100还是继续播放音乐应用中的歌曲。In FIG. 2, at 0 ms, the electronic device 100 receives the user's operation and starts to play the song in the music application. After a period of time (for example, 360 ms), the electronic device 100 receives the user's operation and accesses the electronic device sent by the contact "Lily". voice calls. As shown in FIG. 2 , after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 may play the voice of the contact "Lily". For example, if the call duration is 480ms, when the electronic device 100 plays the voice of the contact "Lily" within 0ms-480ms, the electronic device 100 continues to play the songs in the music application. That is to say, the electronic device 100 overlaps and plays the song between 360ms-840ms in the music application and the real-time voice between 0ms-480ms in the call application, and what the user hears during this period is the sound mixing effect. After the real-time voice in the real-time voice/real-time video category lasts for 480ms, the voice call ends, and the electronic device 100 suspends playing the real-time voice in the calling application. The electronic device 100 still continues to play the songs in the music application.
从上述分析可知,电子设备100在播放多路音频时,电子设备100将多路音频重叠播放出来,用户听到的是混音效果,用户体验不好。在用户一边听音乐或者看电影的过程中,用户通过电子设备100接入了一个语音通话。用户在进行语音通话的过程中,音乐或者电影还在持续播放,那么会造成用户错过好听的音乐片段或者精彩的电影片段,用户体验不好。It can be known from the above analysis that when the electronic device 100 plays multiple channels of audio, the electronic device 100 plays the multiple channels of audio overlappingly, and what the user hears is a sound mixing effect, and the user experience is not good. While the user is listening to music or watching a movie, the user accesses a voice call through the electronic device 100 . When the user is making a voice call, music or movies are still playing continuously, which will cause the user to miss nice music clips or wonderful movie clips, and the user experience is not good.
基于此,本申请实施例提供了一种音频播放方法,该方法可以应用于安装有Windows @或者其它操作系统的电子设备100,方法包括:电子设备播放第一应用中的第一音频文件,并获取到第一应用的播放进程号和电子设备显示的窗口的进程号;电子设备接收用户的第一操作,第一操作用于控制第二应用播放第二音频文件;响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口;电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,并控制第二应用播放第二音频文件。这样,不需要用户主动触发就可以实现电子设备100在同一时刻仅有一路音频可以播放出来,提高了用户体验。 Based on this, the embodiment of the present application provides an audio playback method, which can be applied to an electronic device 100 installed with Windows @ or other operating systems, the method includes: the electronic device plays the first audio file in the first application, and Obtain the playback process number of the first application and the process number of the window displayed by the electronic device; the electronic device receives the first operation of the user, and the first operation is used to control the second application to play the second audio file; in response to the first operation, the electronic device The device determines from the windows displayed by the electronic device the target window whose process number is the playback process number of the first application; the electronic device controls the playback process of the first application corresponding to the target window to pause and play the first audio file, and controls the second application to play the second audio file. In this way, only one channel of audio can be played by the electronic device 100 at the same time without active triggering by the user, which improves user experience.
对于电子设备100如何控制同一时刻仅有一路音频输出的,将在后续实施例中详细介绍,本申请实施例在此不做赘述。How the electronic device 100 controls only one audio output at a time will be described in detail in subsequent embodiments, and details will not be described here in this embodiment of the present application.
图3示例性示出了电子设备100的结构示意图。FIG. 3 exemplarily shows a schematic structural diagram of the electronic device 100 .
电子设备100可以是搭载Windows @或者其它操作系统的便携式终端设备,例如个人电脑(personal computer)、笔记本电脑、手持计算机、平板电脑、台式计算机等,还可以是具有触敏表面或触控面板的膝上型计算机(Laptop)、超级移动个人计算机(ultra-mobile personal computer,UMPC)等非便携式终端设备。本申请实施例对该电子设备100的具体类型不作特 殊限制。 The electronic device 100 can be a portable terminal device equipped with Windows® or other operating systems, such as a personal computer (personal computer), a notebook computer, a handheld computer, a tablet computer, a desktop computer, etc. Non-portable terminal devices such as laptop computers (Laptop), ultra-mobile personal computers (ultra-mobile personal computer, UMPC), etc. The embodiment of the present application does not specifically limit the specific type of the electronic device 100 .
电子设备100可以包括处理器110,内部存储器120,无线通信模块130,传感器模块150,音频模块160,显示屏170,电源开关180,马达190和按键1000。The electronic device 100 may include a processor 110 , an internal memory 120 , a wireless communication module 130 , a sensor module 150 , an audio module 160 , a display screen 170 , a power switch 180 , a motor 190 and a key 1000 .
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
内部存储器120可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。The internal memory 120 may include one or more random access memories (random access memory, RAM) and one or more non-volatile memories (non-volatile memory, NVM).
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5 SDRAM)等;非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (synchronous dynamic random access memory, SDRAM), double data rate synchronous Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as the fifth generation DDR SDRAM is generally called DDR5 SDRAM), etc.; non-volatile memory can include disk storage devices, flash memory (flash memory) .
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。According to the operating principle, flash memory can include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. According to the potential order of storage cells, it can include single-level storage cells (single-level cell, SLC), multi-level storage cells (multi-level cell, MLC), triple-level cell (TLC), quad-level cell (QLC), etc., can include universal flash storage (English: universal flash storage, UFS) according to storage specifications , embedded multimedia memory card (embedded multi media Card, eMMC), etc.
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。The non-volatile memory can also store executable programs and data of users and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
电子设备100的无线通信功能可以通过天线130A,无线通信模块130,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be realized by the antenna 130A, the wireless communication module 130 , the modem processor, the baseband processor, and the like.
天线130A可以用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。The antenna 130A can be used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
无线通信模块130可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块130可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块130经由天线130A接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块130还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线130A转为电磁波辐射出去。The wireless communication module 130 can provide wireless local area networks (wireless local area networks, WLAN), bluetooth (bluetooth, BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 130 may be one or more devices integrating at least one communication processing module. The wireless communication module 130 receives electromagnetic waves via the antenna 130A, frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 130 can also receive the signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and convert it into electromagnetic wave and radiate it through the antenna 130A.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备输出声音信号,或通过显示屏170显示图像或视频。A modem processor may include a modulator and a demodulator. Wherein, the modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal is passed to the application processor after being processed by the baseband processor. The application processor outputs sound signals through an audio device, or displays images or videos through the display screen 170 .
传感器模块150包括加速度传感器1501,温度传感器1502,触摸传感器1503、压力传感器1504等。The sensor module 150 includes an acceleration sensor 1501, a temperature sensor 1502, a touch sensor 1503, a pressure sensor 1504, and the like.
其中,加速度传感器1501可用于检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。Wherein, the acceleration sensor 1501 can be used to detect the acceleration of the electronic device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
温度传感器1502用于检测温度。在一些实施例中,电子设备100利用温度传感器1502检测的温度,执行温度处理策略。例如,当温度传感器1502上报的温度超过阈值,电子设备100执行降低位于温度传感器1502附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 1502 is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 1502 to implement a temperature treatment strategy. For example, when the temperature reported by the temperature sensor 1502 exceeds the threshold, the electronic device 100 may reduce the performance of a processor located near the temperature sensor 1502, so as to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery, so as to prevent the electronic device 100 from being shut down abnormally due to the low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery to avoid abnormal shutdown caused by low temperature.
触摸传感器1503也称“触控器件”。触摸传感器1503可以设置于显示屏170,由触摸传感器1503与显示屏170组成触摸屏,也称“触控屏”。触摸传感器1503用于检测作用于其上或附近的触摸操作。触摸传感器1503可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏170提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器1503也可以设置于电子设备100的表面,与显示屏170所处的位置不同。The touch sensor 1503 is also called "touch device". The touch sensor 1503 may be disposed on the display screen 170, and the touch sensor 1503 and the display screen 170 form a touch screen, also called a “touch screen”. The touch sensor 1503 is used to detect a touch operation acting on or near it. The touch sensor 1503 can transmit the detected touch operation to the application processor to determine the type of the touch event. Visual output related to the touch operation can be provided through the display screen 170 . In other embodiments, the touch sensor 1503 may also be disposed on the surface of the electronic device 100 , which is different from the position of the display screen 170 .
压力传感器1504用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器1504可以设置于显示屏170。压力传感器1504的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器1504,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏170,电子设备100根据压力传感器1504检测触摸操作强度。电子设备100也可以根据压力传感器1504的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 1504 is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 1504 may be disposed on the display screen 170 . There are many types of pressure sensors 1504, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may be comprised of at least two parallel plates with conductive material. When a force is applied to the pressure sensor 1504, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of pressure according to the change in capacitance. When a touch operation acts on the display screen 170 , the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 1504 . The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 1504 . In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view short messages is executed. When a touch operation whose intensity is greater than or equal to the first pressure threshold acts on the icon of the short message application, the instruction of creating a new short message is executed.
音频模块160用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块160还可以用于对音频信号编码和解码。在一些实施例中,音频模块160可以设置于处理器110中,或将音频模块160的部分功能模块设置于处理器110中。The audio module 160 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 160 may also be used to encode and decode audio signals. In some embodiments, the audio module 160 may be set in the processor 110 , or some functional modules of the audio module 160 may be set in the processor 110 .
扬声器1601,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器1601收听音乐。Speaker 1601, also called "horn", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 1601 .
麦克风1602,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当发送语音信息时,用户可以将声音信号输入到麦克风1602。电子设备100可以设置至少一个麦克风1602。在另一些实施例中,电子设备100可以设置两个麦克风1602,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风1602,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 1602, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. The user may input a sound signal to the microphone 1602 when transmitting voice information. The electronic device 100 may be provided with at least one microphone 1602 . In some other embodiments, the electronic device 100 may be provided with two microphones 1602, which may also implement a noise reduction function in addition to collecting sound signals. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 1602 to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions, etc.
电子设备100通过GPU,显示屏170,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏170和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 realizes the display function through the GPU, the display screen 170 , and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 170 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏170用于显示图像,视频等。显示屏170包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏170,N为大于1的正整数。The display screen 170 is used to display images, videos and the like. The display screen 170 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 (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 170 , where N is a positive integer greater than 1.
电源开关180可用于控制电源向电子设备100的供电。The power switch 180 can be used to control power supply to the electronic device 100 .
马达190可以产生震动提示。马达190可以用于来电震动提示,也可以用于触摸震动反馈。例如,作用于不同应用(例如音频播放等)的触摸操作,可以对应不同的震动反馈效果。作用于显示屏170不同区域的触摸操作,马达190也可对应不同的震动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的震动反馈效果。触摸震动反馈效果还可以支持自定义。The motor 190 can generate vibration prompts. The motor 190 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations applied to different applications (such as audio playback, etc.) may correspond to different vibration feedback effects. The motor 190 can also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 170 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
按键1000包括开机键,音量键等。按键1000可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The key 1000 includes a power key, a volume key and the like. The key 1000 may be a mechanical key. It can also be a touch button. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100 .
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.
如图4所示,图4示例性示出了电子设备100如何控制在同一时刻仅有一路音频能够播放出来的功能模块示意图。As shown in FIG. 4 , FIG. 4 exemplarily shows a functional module schematic diagram of how the electronic device 100 controls only one channel of audio to be played at the same time.
电子设备100包括有音频通知管理模块(audio notification managermodule)410、进程管理模块(process managermodule)420和跨进程管理模块(remote control module)430。The electronic device 100 includes an audio notification manager module (audio notification manager module) 410, a process manager module (process manager module) 420 and a cross-process management module (remote control module) 430.
其中,音频通知管理模块410用于监测电子设备100中的音频类应用的运行状态,音频类应用的运行状态可以分为开启状态和未开启状态,开启状态又可以分为播放状态和暂停状态。当音频类应用处于开启状态时,电子设备100已创建了音频类应用的进程,并配置了对应的进程号。当音频类应用处于未开启状态,未开启的音频类应用的进程未创建。播放状态指的是电子设备100正在播放某一个音频类应用中的音频文件。暂停状态指的是某一个音频类应用已开启,但是电子设备100并未播放该某一个音频类应用中的音频文件,或者说之前电子设备100播放过该某一个音频类应用中的音频文件,但是当前电子设备100暂停播放该某一个音频类应用中的音频文件。Among them, the audio notification management module 410 is used to monitor the running state of the audio application in the electronic device 100. The running state of the audio application can be divided into an open state and an unopened state, and the open state can be divided into a play state and a pause state. When the audio application is in the open state, the electronic device 100 has created a process of the audio application and configured a corresponding process number. When the audio application is not opened, the process of the unopened audio application is not created. The playing state refers to that the electronic device 100 is playing an audio file in a certain audio application. The pause state means that a certain audio application has been opened, but the electronic device 100 has not played the audio file in the certain audio application, or the electronic device 100 has played the audio file in the certain audio application before, However, currently the electronic device 100 pauses playing the audio file in the certain audio application.
音频通知管理模块410用于将处于音频类应用的开启状态以及音频类应用的进程号发送至进程管理模块420。当同一个音频类应用的开启状态发生了变化,例如音频类应用的开启状态由播放状态变为暂停状态,或者音频类应用的开启状态由暂停状态变为播放状态,音频通知管理模块410还用于将变化后的音频类应用的开启状态再次发送至进程管理模块420。The audio notification management module 410 is configured to send the audio application in the open state and the process number of the audio application to the process management module 420 . When the open state of the same audio application changes, for example, the open state of the audio application changes from the play state to the pause state, or the open state of the audio application changes from the pause state to the play state, the audio notification management module 410 also uses Then, the changed open state of the audio application is sent to the process management module 420 again.
示例性的,电子设备100接收用户操作打开了音乐应用1,但是并未播放音乐应用1中的音频文件,电子设备100将创建音乐应用1的进程号,电子设备100将音乐应用1的开启状态(暂停状态)以及音乐应用1的进程号发送至进程管理模块420。Exemplarily, the electronic device 100 receives the user operation to open the music application 1, but does not play the audio file in the music application 1, the electronic device 100 will create the process number of the music application 1, and the electronic device 100 will set the open state of the music application 1 (pause state) and the process number of the music application 1 are sent to the process management module 420.
示例性的,在电子设备100开启音乐应用1后,电子设备100又接收用户操作打开了视 频应用1,并播放视频应用1中的视频文件,电子设备100将创建播放视频应用1的进程号,电子设备100将视频应用1的开启状态(播放状态)以及视频应用1的进程号发送至进程管理模块420。Exemplarily, after the electronic device 100 starts the music application 1, the electronic device 100 receives a user operation to open the video application 1, and plays the video file in the video application 1, the electronic device 100 will create a process number for playing the video application 1, The electronic device 100 sends the start state (playing state) of the video application 1 and the process number of the video application 1 to the process management module 420 .
若某一时刻,电子设备100接收用户操作暂停播放视频应用1中的视频文件,那么视频应用1的开启状态由播放状态变为暂停状态。由于视频应用1的开启状态也发生了变化,音频通知管理模块410再次将视频应用1的开启状态(暂停状态)以及视频应用1的进程号发送至进程管理模块420。If at a certain moment, the electronic device 100 receives a user operation to suspend playing the video file in the video application 1, then the open state of the video application 1 changes from the playing state to the paused state. Since the opening state of the video application 1 has also changed, the audio notification management module 410 sends the opening state (suspended state) of the video application 1 and the process number of the video application 1 to the process management module 420 again.
进程管理模块420的作用在于控制多个音频类应用在同一时刻,仅有一个音频类应用能够播放音频。具体的,进程管理模块420用于接收音频通知管理模块410发送的音频类应用的开启状态以及音频类应用的进程号。并基于音频类应用的开启状态和预设的优先级策略确定出需管控的是哪一个音频类应用。The function of the process management module 420 is to control multiple audio applications at the same time, only one audio application can play audio. Specifically, the process management module 420 is configured to receive the start status of the audio application and the process number of the audio application sent by the audio notification management module 410 . And based on the open state of the audio application and the preset priority policy, it is determined which audio application needs to be controlled.
可选的,进程管理模块420还可以基于白名单策略和预设的优先级策略确定出需管控的是哪一个音频类应用。白名单策略就是预设的需要管控的应用的集合。只有应用在白名单内,进程管理模块420才会对该应用的进程进行管控。若应用不在白名单内,进程管理模块420不会对该应用的进程进行管控。这样,可以避免进程管理模块420对电子设备100内所有的应用进行管控,会导致进程管理模块420的负载过大。Optionally, the process management module 420 may also determine which audio application needs to be controlled based on the whitelist policy and the preset priority policy. A whitelist policy is a collection of preset applications that need to be controlled. Only when the application is in the white list, the process management module 420 will control the process of the application. If the application is not in the white list, the process management module 420 will not control the process of the application. In this way, it is possible to prevent the process management module 420 from controlling all the applications in the electronic device 100 , which would lead to an excessive load on the process management module 420 .
可选的,进程管理模块420可以基于用户的使用频率对白名单内的应用进行管控。例如,用户在一定时间(例如一个月)内未使用某一个应用,那么进程管理模块420可以将该某一个应用从白名单内移除。当进程管理模块420将该某一个应用从白名单内移除后,进程管理模块420监测到用户一定时间内(例如一周内)使用该某一个应用的次数大于预设值,那么进程管理模块420可以再次将该某一个应用加入白名单内。Optionally, the process management module 420 may control the applications in the whitelist based on the frequency of use of the user. For example, if the user does not use a certain application within a certain period of time (for example, one month), the process management module 420 may remove the certain application from the white list. After the process management module 420 removes this certain application from the white list, the process management module 420 detects that the number of times the user uses the certain application within a certain period of time (for example, within a week) is greater than the preset value, then the process management module 420 You can add this certain application to the white list again.
若进程管理模块420监测到同一时刻有两个音频类应用处于播放状态,例如音频类应用1和音频类应用2均处于播放状态,那么进程管理模块420将从该两个音频类应用中基于预设的优先级策略确定出优先级较低的一个音频类应用,例如音频类应用1的优先级低于音频类应用2的优先级,进程管理模块420将获取到音频类应用1的进程号一,并将进程号一发送至跨进程管理模块430。If the process management module 420 detects that two audio applications are in the playing state at the same time, for example, the audio application 1 and the audio application 2 are both in the playback state, then the process management module 420 will start from the two audio applications based on the preset The set priority strategy determines an audio application with a lower priority, for example, the priority of audio application 1 is lower than that of audio application 2, and the process management module 420 will obtain the process number of audio application 1 , and send the process number one to the cross-process management module 430 .
示例性的,音频类应用1可以是音乐应用1,音频类应用2可以是视频应用1。在同一时刻,进程管理模块420监测音乐应用1和视频应用1的开启状态均处于播放状态,那么进程管理模块420将基于预设的优先级策略从音乐应用1和视频应用1中确定出优先级较低的一个音频类应用,例如进程管理模块420确定出音乐应用1的优先级较低,那么进程管理模块420将获取到音乐应用1的进程号,并将音乐应用1的进程号和暂停指令发送至跨进程管理模块430。Exemplarily, the audio application 1 may be a music application 1, and the audio application 2 may be a video application 1. At the same time, the process management module 420 monitors that the music application 1 and the video application 1 are both in the playing state, then the process management module 420 will determine the priority from the music application 1 and the video application 1 based on the preset priority policy For a lower audio application, for example, if the process management module 420 determines that the priority of the music application 1 is low, then the process management module 420 will obtain the process number of the music application 1, and send the process number of the music application 1 and the pause instruction Sent to the cross-process management module 430.
跨进程管理模块430用于接收进程管理模块420发送的音频类应用1的进程号一和暂停指令,并基于音频类应用1的进程号一和暂停指令控制音频类应用1停止播放音频。这样,通过对音频类应用的管控,实现了在同一时刻仅有一路音频可以播放出来。具体的,跨进程管理模块430如何基于音频类应用1的进程号一控制音频类应用1停止播放音频的,将在后续实施例中进行详细介绍,本申请实施例在此不再赘述。The cross-process management module 430 is used to receive the process number one of the audio application 1 and the pause instruction sent by the process management module 420, and control the audio application 1 to stop playing audio based on the process number one of the audio application 1 and the pause instruction. In this way, through the control of audio applications, only one audio channel can be played at the same time. Specifically, how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number of the audio application 1 will be described in detail in subsequent embodiments, and will not be repeated in this embodiment of the application.
示例性的,跨进程管理模块430接收到进程管理模块420发送的音乐应用1的进程号,跨进程管理模块430将基于音乐应用1的进程号,控制音乐应用1停止播放音乐。这样,仅有视频应用1有音频输出。实现了电子设备100在同一时刻仅可以播放出一个音频类应用中 的音频。Exemplarily, the cross-process management module 430 receives the process number of the music application 1 sent by the process management module 420 , and the cross-process management module 430 will control the music application 1 to stop playing music based on the process number of the music application 1 . Thus, only video application 1 has audio output. It is realized that the electronic device 100 can only play the audio in one audio application at the same time.
需要说明的是,上述一个或多个功能模块可以随意组合,以实现电子设备100在同一时刻仅可以播放出一个音频类应用中的音频。It should be noted that the above one or more functional modules can be combined at will, so that the electronic device 100 can only play the audio in one audio application at the same time.
如图5所示,图5示例性示出了跨进程管理模块430在控制音频类应用1停止播放音乐后,如何控制音频类应用1继续播放音乐的功能模块示意图。As shown in FIG. 5 , FIG. 5 exemplarily shows a functional module diagram of how the cross-process management module 430 controls the audio application 1 to continue playing music after controlling the audio application 1 to stop playing music.
图5中的功能模块与图4中的功能模块的功能类似,本申请实施例在此不再赘述。Functions of the functional modules in FIG. 5 are similar to those of the functional modules in FIG. 4 , and will not be repeated in this embodiment of the present application.
在图4所示的实施例中,在进程管理模块420基于播放优先级策略确定出控制音频类应用1暂停播放音频时,进程管理模块420还需对音频类应用1的进程号一做标记,使得进程管理模块420记录下音频类应用1是由于播放优先级策略而暂停播放音频的,不是用户主动触发使得音频类应用1暂停播放音频的。可选的,进程管理模块420可以将音频类应用1的进程号一保存在本地,这样,当进程管理模块420在控制音频类应用1由暂停播放音频的状态变为继续播放音频的状态时,会从本地存储的音频类应用的进程号中,是否可以查找到需要继续播放音频的音频类应用1的进程号一。若查找到,则说明进程管理模块420之前基于播放策略控制音频类应用1暂停播放音频,而不是用户主动触发使得音频类应用1暂停播放音频的,在这种情况下,进程管理模块420将音频类应用1的进程号一和播放指令发送至跨进程管理模块430,跨进程管理模块430在接收到进程管理模块420发送的音频类应用1的进程号一和播放指令后,跨进程管理模块430控制音频类应用1继续播放音频。若没有查找到,则说明进程管理模块420之前没有基于播放策略控制音频类应用1暂停播放音频,而是由于用户主动触发使得音频类应用1暂停播放音频的,在这种情况下,进程管理模块420不会将音频类应用1的进程号一和播放指令发送至跨进程管理模块430,避免与用户主动触发音频类应用1暂停播放音频的意愿发生冲突。In the embodiment shown in FIG. 4 , when the process management module 420 determines to control the audio application 1 to suspend playing audio based on the playback priority policy, the process management module 420 also needs to mark the process number one of the audio application 1, Make the process management module 420 record that the audio application 1 pauses playing the audio due to the playback priority policy, and the audio application 1 is not triggered to pause the audio by the user. Optionally, the process management module 420 may store the process number one of the audio application 1 locally, so that when the process management module 420 controls the audio application 1 from the state of pausing the audio to the state of continuing to play the audio, Whether the process number 1 of the audio application 1 that needs to continue to play audio can be found from the process number of the audio application stored locally. If it is found, it means that the process management module 420 previously controlled the audio application 1 to suspend playing audio based on the playback policy, rather than the user actively triggering the audio application 1 to suspend playing audio. In this case, the process management module 420 will audio The process number one and the play instruction of the class application 1 are sent to the cross-process management module 430, and after the cross-process management module 430 receives the process number one and the play instruction of the audio class application 1 sent by the process management module Control audio application 1 to continue playing audio. If it is not found, it means that the process management module 420 did not control the audio application 1 to suspend playing audio based on the playback policy before, but the audio application 1 paused playing the audio due to the user's active trigger. In this case, the process management module 420 will not send the process number one of the audio application 1 and the playback instruction to the cross-process management module 430, so as to avoid conflicts with the user's willingness to actively trigger the audio application 1 to pause playing audio.
需要说明的是,进程管理模块420还可以基于其他的方式对音频类应用1的进程号一做标记,不仅限于将音频类应用1的进程号一保存在本地这一种方式,本申请实施例对此不做限定。It should be noted that the process management module 420 can also mark the process number 1 of the audio application 1 based on other methods, not limited to the method of saving the process number 1 of the audio application 1 locally. There is no limit to this.
具体的,在跨进程管理模块430控制音频类应用1停止播放音频后,音频通知管理模块410将获取到音频类应用1的开启状态由播放状态变为暂停状态,那么音频通知管理模块410将音频类应用1的开启状态(即暂停状态)以及音频类应用1的进程号发送至进程管理模块420。那么进程管理模块420监测到的音频类应用1的开启状态为暂停状态,音频类应用2的开启状态为播放状态。也即进程管理模块420监测到仅有一路音频输出。Specifically, after the cross-process management module 430 controls the audio application 1 to stop playing audio, the audio notification management module 410 will obtain that the audio application 1 is in the open state from the playback state to the pause state, then the audio notification management module 410 will send the audio The open state (ie, paused state) of the class application 1 and the process number of the audio class application 1 are sent to the process management module 420 . Then, the open state of the audio application 1 detected by the process management module 420 is the pause state, and the open state of the audio application 2 is the play state. That is, the process management module 420 detects that there is only one audio output.
一段之间之后,假设音频类应用2的开启状态由播放状态变为暂停状态。那么音频通知管理模块410将获取到音频类应用2的开启状态由播放状态变为暂停状态,音频通知管理模块410将音频类应用2的开启状态(即暂停状态)以及音频类应用2的进程号发送至进程管理模块420。那么进程管理模块420监测到的音频类应用1的开启状态为暂停状态,音频类应用2的开启状态也为暂停状态。After a period of time, it is assumed that the open state of the audio application 2 changes from the playing state to the paused state. Then the audio notification management module 410 will obtain the open state of the audio application 2 from the play state to the pause state, and the audio notification management module 410 will obtain the open state (ie, pause state) of the audio application 2 and the process number of the audio application 2. Sent to the process management module 420. Then, the open state of the audio application 1 detected by the process management module 420 is the suspended state, and the open state of the audio application 2 is also the suspended state.
此时,假设进程管理模块420监测到音频类应用2由播放状态变为暂停状态,那么进程管理模块420基于预设的优先级策略、进程管理模块420保存的音频类应用的进程号和除了音频类应用2之外的其他音频类应用的开启状态,确定出需继续播放的音频类应用。At this time, assuming that the process management module 420 detects that the audio application 2 changes from the playing state to the paused state, then the process management module 420 based on the preset priority policy, the process number of the audio application stored in the process management module 420 and the The open state of other audio-type applications other than type-application 2 determines the audio-type application that needs to continue playing.
在一些实施例中,若除了音频类应用2之外,进程管理模块420仅监测到音频类应用1处于暂停状态,且进程管理模块420保存的音频类应用的进程号中包括音频类应用1的进程 号一,那么进程管理模块420确定出继续播放的音频类应用为音频类应用1,进程管理模块420将音频类应用1的进程号一和播放指令发送至跨进程管理模块430。In some embodiments, if in addition to the audio application 2, the process management module 420 only monitors that the audio application 1 is in a suspended state, and the process number of the audio application stored by the process management module 420 includes the audio application 1 If the process number is one, then the process management module 420 determines that the audio application that continues to play is the audio application 1, and the process management module 420 sends the process number one and the playback instruction of the audio application 1 to the cross-process management module 430.
跨进程管理模块430在接收到进程管理模块420发送的音频类应用1的进程号一和播放指令时,跨进程管理模块430将基于进程号一和播放指令控制音频类应用1继续播放音频。When the cross-process management module 430 receives the process number one and the play instruction of the audio application 1 sent by the process management module 420, the cross-process management module 430 will control the audio application 1 to continue playing audio based on the process number one and the play instruction.
在其他实施例中,若除了音频类应用2之外,进程管理模块420仅监测到音频类应用1处于暂停状态,但是进程管理模块420保存的音频类应用的进程号中不包括音频类应用1的进程号一,这说明之前不是进程管理模块420基于播放优先级策略控制音频类应用1暂停播放音频的,可能是用户主动触发使得音频类应用1暂停播放音频的,因此进程管理模块420确定出不会控制音频类应用1继续播放音频,避免与用户主动触发使得音频类应用1暂停播放音频的意愿发生冲突,进程管理模块420也不会将音频类应用1的进程号一和播放指令发送至跨进程管理模块430。In other embodiments, if in addition to the audio application 2, the process management module 420 only detects that the audio application 1 is in a suspended state, but the audio application 1 is not included in the process number of the audio application stored by the process management module 420 The process number is one, which means that it was not the process management module 420 that controlled the audio application 1 to suspend audio playback based on the playback priority policy. It may be that the user actively triggered the audio application 1 to suspend audio playback. It will not control the audio application 1 to continue playing audio, so as to avoid conflicts with the user's willingness to actively trigger the audio application 1 to suspend playing audio, and the process management module 420 will not send the process number 1 and the playback instruction of the audio application 1 to A cross-process management module 430 .
跨进程管理模块430在接收到进程管理模块420发送的音频类应用1的进程号一和播放指令时,跨进程管理模块430将基于进程号一和播放指令控制音频类应用1继续播放音频。When the cross-process management module 430 receives the process number one and the play instruction of the audio application 1 sent by the process management module 420, the cross-process management module 430 will control the audio application 1 to continue playing audio based on the process number one and the play instruction.
在其他实施例中,若除了音频类应用2之外,进程管理模块420监测到音频类应用1和音频类应用3均处于暂停状态,但是音频类应用1的优先级高于音频类应用3的优先级,且进程管理模块420保存的音频类应用的进程号中包括音频类应用1的进程号一,那么进程管理模块420确定出继续播放的音频类应用为音频类应用1,进程管理模块420将音频类应用1的进程号一和播放指令发送至跨进程管理模块430。In other embodiments, if in addition to the audio application 2, the process management module 420 detects that both the audio application 1 and the audio application 3 are in a suspended state, but the priority of the audio application 1 is higher than that of the audio application 3. Priority, and the process number of the audio class application stored by the process management module 420 includes the process number one of the audio class application 1, then the process management module 420 determines that the audio class application that continues to play is the audio class application 1, and the process management module 420 Send the process number one of the audio application 1 and the play instruction to the cross-process management module 430 .
跨进程管理模块430在接收到进程管理模块420发送的音频类应用3的进程号一和播放指令时,跨进程管理模块430将基于进程号一和播放指令控制音频类应用1继续播放音频。When the cross-process management module 430 receives the process number one and the play instruction of the audio application 3 sent by the process management module 420, the cross-process management module 430 will control the audio application 1 to continue playing audio based on the process number one and the play instruction.
可选的,若除了音频类应用2之外,进程管理模块420仅监测到音频类应用1和音频类应用3均处于暂停状态,音频类应用1的优先级高于音频类应用3的优先级,但是进程管理模块420保存的音频类应用的进程号中不包括音频类应用1的进程号一,但是包括音频类应用3的进程号三,这说明之前不是进程管理模块420基于播放优先级策略控制音频类应用1暂停播放音频的,可能是用户主动触发使得音频类应用1暂停播放音频的,但是进程管理模块420是基于播放优先级策略控制音频类应用3暂停播放音频的。因此进程管理模块420确定出即使音频类应用1的优先级高于音频类应用3的优先级,但是进程管理模块420不会控制音频类应用1继续播放音频,避免与用户主动触发使得音频类应用1暂停播放音频的意愿发生冲突,但是进程管理模块420会控制音频类应用3继续播放音频,进程管理模块420将音频类应用3的进程号三和播放指令发送至跨进程管理模块430。Optionally, if in addition to the audio application 2, the process management module 420 only detects that the audio application 1 and the audio application 3 are in a suspended state, the priority of the audio application 1 is higher than that of the audio application 3 , but the process number of the audio application saved by the process management module 420 does not include the process number one of the audio application 1, but includes the process number three of the audio application 3, which means that the process management module 420 was not based on the playback priority strategy before. The audio application 1 is controlled to suspend audio playback, which may be triggered by the user to suspend audio application 1, but the process management module 420 controls audio application 3 to suspend audio playback based on the playback priority policy. Therefore, the process management module 420 determines that even if the priority of the audio application 1 is higher than that of the audio application 3, the process management module 420 will not control the audio application 1 to continue playing audio, so as to avoid actively triggering the audio application with the user. 1 There is a conflict in the desire to pause playing audio, but the process management module 420 will control the audio application 3 to continue playing audio, and the process management module 420 sends the process number three of the audio application 3 and the playback instruction to the cross-process management module 430.
跨进程管理模块430在接收到进程管理模块420发送的音频类应用3的进程号三和播放指令时,跨进程管理模块430将基于进程号三和播放指令控制音频类应用3继续播放音频。When the cross-process management module 430 receives the process number three and the play instruction of the audio application 3 sent by the process management module 420, the cross-process management module 430 will control the audio application 3 to continue playing audio based on the process number three and the play instruction.
这里,对于跨进程管理模块430如何基于进程号和播放指令控制音频类应用继续播放音频的,将在后续实施例中详细介绍,本申请实施例在此不做赘述。Here, how the cross-process management module 430 controls the audio application to continue playing audio based on the process number and the playback instruction will be described in detail in subsequent embodiments, and will not be repeated in this embodiment of the application.
需要说明的是,跨进程管理模块430一般用于控制非实时语音通话或者非实时类的视频通话的音频类应用在暂停之后继续播放音频。对于非实时语音通话或者非实时类的视频通话的音频类应用,电子设备100实质上是将非实时语音通话或者非实时类的视频通话的音频类应用待播放的音频文件完整地或者部分缓存在本地,跨进程管理模块430可以基于缓存的完整的或者部分的音频文件控制非实时语音通话或者非实时类的视频通话的音频类应用继续播放音频。It should be noted that the cross-process management module 430 is generally used to control an audio application of a non-real-time voice call or a non-real-time video call to continue playing audio after suspending. For audio applications of non-real-time voice calls or non-real-time video calls, the electronic device 100 essentially caches the audio files to be played by the audio applications of non-real-time voice calls or non-real-time video calls completely or partially in the Locally, the cross-process management module 430 can control the audio application of the non-real-time voice call or non-real-time video call to continue playing audio based on the complete or partial cached audio file.
接下来介绍跨进程管理模块430如何基进程号和播放指令控制音频类应用暂停播放音频的。Next, it will be introduced how the cross-process management module 430 controls the audio application to pause playing audio based on the process number and the playback instruction.
首先介绍一下父窗口和子窗口的概念。First introduce the concept of parent window and child window.
应用程序开启之后,应用程序的父窗口就建立起来了,当应用程序关闭之后,应用程序的父窗口也就不存在了。每一个应用对于父窗口和子窗口的定义均不同,每一个应用程序对应有一个或多个父窗口,父窗口用于承载子窗口,一个父窗口可以有一个或多个子窗口。After the application is started, the parent window of the application is established, and when the application is closed, the parent window of the application does not exist. Each application has a different definition of a parent window and a child window. Each application program corresponds to one or more parent windows, and the parent window is used to host the child windows. A parent window can have one or more child windows.
下面以音乐应用为例具体解释父窗口和子窗口的定义。The definition of the parent window and the child window will be explained in detail below by taking the music application as an example.
电子设备100开启音乐应用,并显示图1B所示的音乐应用的用户界面1001。在电子设备100开启音乐应用后,音乐应用的父窗口就已经建立了,但是电子设备100没有将音乐应用的父窗口显示出来。The electronic device 100 starts the music application, and displays the user interface 1001 of the music application shown in FIG. 1B . After the electronic device 100 starts the music application, the parent window of the music application has been established, but the electronic device 100 does not display the parent window of the music application.
音乐应用是基于功能模块,将用户界面1001划分为几个子窗口。如图6A所示,例如用户界面1001中的区域601为子窗口1,子窗口1的功能是实现搜索功能,例如搜索歌曲、歌手、音乐短片(music video,MV)等等。用户界面1001中的区域602为子窗口2,子窗口2的功能是实现歌单展示功能,例如歌手热度排名、热门歌曲排行榜、个人喜欢的歌单、电台等等。用户界面1001中的区域603为子窗口3,子窗口3的功能是实现推荐功能,例如基于用户的喜爱推荐用户喜欢听的音乐,或者大数据分析给推荐当前比较热门的单曲或者MV。用户界面1001中的区域604为子窗口4,子窗口4的功能是实现播放/暂停音乐。子窗口4包括有播放/暂停控件、上一曲控件、下一曲控件和音量调节控件等等。The music application is based on functional modules, and the user interface 1001 is divided into several sub-windows. As shown in FIG. 6A, for example, the area 601 in the user interface 1001 is a sub-window 1, and the function of the sub-window 1 is to realize a search function, such as searching for songs, singers, music videos (music video, MV) and the like. The area 602 in the user interface 1001 is the sub-window 2, and the function of the sub-window 2 is to realize the song list display function, such as singer popularity ranking, popular song list, personal favorite song list, radio station and so on. The area 603 in the user interface 1001 is the sub-window 3. The function of the sub-window 3 is to realize the recommendation function, such as recommending the music that the user likes to listen to based on the user's preference, or recommending currently popular singles or MVs based on big data analysis. The area 604 in the user interface 1001 is a sub-window 4, and the function of the sub-window 4 is to realize playing/pausing music. The sub-window 4 includes a play/pause control, a previous song control, a next song control, a volume adjustment control and the like.
如图6B所示,图6B示出了音乐应用中父窗口与多个子窗口的关系示意图。As shown in FIG. 6B , FIG. 6B shows a schematic diagram of the relationship between a parent window and multiple child windows in a music application.
音乐应用中的父窗口为音乐应用中所有子窗口的承载,父窗口关联的子窗口可以包括子窗口1、子窗口2、子窗口3和子窗口4。若电子设备100接收用户在子窗口1中的第一输入操作,电子设备100会将其他的用户界面叠加显示在用户界面1001上。那么电子设备100显示的其他的用户界面中又可以包括一个或多个子窗口,例如其他的用户界面中又包括子窗口5和子窗口6,子窗口5和子窗口6均属于子窗口1的子窗口。The parent window in the music application is the bearer of all the child windows in the music application, and the child windows associated with the parent window may include child window 1, child window 2, child window 3 and child window 4. If the electronic device 100 receives the user's first input operation in the sub-window 1 , the electronic device 100 will overlay and display other user interfaces on the user interface 1001 . Then, other user interfaces displayed by the electronic device 100 may include one or more sub-windows, for example, other user interfaces include sub-window 5 and sub-window 6 , and both sub-window 5 and sub-window 6 belong to sub-windows of sub-window 1 .
需要说明的是,应用中的父窗口和子窗口均包括有唯一的窗口标识,该窗口标识用于指示具体是哪一个父窗口或者哪一个子窗口。窗口标识可以包括但不仅限于窗口的句柄等信息,窗口的句柄可以理解为窗口的编号,每一个窗口的标号均不相同。这样,电子设备100可以基于窗口的句柄查找到对应的窗口。It should be noted that both the parent window and the child window in the application include a unique window identifier, and the window identifier is used to indicate which parent window or which child window it is. The window identifier may include but not limited to window handle and other information. The window handle may be understood as the number of the window, and the number of each window is different. In this way, the electronic device 100 can find the corresponding window based on the handle of the window.
需要说明的是,每个应用的父窗口和子窗口的定义均不同,上述图6A-图6B中的解释说明仅用于解释本申请,本申请实施例对此不做限定。It should be noted that the definitions of the parent window and child window of each application are different, and the above explanations in FIG. 6A-FIG. 6B are only for explaining the present application, and this embodiment of the present application does not limit it.
图7A示例性示出了一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图。FIG. 7A exemplarily shows a schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
S701A、跨进程管理模块430依次遍历每一个父窗口,获取到进程号为进程号一的所有父窗口,作为目标父窗口。S701A. The cross-process management module 430 traverses each parent window in turn, and acquires all parent windows whose process number is process number one as target parent windows.
可选的,跨进程管理模块430在获取到所有的父窗口后,所有的父窗口可以分为系统父窗口和应用类父窗口。由于电子设备100一般是通过应用播放音频的,因此跨进程管理模块430可以从所有的父窗口中筛选得到应用类父窗口。Optionally, after the cross-process management module 430 acquires all parent windows, all parent windows can be divided into system parent windows and application parent windows. Since the electronic device 100 generally plays audio through applications, the cross-process management module 430 can filter all parent windows to obtain application-type parent windows.
示例性的,若电子设备100开启了应用1、和应用2,电子设备100通过应用1播放音频。 跨进程管理模块430获取到所有的父窗口可能包括应用1的父窗口、应用2的父窗口和系统父窗口。由于电子设备100一般是通过应用播放音频的,那么跨进程管理模块430可以从应用1的父窗口、应用2的父窗口和系统父窗口筛选得到应用1的父窗口和应用2的父窗口。Exemplarily, if the electronic device 100 starts the application 1 and the application 2, the electronic device 100 plays audio through the application 1. All parent windows acquired by the cross-process management module 430 may include the parent window of application 1, the parent window of application 2 and the system parent window. Since the electronic device 100 generally plays audio through the application, the cross-process management module 430 can obtain the parent window of the application 1 and the parent window of the application 2 from the parent window of the application 1, the parent window of the application 2 and the system parent window.
可选的,跨进程管理模块430在获取到所有的父窗口后,所有的父窗口可以分为系统父窗口和应用类父窗口。由于电子设备100一般是通过音频类应用播放音频的,因此跨进程管理模块430可以从所有的父窗口中筛选得到应用类父窗口,再从应用类父窗口中筛选得到音频类应用的父窗口。Optionally, after the cross-process management module 430 acquires all parent windows, all parent windows can be divided into system parent windows and application parent windows. Since the electronic device 100 generally plays audio through audio applications, the cross-process management module 430 can filter all parent windows to obtain the application parent window, and then filter the application parent windows to obtain the audio application parent window.
示例性的,若电子设备100开启了应用1、和应用2,应用1为音频类应用,应用2为非音频类应用,电子设备100通过应用1播放音频。跨进程管理模块430获取到所有的父窗口可能包括应用1的父窗口、应用2的父窗口和系统父窗口。由于电子设备100一般是通过音频类应用播放音频的,那么跨进程管理模块430可以从应用1的父窗口、应用2的父窗口和系统父窗口筛选得到应用1的父窗口。Exemplarily, if the electronic device 100 starts application 1 and application 2, application 1 is an audio application, application 2 is a non-audio application, and the electronic device 100 plays audio through application 1. All parent windows acquired by the cross-process management module 430 may include the parent window of application 1, the parent window of application 2 and the system parent window. Since the electronic device 100 generally plays audio through audio applications, the cross-process management module 430 can filter and obtain the parent window of application 1 from the parent window of application 1, the parent window of application 2 and the system parent window.
应用程序开启后,那么该应用程序的进程号就已经创建好了,该应用程序对应有一个或多个进程,每一个进程对应有一个父窗口。因此开启的应用程序可能有一个父窗口,也可能有多个父窗口,本申请实施例对此不做限定。After the application program is started, the process number of the application program has been created. The application program corresponds to one or more processes, and each process corresponds to a parent window. Therefore, the opened application program may have one parent window, or may have multiple parent windows, which is not limited in this embodiment of the present application.
示例性的,若电子设备100上的同一个应用程序仅开启了一次,那么该应用程序有一个父窗口,该一个父窗口对应有一个进程号。若电子设备100上的同一个应用程序同时开启了多次,那么该应用程序的父窗口有多个,并且该同一个应用程序的多个父窗口中每一个父窗口的进程号也不相同。Exemplarily, if the same application program on the electronic device 100 is opened only once, then the application program has a parent window, and the parent window corresponds to a process number. If the same application program on the electronic device 100 is opened multiple times at the same time, then the application program has multiple parent windows, and the process ID of each of the multiple parent windows of the same application program is different.
电子设备100可以开启一个应用程序,那么就存在该应用程序的至少一个父窗口。若电子设备100开启了两个及两个以上的应用程序,那么就存在至少两个及两个以上的父窗口。跨进程管理模块430需要依次遍历每一个父窗口,找到所有的父窗口。The electronic device 100 can start an application program, then there is at least one parent window of the application program. If the electronic device 100 has opened two or more application programs, then there are at least two or more parent windows. The cross-process management module 430 needs to traverse each parent window in turn to find all parent windows.
示例性的,若电子设备100开启了音乐应用1和视频应用1,那么电子设备100中存在音乐应用1的至少一个父窗口和视频应用1的至少一个父窗口。Exemplarily, if the electronic device 100 starts the music application 1 and the video application 1 , then there is at least one parent window of the music application 1 and at least one parent window of the video application 1 in the electronic device 100 .
跨进程管理模块430依次遍历每一个父窗口,若当前父窗口的进程号为进程号一,则跨进程管理模块43将该父窗口作为目标父窗口。The cross-process management module 430 traverses each parent window in turn, and if the process number of the current parent window is process number one, the cross-process management module 43 takes the parent window as the target parent window.
可选的,在跨进程管理模块430查找到目标父窗口后,跨进程管理模块430可以停止遍历其他的窗口,这样,可以节省跨进程管理模块430查找到目标父窗口的时间。Optionally, after the cross-process management module 430 finds the target parent window, the cross-process management module 430 can stop traversing other windows, so that the time for the cross-process management module 430 to find the target parent window can be saved.
可选的,跨进程管理模块430可以继续遍历其他的窗口,直至遍历完所有的父窗口,这样,可以避免跨进程管理模块430漏查找目标父窗口的情况发生。Optionally, the cross-process management module 430 can continue to traverse other windows until all parent windows have been traversed. In this way, the situation that the cross-process management module 430 misses to find the target parent window can be avoided.
S702A、跨进程管理模块430获取到目标父窗口的标识。S702A, the cross-process management module 430 obtains the identifier of the target parent window.
S703A、跨进程管理模块430发送暂停指令和目标父窗口的标识给进程号一的进程。S703A, the cross-process management module 430 sends the pause command and the target parent window identifier to the process with process number one.
跨进程管理模块430在获取到进程号一的父窗口后,得到目标父窗口。跨进程管理模块430获取到目标父窗口的标识,并发送暂停指令和目标父窗口的标识给进程号一的进程。这样,由于应用程序的多样性,跨进程管理模块430无法提前获取到实现播放/暂停功能的窗口是哪一个父窗口或者哪一个子窗口。因此,跨进程管理模块430首先发送暂停指令给目标父窗口,判断是否可以实现控制当前音频暂停播放。The cross-process management module 430 obtains the target parent window after obtaining the parent window of process number one. The cross-process management module 430 obtains the identifier of the target parent window, and sends a pause command and the identifier of the target parent window to the process with process number one. In this way, due to the diversity of application programs, the cross-process management module 430 cannot obtain in advance which parent window or which child window the window implementing the play/pause function is. Therefore, the cross-process management module 430 first sends a pause instruction to the target parent window, and judges whether it is possible to control the current audio to pause and play.
可选的,暂停指令可以是模拟的空格键(space key)值。该模拟的空格键值,相当于电子设备100接收用户针对键盘上的空格键的点击操作。这样,进程管理模块420向进程号一 的进程发送模拟的空格键值,即可使得进程号一的进程控制音频类应用1播放音频,相当于模拟了用户手动点击键盘上的空格键,实现了自动暂停音频类应用1的播放。Optionally, the pause command can be a simulated space key value. The simulated space bar value is equivalent to the electronic device 100 receiving the user's click operation on the space bar on the keyboard. In this way, the process management module 420 sends the simulated space key value to the process of process number one, so that the process of process number one can control the audio application 1 to play audio, which is equivalent to simulating the user manually clicking the space bar on the keyboard. Automatically pause the playback of audio application 1.
S704A、跨进程管理模块430判断音频类应用1是否停止播放音频?S704A. The cross-process management module 430 judges whether the audio application 1 stops playing audio?
若跨进程管理模块430判断音频类应用1停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口为音频类应用1的父窗口,则该流程结束。If the cross-process management module 430 determines that the audio application 1 stops playing audio, it means that the window of the audio application 1 that implements the play/pause function is the parent window of the audio application 1, and the process ends.
若跨进程管理模块430判断音频类应用1没有停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口不是音频类应用1的父窗口,则跨进程管理模块430执行S705。If the cross-process management module 430 determines that the audio application 1 has not stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is not the parent window of the audio application 1, and the cross-process management module 430 executes S705.
S705A、跨进程管理模块430依次遍历每一个父窗口下的所有子窗口,获取到进程号为进程号一的所有子窗口,作为目标子窗口。S705A. The cross-process management module 430 sequentially traverses all child windows under each parent window, and acquires all child windows whose process number is process number one as target child windows.
由于跨进程管理模块430无法知道实现暂停/播放功能的是哪一个子窗口,因此跨进程管理模块430需要获取到进程号为进程号一的所有子窗口,作为目标子窗口。Since the cross-process management module 430 cannot know which sub-window implements the pause/play function, the cross-process management module 430 needs to obtain all the sub-windows whose process number is process number one as the target sub-window.
跨进程管理模块430依次遍历每一个父窗口下关联的子窗口,若当前父窗口下关联的子窗口的进程号为进程号一,则跨进程管理模块43将当前父窗口下关联的子窗口作为目标子窗口。Cross-process management module 430 traverses the child windows associated under each parent window in turn, if the process number of the child window associated under the current parent window is process number one, then the cross-process management module 43 uses the child window associated under the current parent window as The target subwindow.
可选的,在跨进程管理模块430查找到目标子窗口后,跨进程管理模块430可以停止其他父窗口下关联的子窗口,这样,可以节省跨进程管理模块430查找到目标子窗口的时间。Optionally, after the cross-process management module 430 finds the target sub-window, the cross-process management module 430 can stop the associated sub-windows under other parent windows. In this way, the time for the cross-process management module 430 to find the target sub-window can be saved.
可选的,跨进程管理模块430可以继续遍历其他父窗口下关联的子窗口,直至遍历完所有的父窗口下关联的子窗口,这样,可以避免跨进程管理模块430漏查找目标子窗口的情况发生。Optionally, the cross-process management module 430 can continue to traverse the associated sub-windows under other parent windows until all the associated sub-windows under all parent windows have been traversed, so that the cross-process management module 430 can avoid the situation that the target sub-window is missed occur.
需要说明的是,每一个父窗口下的所有子窗口的数量可以是一个,也可以是两个及两个以上。It should be noted that the number of all child windows under each parent window may be one, or two or more.
示例性的,若电子设备100开启了音乐应用1和视频应用1,那么电子设备100中存在音乐应用1的一个父窗口和视频应用1的一个父窗口。跨进程管理模块430需先查找到音乐应用1的父窗口中的所有子窗口,之后,跨进程管理模块430在查找视频应用1的父窗口中的所有子窗口。Exemplarily, if the electronic device 100 starts the music application 1 and the video application 1 , then there is a parent window of the music application 1 and a parent window of the video application 1 in the electronic device 100 . The cross-process management module 430 needs to find all the child windows in the parent window of the music application 1 first, and then, the cross-process management module 430 searches for all the child windows in the parent window of the video application 1.
若跨进程管理模块430查找到音乐应用1的父窗口中的所有子窗口后,并获取到音乐应用1的所有子窗口的进程号,当音乐应用1的所有子窗口的进程号为进程号一时,则将音乐应用1的所有子窗口均作为目标子窗口。当音乐应用1的部分子窗口的进程号为进程号一时,则将音乐应用1的该部分子窗口均作为目标子窗口。当音乐应用1的部分子窗口的进程号均不是进程号一时,则说明音乐应用1中的子窗口不包含目标子窗口。跨进程管理模块430继续查找视频应用1的父窗口中的所有子窗口。If the cross-process management module 430 finds all child windows in the parent window of music application 1, and obtains the process numbers of all child windows of music application 1, when the process numbers of all child windows of music application 1 are process number one , all sub-windows of the music application 1 are used as target sub-windows. When the process numbers of some of the sub-windows of the music application 1 are process number 1, all the sub-windows of the music application 1 are used as the target sub-windows. When the process numbers of some of the sub-windows of the music application 1 are not process number 1, it means that the sub-windows in the music application 1 do not include the target sub-window. The cross-process management module 430 continues to search for all child windows in the parent window of the video application 1 .
可选的,若跨进程管理模块430在音乐应用1的父窗口中找到了进程号为进程号一的所有子窗口。跨进程管理模块430还需查找视频应用1的父窗口中的所有子窗口,并获取到视频应用1的所有子窗口的进程号。当视频应用1的所有子窗口的进程号为进程号一时,则将视频应用1的所有子窗口均作为目标子窗口。当视频应用1的部分子窗口的进程号为进程号一时,则将视频应用1的该部分子窗口均作为目标子窗口。Optionally, if the cross-process management module 430 finds all child windows whose process number is process number one in the parent window of the music application 1 . The cross-process management module 430 also needs to search for all sub-windows in the parent window of the video application 1, and obtain the process numbers of all sub-windows of the video application 1. When the process IDs of all the sub-windows of the video application 1 are process ID 1, all the sub-windows of the video application 1 are used as the target sub-windows. When the process number of some of the sub-windows of the video application 1 is process number 1, all the sub-windows of the video application 1 are used as the target sub-windows.
通过上述方式,直至跨进程管理模块430查找到所有的父窗口中的进程号为进程号一的子窗口。Through the above method, until the cross-process management module 430 finds all child windows whose process number is process number one in the parent window.
当跨进程管理模块430首先在音乐应用1的子窗口中查找到目标子窗口时,跨进程管理模块430还可以继续查找视频应用1是否存在目标子窗口,直至依次遍历完所有的父窗口中 的子窗口。这样,可以避免跨进程管理模块430漏查找目标子窗口的情况发生,提高了跨进程实现音频播放管控的准确性。When the cross-process management module 430 first finds the target sub-window in the sub-window of the music application 1, the cross-process management module 430 can also continue to search for whether the target sub-window exists in the video application 1 until it traverses all the parent windows in turn. child window. In this way, the situation that the cross-process management module 430 fails to find the target sub-window can be avoided, and the accuracy of cross-process audio playback control is improved.
S706A、跨进程管理模块430获取到目标子窗口的标识。S706A, the cross-process management module 430 obtains the identifier of the target sub-window.
这里,目标子窗口的标识可以为一个,也可以为多个。Here, the identifier of the target sub-window may be one or multiple.
目标子窗口的标识可以是目标子窗口的句柄等信息。目标子窗口的句柄可以理解为目标子窗口的编号,每一个目标子窗口的标号均不相同。这样,跨进程管理模块430可以基于目标子窗口的句柄查找到对应的目标子窗口。The identifier of the target sub-window may be information such as a handle of the target sub-window. The handle of the target sub-window can be understood as the number of the target sub-window, and the labels of each target sub-window are different. In this way, the cross-process management module 430 can find the corresponding target sub-window based on the handle of the target sub-window.
S707A、跨进程管理模块430发送暂停指令和目标子窗口的标识给进程号一的进程。S707A, the cross-process management module 430 sends the pause instruction and the target sub-window identifier to the process with process number one.
跨进程管理模块430在获取到目标子窗口的标识后,将暂停指令和目标子窗口的标识发送给进程号一的进程,进程号一的进程在接收到暂停指令和目标子窗口的标识后,将控制目标子窗口的标识对应的目标子窗口暂停播放音频。这样,跨进程管理模块430实现了跨进程控制音频暂停的功能,避免了在同一时刻有多路音频输出,给用户带来不好的用户体验。After obtaining the identification of the target sub-window, the cross-process management module 430 sends the suspension instruction and the identification of the target sub-window to the process of the process number one, and after the process of the process number one receives the suspension instruction and the identification of the target sub-window, The target sub-window corresponding to the identifier of the target sub-window will be controlled to pause playing audio. In this way, the cross-process management module 430 realizes the function of controlling audio pause across processes, avoiding multiple audio outputs at the same time and bringing bad user experience to the user.
图7B示例性示出了另一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图。FIG. 7B exemplarily shows another schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
S701B、跨进程管理模块430依次遍历每一个父窗口,获取到进程号为进程号一的所有父窗口,作为目标父窗口。S701B. The cross-process management module 430 traverses each parent window in turn, and obtains all parent windows whose process number is process number one as target parent windows.
S702B、跨进程管理模块430依次遍历每一个父窗口下的所有子窗口,获取到进程号为进程号一的所有子窗口,作为目标子窗口。S702B, the cross-process management module 430 sequentially traverses all child windows under each parent window, and acquires all child windows whose process number is process number one as target child windows.
S703B、跨进程管理模块430获取到目标父窗口的标识和目标子窗口的标识。S703B, the cross-process management module 430 acquires the identifier of the target parent window and the identifier of the target child window.
S704B、跨进程管理模块430发送暂停指令、目标父窗口的标识和目标子窗口的标识给进程号一的进程。S704B, the cross-process management module 430 sends the pause command, the identifier of the target parent window and the identifier of the target child window to the process with process number one.
图7B与图7A的不同之处在于,跨进程管理模块430不需要执行图7A中S704A的判断步骤,因为跨进程管理模块430无法提前获取到实现播放/暂停功能的窗口时哪一个父窗口或者哪一个子窗口,而实现播放/暂停功能的窗口要么是在父窗口中,要么是在子窗口中。因此跨进程管理模块430直接给所有的目标子窗口和目标父窗口发送暂停指令,就可以使得音频类应用1停止播放音频。The difference between FIG. 7B and FIG. 7A is that the cross-process management module 430 does not need to execute the judgment step of S704A in FIG. 7A, because the cross-process management module 430 cannot obtain in advance which parent window or Which child window, and the window that implements the play/pause function is either in the parent window or in the child window. Therefore, the cross-process management module 430 directly sends pause commands to all target child windows and target parent windows, so that the audio application 1 can stop playing audio.
图7C示例性示出了又一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图。FIG. 7C exemplarily shows another schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
S701C、跨进程管理模块430依次遍历每一个父窗口,获取到进程号为进程号一的所有父窗口,作为目标父窗口。S701C. The cross-process management module 430 traverses each parent window in turn, and obtains all parent windows whose process ID is process ID 1 as target parent windows.
S702C、跨进程管理模块430获取到目标父窗口的标识。S702C, the cross-process management module 430 acquires the identifier of the target parent window.
S703C、跨进程管理模块430发送暂停指令和目标父窗口的标识给进程号一的进程。S703C, the cross-process management module 430 sends the pause command and the target parent window identifier to the process with process number one.
S704C、跨进程管理模块430判断音频类应用1是否停止播放音频?S704C. The cross-process management module 430 judges whether the audio application 1 stops playing audio?
若跨进程管理模块430判断音频类应用1停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口为音频类应用1的父窗口,则该流程结束。If the cross-process management module 430 determines that the audio application 1 stops playing audio, it means that the window of the audio application 1 that implements the play/pause function is the parent window of the audio application 1, and the process ends.
若跨进程管理模块430判断音频类应用1没有停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口不是音频类应用1的父窗口,则跨进程管理模块430执行S705C。If the cross-process management module 430 determines that the audio application 1 has not stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is not the parent window of the audio application 1, and the cross-process management module 430 executes S705C.
S705C、跨进程管理模块430依次遍历到目标父窗口关联的每一个子窗口,获取到进程号 为进程号一的所有子窗口,作为目标子窗口。S705C, cross-process management module 430 traverses to each child window associated with the target parent window in turn, and obtains all child windows whose process number is process number one as the target child window.
S706C、跨进程管理模块430获取到目标子窗口的标识。S706C, the cross-process management module 430 obtains the identifier of the target sub-window.
S707C、跨进程管理模块430发送暂停指令和目标子窗口的标识发送给进程号一的进程。S707C, the cross-process management module 430 sends the pause command and the target sub-window identifier to the process with process number one.
图7C与图7A的不同之处在于,跨进程管理模块430不需要执行图7A中S705A的步骤,而是将S705A替换为S705C。在S705C中,跨进程管理模块430无需依次遍历每一个父窗口下的子窗口,再从所有的子窗口中获取到进程号为进程号一的子窗口。跨进程管理模块430可以直接从目标父窗口关联的子窗口中遍历到进程号为一的子窗口,作为目标子窗口,节省了跨进程管理模块430查找到进程号为一的子窗口的时间,提高了跨进程管理模块430控制音频类应用1停止播放音频的效率。The difference between FIG. 7C and FIG. 7A is that the cross-process management module 430 does not need to execute step S705A in FIG. 7A , but replaces S705A with S705C. In S705C, the cross-process management module 430 does not need to traverse each child window under each parent window in turn, and then obtain the child window whose process number is process number one from all the child windows. The cross-process management module 430 can directly traverse from the child window associated with the target parent window to the child window whose process number is one, as the target child window, saving the time for the cross-process management module 430 to find the child window whose process number is one, The efficiency of the cross-process management module 430 controlling the audio application 1 to stop playing audio is improved.
图7D示例性示出了再一种跨进程管理模块430如何基于进程号一和暂停指令控制音频类应用1停止播放音频的示意图。FIG. 7D exemplarily shows another schematic diagram of how the cross-process management module 430 controls the audio application 1 to stop playing audio based on the process number one and the pause instruction.
S701D、跨进程管理模块430依次遍历每一个父窗口,遍历至下一个父窗口。S701D. The cross-process management module 430 traverses each parent window in turn, and traverses to the next parent window.
S702D、发送暂停指令和下一个父窗口的标识给进程号一的进程。S702D. Send the pause command and the next parent window identifier to the process with process number one.
S703D、跨进程管理模块430判断音频类应用1是否停止播放音频?S703D. The cross-process management module 430 judges whether the audio application 1 stops playing audio?
若跨进程管理模块430判断音频类应用1没有停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口不是音频类应用1的父窗口,则跨进程管理模块430执行S704D。If the cross-process management module 430 determines that the audio application 1 has not stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is not the parent window of the audio application 1, and the cross-process management module 430 executes S704D.
若跨进程管理模块430判断音频类应用1停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口是音频类应用1的父窗口,则该流程结束。If the cross-process management module 430 determines that the audio application 1 has stopped playing audio, it means that the window of the audio application 1 that implements the play/pause function is the parent window of the audio application 1, and the process ends.
S704D、跨进程管理模块430依次遍历下一个父窗口关联的子窗口。S704D. The cross-process management module 430 sequentially traverses the child windows associated with the next parent window.
S705D、跨进程管理模块430判断下一个父窗口关联的子窗口的进程号为进程号一?S705D. The cross-process management module 430 judges that the process number of the child window associated with the next parent window is process number one?
若是,则说明音频类应用1实现播放/暂停功能的窗口可能是下一个父窗口关联的子窗口,跨进程管理模块430执行S706D。若不是,则说明音频类应用1实现播放/暂停功能的窗口不是下一个父窗口关联的子窗口,跨进程管理模块430执行S701D。If yes, it means that the window implementing the play/pause function of the audio application 1 may be a child window associated with the next parent window, and the cross-process management module 430 executes S706D. If not, it means that the window implementing the play/pause function of the audio application 1 is not a child window associated with the next parent window, and the cross-process management module 430 executes S701D.
S706D、跨进程管理模块430发送暂停指令和进程号一的下一个父窗口关联的子窗口的标识给进程号一的进程。S706D, the cross-process management module 430 sends the pause command and the identifier of the child window associated with the next parent window of the process number one to the process of the process number one.
在跨进程管理模块430发送暂停指令和进程号一的下一个父窗口关联的子窗口的标识给进程号一的进程后,跨进程管理模块430执行S703D的判断步骤。若音频类应用1停止播放音频,则说明音频类应用1实现播放/暂停功能的窗口是下一个父窗口关联的子窗口,该流程结束。若不是,则说明音频类应用1实现播放/暂停功能的窗口不是下一个父窗口关联的子窗口,跨进程管理模块430执行S701D,跨进程管理模块430继续查找下一个父窗口和下一个父窗口关联的子窗口,直至跨进程管理模块430查找到使得音频类应用1停止播放音频的父窗口或者父窗口关联的子窗口。After the cross-process management module 430 sends the pause command and the identifier of the child window associated with the next parent window of the process number one to the process of the process number one, the cross-process management module 430 executes the judgment step of S703D. If the audio application 1 stops playing audio, it means that the window implementing the play/pause function of the audio application 1 is a child window associated with the next parent window, and the process ends. If not, it means that the window in which the audio application 1 implements the play/pause function is not a child window associated with the next parent window, the cross-process management module 430 executes S701D, and the cross-process management module 430 continues to search for the next parent window and the next parent window Associated child windows until the cross-process management module 430 finds the parent window that causes the audio application 1 to stop playing audio or the child window associated with the parent window.
图7C与图7A的不同之处在于,首先,跨进程管理模块430不需要判断父窗口的进程号,而是在遍历至每一个父窗口时,直接给将正在遍历的父窗口的标识和暂停指令发送至进程号为进程号一的进程。其次,跨进程管理模块430不是一次查找到所有父窗口关联的子窗口,而是仅遍历正在遍历的父窗口关联的子窗口,跨进程管理模块430将正在遍历的父窗口关联的子窗口的标识和暂停指令发送至进程号为进程号一的进程,若该操作使得音频类应用1暂停播放音频,则跨进程管理模块430不需要在遍历其他的父窗口和子窗口了,与图7A中的S705A相比,节省了跨进程管理模块430遍历所有父窗口关联的子窗口的时间。若该操作没 有使得音频类应用1暂停播放音频,则跨进程管理模块430继续执行S701D。The difference between Fig. 7C and Fig. 7A is that, firstly, the cross-process management module 430 does not need to judge the process number of the parent window, but when traversing to each parent window, it directly gives the identification and pause of the parent window being traversed. The instruction is sent to the process whose process ID is process ID one. Secondly, the cross-process management module 430 does not find all the child windows associated with the parent window at one time, but only traverses the child windows associated with the parent window being traversed, and the cross-process management module 430 uses the identifier of the child window associated with the parent window being traversed and suspend instruction is sent to the process whose process number is process number one, if this operation causes the audio application 1 to suspend playing audio, then the cross-process management module 430 does not need to traverse other parent windows and child windows, which is the same as S705A in FIG. 7A In comparison, the cross-process management module 430 saves time for traversing all child windows associated with the parent window. If the operation does not cause the audio application 1 to suspend playing audio, the cross-process management module 430 continues to execute S701D.
在音频类应用2暂停播放音频后,跨进程管理模块430也可以自动控制音频类应用1继续播放音频。对于跨进程管理模块430如何基于进程号一控制音频类应用1继续播放音频的原理,与跨进程管理模块430如何基于进程号一控制音频类应用1暂停播放音频的原理类似。具体的,可以参考图7A-图7C中的相关描述。只是前者是继续播放音频,后者是暂停播放音频,两者的不同之处在于,在跨进程管理模块430控制音频类应用1继续播放音频之前,跨进程管理模块430需确定出之前音频类应用1暂停播放音频的触发操作是用户主动触发的,还是由于系统的播放优先级策略触发的。若跨进程管理模块430确定出之前音频类应用1暂停播放音频的触发操作是用户主动触发的,那么跨进程管理模块430不会控制音频类应用1继续播放音频,避免与用户的意愿发生冲突。若跨进程管理模块430确定出之前音频类应用1暂停播放音频的触发操作是系统的播放优先级策略触发的,那么跨进程管理模块430将控制音频类应用1继续播放音频。对于跨进程管理模块430如何确定出音频类应用1暂停播放音频的触发操作是用户主动触发的,还是统的播放优先级策略触发的,可以参考图5实施例中的详细介绍,本申请实施例在此不再赘述。After the audio application 2 suspends playing the audio, the cross-process management module 430 may also automatically control the audio application 1 to continue playing the audio. The principle of how the cross-process management module 430 controls the audio application 1 to continue playing audio based on the process number one is similar to the principle of how the cross-process management module 430 controls the audio application 1 to pause playing audio based on the process number one. Specifically, reference may be made to related descriptions in FIG. 7A-FIG. 7C. It’s just that the former continues to play the audio, and the latter pauses the audio. The difference between the two is that before the cross-process management module 430 controls the audio application 1 to continue playing the audio, the cross-process management module 430 needs to determine the previous audio application. 1 Whether the trigger operation of pausing audio playback is initiated by the user or triggered by the system's playback priority policy. If the cross-process management module 430 determines that the previous trigger operation of the audio application 1 to suspend audio playback is actively triggered by the user, then the cross-process management module 430 will not control the audio application 1 to continue playing audio, so as to avoid conflicts with the user's wishes. If the cross-process management module 430 determines that the previous trigger operation of the audio application 1 to suspend playing audio is triggered by the system's playback priority policy, then the cross-process management module 430 will control the audio application 1 to continue playing audio. For how the cross-process management module 430 determines whether the audio application 1 pauses the audio playback trigger operation is triggered by the user, or is triggered by the system's playback priority policy, you can refer to the detailed introduction in the embodiment of Figure 5, the embodiment of the present application I won't repeat them here.
接下来对本申请实施例涉及的预设的优先级策略进行解释说明。Next, the preset priority policy involved in the embodiment of the present application will be explained.
需要说明的是,预设的优先级策略是针对音频类应用设定的,即电子设备100可以将音频类应用划分为不同的优先级。It should be noted that the preset priority policy is set for audio applications, that is, the electronic device 100 can divide audio applications into different priorities.
方式一:将电子设备100中的应用划分为不同的优先级等级。例如可以分为第一等级,第二等级、第三等级和第四级等等,其中,第一等级的优先级大于第二级别的优先级,第二级别的优先级大于第三级别的优先级,第三级别的优先级大于第四级别的优先级。电子设备100将不同的应用划分到不同的优先级等级中。Way 1: Divide the applications in the electronic device 100 into different priority levels. For example, it can be divided into the first level, the second level, the third level and the fourth level, etc., wherein the priority of the first level is greater than the priority of the second level, and the priority of the second level is greater than the priority of the third level level, the priority of the third level is higher than that of the fourth level. The electronic device 100 divides different applications into different priority levels.
表1Table 1
Figure PCTCN2022140714-appb-000001
Figure PCTCN2022140714-appb-000001
表1示例性示出了电子设备100中的应用的优先级等级划分的结果。例如,实时语音/实时视频类应用的优先级等级为第一等级,实时语音/实时视频类应用可以包括但不仅限于电话应用、社交应用(例如即时通信类应用等)。导航类应用的优先级等级为第二等级,导航类应用可以包括但不仅限于百度地图应用等。游戏类应用的优先级等级为第三等级,游戏类应用可以包括但不仅限于王者荣耀应用等。音乐类应用的优先级等级为第四等级,音乐类应用可以包括但不仅限于网易云音乐应用等。视频类应用的优先级等级也为第四等级,视频类应用可以包括但不仅限于腾讯视频应用等。Table 1 exemplarily shows the result of the priority level division of the applications in the electronic device 100 . For example, the priority level of real-time voice/real-time video applications is the first level, and real-time voice/real-time video applications may include but not limited to telephone applications and social applications (such as instant messaging applications, etc.). The priority level of the navigation application is the second level, and the navigation application may include but not limited to the Baidu map application and the like. The priority level of game applications is the third level, and game applications may include, but are not limited to, applications such as Honor of Kings. The priority level of music applications is the fourth level, and music applications may include but not limited to Netease cloud music applications. The priority level of video applications is also the fourth level, and video applications may include but not limited to Tencent video applications.
需要说明的是,表1只是示例性示出了部分应用的优先级划分的结果。具体实现中,可 以包括比表1中的优先级的等级更多的其他级别,音频类应用的类别也可以更多,本申请实施例对此不做限定。It should be noted that Table 1 only exemplarily shows the results of the priority division of some applications. In a specific implementation, it may include more levels of priority than those in Table 1, and there may be more categories of audio applications, which are not limited in this embodiment of the present application.
由于电子设备100中的应用的种类在实时变化,因此电子设备100可以周期性的更新电子设备100中的应用的优先级等级。可选的,电子设备100可以基于用户使用的频率、以及用户的使用习惯变更电子设备100中的应用的优先级等级。也就是说,电子设备100中的应用的优先级等级是可以变化的。可选的,电子设备100也可以接收用户的操作自定义电子设备100中的应用的优先级等级,这样,可以根据用户的意愿设置不用的应用的优先级等级,进一步提高了用户体验。Since the types of applications in the electronic device 100 change in real time, the electronic device 100 may periodically update the priority levels of the applications in the electronic device 100 . Optionally, the electronic device 100 may change the priority level of the applications in the electronic device 100 based on the user's usage frequency and the user's usage habits. That is to say, the priority levels of the applications in the electronic device 100 can be changed. Optionally, the electronic device 100 can also customize the priority levels of the applications in the electronic device 100 by receiving the user's operation. In this way, the priority levels of unused applications can be set according to the user's wishes, which further improves the user experience.
下面以音频类应用1和音频类应用2为例,对如何根据预设的优先级策略进行音频播放控制的。Taking the audio application 1 and the audio application 2 as examples below, how to perform audio playback control according to a preset priority strategy.
一、当音频类应用1的优先级与音频类应用2的优先级相同时,也就是同级切换,电子设备100默认播放时刻晚的音频类应用可以继续播放音频,播放时刻早的音频类应用暂停播放音频。示例性的,当音频类应用1在播放音频时,电子设备100接收用户操作通过音频类应用2开始播放音频,由于音频类应用2的播放时刻晚于音频类应用1的播放时刻,电子设备100将控制音频类应用1暂停播放,并控制音频类应用2开始播放音频。1. When the priority of audio application 1 is the same as that of audio application 2, that is, switching at the same level, the electronic device 100 defaults that the audio application with a later playback time can continue to play audio, and the audio application with an earlier playback time Pause audio playback. Exemplarily, when the audio application 1 is playing audio, the electronic device 100 receives a user operation and starts playing audio through the audio application 2. Since the playback time of the audio application 2 is later than that of the audio application 1, the electronic device 100 The audio application 1 will be controlled to pause playback, and the audio application 2 will be controlled to start playing audio.
二、当音频类应用1的优先级高于音频类应用2的优先级时,也就是高级向低级切换,电子设备100可以给出提示信息,该提示信息用于提示用户先暂停优先级高的音频类应用播放音频或者提示用户无法切换播放音频的音频类应用。示例性的,当音频类应用1在播放音频时,电子设备100接收用户操作通过音频类应用2开始播放音频,由于音频类应用1的优先级高于音频类应用2的优先级,电子设备100无法控制音频类应用1暂停播放,并控制音频类应用2开始播放音频。可选的,电子设备100可以输出提示信息,该提示信息用于提示用户无法控制音频类应用2开始播放音频。可选的,电子设备100也可以输出提示信息,该提示信息用于提示用户若想通过音频类应用2开始播放音频,请先暂停音频类应用1播放的音频。2. When the priority of the audio application 1 is higher than that of the audio application 2, that is, switching from a high level to a low level, the electronic device 100 can give a prompt message, which is used to prompt the user to suspend the high priority application first. An audio application that plays audio or prompts the user that the audio cannot be switched. Exemplarily, when the audio application 1 is playing audio, the electronic device 100 receives a user operation to start playing audio through the audio application 2. Since the priority of the audio application 1 is higher than that of the audio application 2, the electronic device 100 Cannot control audio application 1 to pause playback, and control audio application 2 to start playing audio. Optionally, the electronic device 100 may output prompt information, which is used to prompt the user that the audio application 2 cannot be controlled to start playing audio. Optionally, the electronic device 100 may also output prompt information, which is used to prompt the user to pause the audio played by the audio application 1 if he wants to start playing audio through the audio application 2 .
三、当音频类应用1的优先级低于音频类应用2的优先级时,也就是低级向高级切换,电子设备100可以直接暂停低优先级的音频类应用播放音频,并控制高优先级的音频类应用播放音频。示例性的,当音频类应用1在播放音频时,电子设备100接收用户操作通过音频类应用2开始播放音频,由于音频类应用1的优先级低于音频类应用2的优先级,因此,电子设备100可以直接暂停音频类应用1播放的音频,并控制音频类应用2开始播放音频。3. When the priority of the audio application 1 is lower than the priority of the audio application 2, that is, switching from low priority to high priority, the electronic device 100 can directly suspend the audio playback of the low priority audio application, and control the high priority audio application Audio apps play audio. Exemplarily, when the audio application 1 is playing audio, the electronic device 100 receives a user operation and starts playing audio through the audio application 2. Since the priority of the audio application 1 is lower than that of the audio application 2, the electronic device 100 The device 100 may directly pause the audio played by the audio application 1, and control the audio application 2 to start playing the audio.
方式二:电子设备100没有将电子设备100中的音频类应用划分优先级,而是基于播放时刻来确定是否切换。电子设备100默认播放时刻晚的音频类应用的优先级始终高于播放时刻早的音频类应用的优先级。示例性的,当音频类应用1在播放音频时,电子设备100接收用户操作通过音频类应用2开始播放音频,由于音频类应用2的播放时刻晚于音频类应用1的播放时刻,电子设备100将控制音频类应用1暂停播放,并控制音频类应用2开始播放音频。Method 2: the electronic device 100 does not prioritize the audio applications in the electronic device 100, but determines whether to switch based on the playing time. By default, the electronic device 100 always has a higher priority of an audio application with a later playback time than an audio application with an earlier playback time. Exemplarily, when the audio application 1 is playing audio, the electronic device 100 receives a user operation and starts playing audio through the audio application 2. Since the playback time of the audio application 2 is later than that of the audio application 1, the electronic device 100 The audio application 1 will be controlled to pause playback, and the audio application 2 will be controlled to start playing audio.
需要说明的是,不仅限于方式一和方式二介绍的预设的优先级策略,还可以包括其他更多的优先级策略,本申请实施例对此不做限定。It should be noted that it is not limited to the preset priority policies introduced in the first and second ways, but may also include other more priority policies, which are not limited in this embodiment of the present application.
接下来结合附图基于上述介绍的预设的优先级策略,对本申请实施例提供的一种音频播 放方法进行介绍。Next, an audio playback method provided by the embodiment of the present application is introduced based on the preset priority policy described above in conjunction with the accompanying drawings.
图8A-图8B示例性示出了由低优先级的音频类应用切换为高优先级的音频类应用时,电子设备100如何输出音频的示意图。8A-8B exemplarily show how the electronic device 100 outputs audio when switching from a low-priority audio application to a high-priority audio application.
示例性的,音频类应用1可以是音乐应用、音频类应用2可以是即时通信类应用。音乐应用的优先级低于即时通信类应用的优先级。即时通信类应用具有语音聊天或者视频聊天的功能。Exemplarily, the audio application 1 may be a music application, and the audio application 2 may be an instant messaging application. The priority of music applications is lower than that of instant messaging applications. The instant messaging application has the function of voice chat or video chat.
具体的,可以参考图1A-图1C中的相关描述,电子设备10通过音乐应用播放音乐,电子设备100在桌面上显示音乐应用的用户界面1001。Specifically, reference may be made to the relevant descriptions in FIGS. 1A-1C , the electronic device 10 plays music through a music application, and the electronic device 100 displays a user interface 1001 of the music application on the desktop.
之后,如图8A所示,在电子设备100播放音乐的过程中,电子设备100接收到其他电子设备发送的语音通话请求,电子设备100接收用户针对提示栏1003中的接收控件1004的输入操作(例如单击),电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接。在电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接后,由于即时通信类应用的优先级高于音乐应用的优先级,为了控制在同一时刻仅有一路音频输出,电子设备100将控制低优先级的应用暂停播放音频,即电子设备100控制音乐应用暂停播放音频。Afterwards, as shown in FIG. 8A, during the electronic device 100 playing music, the electronic device 100 receives a voice call request sent by other electronic devices, and the electronic device 100 receives the user's input operation on the receiving control 1004 in the prompt bar 1003 ( For example, click), the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily". After the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", since the priority of instant messaging applications is higher than that of music applications, in order to control only one audio output at the same time, the electronic device The 100 will control low-priority applications to suspend playing audio, that is, the electronic device 100 controls the music application to suspend playing audio.
如图8B所示,在电子设备100控制音乐应用暂停播放音频后,电子设备100将用户界面1001中的暂停/播放控件1002的显示形式显示为暂停状态。同时,电子设备100显示语音通话用户界面1006,电子设备100控制即时通信类应用播放出联系人“Lily”的语音,语音内容可以是“稍等两分钟,等待其他人上线”。As shown in FIG. 8B , after the electronic device 100 controls the music application to pause playing audio, the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a paused state. At the same time, the electronic device 100 displays the voice call user interface 1006, and the electronic device 100 controls the instant messaging application to play the voice of the contact "Lily".
在电子设备100结束与联系人“Lily”所使用的电子设备建立语音通话连接后,电子设备100停止显示语音通话用户界面1006,电子设备100还在桌面上显示用户界面1001,且电子设备100将用户界面1001中的暂停/播放控件1002的显示形式显示为播放状态,也就是说,在结束语音通话后,若之前电子设备100是由于播放优先级策略使得音乐应用暂停播放音频,而不是用户主动触发操作使得音乐应用暂停播放音频的,电子设备100可以自动继续播放音乐应用中的音频。After the electronic device 100 finishes establishing a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 stops displaying the voice call user interface 1006, and the electronic device 100 still displays the user interface 1001 on the desktop, and the electronic device 100 will The display form of the pause/play control 1002 in the user interface 1001 is displayed as a playing state, that is, after the voice call is ended, if the electronic device 100 previously caused the music application to pause playing the audio due to the playback priority policy, rather than the user actively If the trigger operation causes the music application to pause playing audio, the electronic device 100 can automatically continue playing the audio in the music application.
图9A-图9C示例性示出了由高优先级的音频类应用切换为低优先级的音频类应用时,电子设备100如何输出音频的示意图。9A-9C exemplarily show how the electronic device 100 outputs audio when switching from a high-priority audio application to a low-priority audio application.
示例性的,音频类应用1可以是即时通信类应用、音频类应用2可以是音乐应用。音乐应用的优先级低于即时通信类应用的优先级。Exemplarily, the audio application 1 may be an instant messaging application, and the audio application 2 may be a music application. The priority of music applications is lower than that of instant messaging applications.
具体的,如图9A所示,具体的参考图1D-图1E中的描述,电子设备100首先与联系人“Lily”所使用的电子设备建立语音通话连接,并在桌面上显示如图9A所示的语音通话用户界面1006。Specifically, as shown in FIG. 9A , with specific reference to the description in FIG. 1D-FIG. 1E , the electronic device 100 first establishes a voice call connection with the electronic device used by the contact "Lily", and displays the message shown in FIG. 9A on the desktop. The voice call user interface 1006 shown.
之后,当用户在与联系人“Lily”进行语音通话的过程中,用户又想通过音乐应用播放音乐。如图9B所示,具体的参考图1A-图1B中的描述,电子设备100又在桌面上显示如图9B所示的音乐应用的用户界面1001。Later, when the user is in the process of making a voice call with the contact "Lily", the user wants to play music through the music application. As shown in FIG. 9B , with specific reference to the description in FIGS. 1A-1B , the electronic device 100 displays the user interface 1001 of the music application as shown in FIG. 9B on the desktop.
如图9B所示,电子设备100接收用户针对用户界面1001中的暂停/播放控件1002的输入操作(例如单击),响应于用户的输入操作,电子设备100在桌面上显示如图9C所示的音乐应用的提示栏901。提示栏901中的提示内容可以是“在开始播放音乐之前,请先结束正在进行的语音通话”,提示栏901中的提示内容还可以是“当前正在进行的语音通话,无法播放音乐”等。这样,当由高优先级的音频类应用切换为低优先级的音频类应用时,电子 设备100可以输出提示信息,防止电子设备100直接切换为由低优先级的音频类应用播放音频,应用用户体验。As shown in Figure 9B, the electronic device 100 receives the user's input operation (for example, click) on the pause/play control 1002 in the user interface 1001, and in response to the user's input operation, the electronic device 100 displays on the desktop as shown in Figure 9C The prompt bar 901 of the music application. The prompt content in the prompt bar 901 can be "before playing music, please end the ongoing voice call first", and the prompt content in the prompt bar 901 can also be "the current ongoing voice call cannot play music" and so on. In this way, when switching from a high-priority audio application to a low-priority audio application, the electronic device 100 can output a prompt message to prevent the electronic device 100 from directly switching to a low-priority audio application to play audio, and the application user experience.
图10A-图10C示例性示出了相同优先级的音频类应用在切换时,电子设备100如何输出音频的示意图。10A-10C exemplarily show how the electronic device 100 outputs audio when audio applications of the same priority are switched.
示例性的,音频类应用1可以是音乐应用、音频类应用2可以是视频应用。音乐应用的优先级与视频应用的优先级相同。Exemplarily, the audio application 1 may be a music application, and the audio application 2 may be a video application. Music apps have the same priority as video apps.
具体的,如图10A所示,可以参考图1A-图1C中的相关描述,电子设备10通过音乐应用播放音乐。电子设备100在桌面上显示如图10A所示的音乐应用的用户界面1001。Specifically, as shown in FIG. 10A , reference may be made to related descriptions in FIGS. 1A-1C , the electronic device 10 plays music through a music application. The electronic device 100 displays a user interface 1001 of a music application as shown in FIG. 10A on the desktop.
之后,当用户向通过视频应用播放视频时,电子设备100接收用户针对桌面上的视频的图标的输入操作(例如双击),电子设备100显示如图10B所示的视频应用的主用户界面1101。主用户界面1101包括有多个视频的图标,例如视频A的图标1102。Afterwards, when the user wants to play a video through the video application, the electronic device 100 receives the user's input operation (for example, double-click) on the video icon on the desktop, and the electronic device 100 displays the main user interface 1101 of the video application as shown in FIG. 10B . The main user interface 1101 includes icons of multiple videos, such as the icon 1102 of Video A.
如图10B所示,电子设备100接收用户针对图标1102的输入操作,电子设备100将会显示视频A的播放界面。由于音乐应用的优先级与视频应用的优先级相同,因此,如图10C所示,电子设备100可以直接控制音乐应用暂停播放音乐,在电子设备100控制音乐应用暂停播放音频后,电子设备100将用户界面1001中的暂停/播放控件1002的显示形式显示为暂停状态。同时,电子设备100显示视频A的视频播放界面1103,视频播放界面1103可以包括播放控件、上一集控件、下一集控件、选集控件等等。在电子设备100显示视频播放界面1103的同时,电子设备100控制视频应用播放出视频A中的音频。As shown in FIG. 10B , the electronic device 100 receives the user's input operation on the icon 1102 , and the electronic device 100 will display the playback interface of the video A. Since the priority of the music application is the same as that of the video application, as shown in FIG. 10C , the electronic device 100 can directly control the music application to pause playing music. The display form of the pause/play control 1002 in the user interface 1001 is displayed as a paused state. At the same time, the electronic device 100 displays a video playback interface 1103 of the video A, and the video playback interface 1103 may include a playback control, a previous episode control, a next episode control, a collection control, and the like. While the electronic device 100 displays the video playing interface 1103 , the electronic device 100 controls the video application to play the audio in the video A.
可选的,在电子设备100结束视频应用播放视频后,若之前电子设备100是由于播放优先级策略使得音乐应用暂停播放音频,而不是用户主动触发操作使得音乐应用暂停播放音频的,电子设备100可以自动开始播放音乐应用中的音频,电子设备100将用户界面1001中的暂停/播放控件1002的显示形式显示为播放状态,也就是说,在视频播放完毕后,电子设备100可以自动继续播放音乐应用中的音频。Optionally, after the electronic device 100 finishes playing the video by the video application, if the electronic device 100 previously made the music application pause playing the audio due to the playback priority policy, rather than the user actively triggering an operation to make the music application pause playing the audio, the electronic device 100 The audio in the music application can be played automatically, and the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a playing state, that is, after the video is played, the electronic device 100 can automatically continue to play the music Audio in the app.
可选的,若两个优先级相同的应用是两个不同的实时语音/实时视频类应用,首先电子设备100通过实时语音/实时视频类应用一与联系人进行语音通话,之后,实时语音/实时视频类应用二的联系人也向该用户发起了语音通话请求,当用户接收了实时语音/实时视频类应用二的联系人的语音通话请求时,电子设备100先不挂断与实时语音/实时视频类应用一的联系人的语音通话,而是首先输出提示信息,该提示信息用于提示用户在接受实时语音/实时视频类应用二的联系人的语音通话请求后,将结束与实时语音/实时视频类应用一与联系人一的语音通话。这样,在两个实时语音/实时视频类应用之间切换时,电子设备100可以输出提示信息,提示用于是否切换语音通话,提高了用户体验。Optionally, if the two applications with the same priority are two different real-time voice/real-time video applications, first, the electronic device 100 makes a voice call with the contact through the real-time voice/real-time video application one, and then, the real-time voice/real-time video The contact person of the second real-time video application also initiates a voice call request to the user. For a voice call with a contact in real-time video application 1, a prompt message is first output, which is used to remind the user that after accepting the voice call request from a contact in real-time voice/real-time video application 2, the communication with the real-time voice /Real-time video application one and contact one voice call. In this way, when switching between two real-time voice/real-time video applications, the electronic device 100 can output prompt information, prompting whether to switch the voice call, which improves user experience.
对于电子设备100没有将电子设备100中的音频类应用划分优先级的情况下,而是基于播放时刻来确定是否切换。也即后面播放的音频的优先级永远高于之前播放的音频的优先级。对于非实时语音/实时视频类应用之间的切换的情况下,电子设备100可以直接进行切换。当需要将实时语音/实时视频类应用切换为其他的音频类应用时,电子设备100可以输出提示信息,避免突然切换语音通话,影响用户体验。In the case that the electronic device 100 does not prioritize the audio-type applications in the electronic device 100, it determines whether to switch based on the playing time. That is to say, the priority of the audio played later is always higher than that of the audio played before. In the case of switching between non-real-time voice/real-time video applications, the electronic device 100 may directly switch. When it is necessary to switch the real-time audio/real-time video application to another audio application, the electronic device 100 may output a prompt message, so as to avoid sudden switching of the voice call and affect user experience.
如图11所示,图11示例性示出了本申请实施例提供的另一种同时播放多路音频的时序 图。As shown in FIG. 11 , FIG. 11 exemplarily shows another timing diagram for playing multiple channels of audio at the same time provided by the embodiment of the present application.
并申请实施例以由低优先级应用播放音频切换为由高优先级的应用播放音频为例进行说明。And the embodiment of the application is described by taking the switching from playing audio by a low-priority application to playing audio by a high-priority application as an example.
示例性的,低优先级应用可以是音乐应用、高优先级的应用可以是实时语音/实时视频类应用。Exemplarily, the low-priority application may be a music application, and the high-priority application may be a real-time voice/real-time video application.
在图11中,0ms时,电子设备100接收用户的操作开始播放音乐应用中的歌曲,一段时间(例如360ms)后,电子设备100接收用户操作接入了联系人“Lily”使用的电子设备发送的语音通话。如图11所示,在电子设备100与联系人“Lily”所使用的电子设备建立语音通话连接后,电子设备100可以播放出联系人“Lily”的语音,同时电子设备100暂停播放音乐应用中的歌曲。例如,若通话时长为480ms,那么电子设备100在0ms-480ms内播放联系人“Lily”的语音时,电子设备100暂停播放音乐应用中的歌曲。也就是说,电子设备100在播放高优先级的应用中的音频时,会暂停播放低优先级的应用中的音频,避免多路音频同时播放导致用户听到的是混音效果。在实时语音/实时视频类应用中的语音通话持续了480ms后,例如在840ms,语音通话结束,电子设备100暂停播放通话应用中的实时语音。电子设备100继续播放音乐应用中的歌曲。In FIG. 11, at 0 ms, the electronic device 100 receives the user's operation and starts to play the song in the music application. After a period of time (for example, 360 ms), the electronic device 100 receives the user's operation and accesses the electronic device sent by the contact "Lily". voice calls. As shown in FIG. 11 , after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "Lily", the electronic device 100 can play the voice of the contact "Lily", and at the same time, the electronic device 100 pauses playing music in the application. song. For example, if the call duration is 480ms, then when the electronic device 100 plays the voice of the contact "Lily" within 0ms-480ms, the electronic device 100 pauses playing the songs in the music application. That is to say, when the electronic device 100 is playing the audio in the high-priority application, it will pause the audio in the low-priority application, so as to prevent the user from hearing the sound mixing effect caused by multiple channels of audio playing at the same time. After the voice call in the real-time voice/real-time video application lasts for 480ms, for example, at 840ms, the voice call ends, and the electronic device 100 pauses playing the real-time voice in the call application. The electronic device 100 continues to play the songs in the music application.
从上述分析可知,电子设备100在播放多路音频时,电子设备100在播放高优先级的应用中的音频时,会暂停播放低优先级的应用中的音频,避免多路音频同时播放导致用户听到的是混音效果。例如在用户一边听音乐或者看电影的过程中,用户通过电子设备100接入了一个语音通话。用户在进行语音通话的过程中,音乐或者电影暂停播放,语音通话结束后,音乐或者电影继续播放,避免用户由于在接听语音通话的过程中错过好听的音乐片段或者精彩的电影片段,提高了用户体验。From the above analysis, it can be known that when the electronic device 100 is playing multiple channels of audio, when the electronic device 100 is playing audio in a high-priority application, it will pause playing the audio in a low-priority application, so as to avoid the simultaneous playback of multiple channels of audio and cause the user What you hear is the mixing effect. For example, while the user is listening to music or watching a movie, the user accesses a voice call through the electronic device 100 . When the user is in the process of making a voice call, the music or movie is paused, and after the voice call is over, the music or movie continues to play, which prevents the user from missing nice music clips or wonderful movie clips during the voice call, and improves the user experience. experience.
如图12,图12示例性示出了本申请实施例提供的一种音频播放方法的流程示意图。As shown in FIG. 12 , FIG. 12 exemplarily shows a schematic flowchart of an audio playback method provided by an embodiment of the present application.
S1201、电子设备100播放第一应用中的第一音频文件,并获取到第一应用的播放进程号和电子设备显示的窗口的进程号。S1201. The electronic device 100 plays a first audio file in a first application, and acquires a playing process number of the first application and a process number of a window displayed by the electronic device.
S1202、电子设备接收用户的第一操作,第一操作用于控制第二应用播放第二音频文件。S1202. The electronic device receives a first operation of the user, where the first operation is used to control the second application to play the second audio file.
可选的,第一应用可以是前述实施例介绍的音频类应用1(例如音乐应用)。第一应用的播放进程号可以是前述实施例介绍的音频类应用1的进程号一。Optionally, the first application may be the audio application 1 (such as a music application) introduced in the foregoing embodiments. The playing process number of the first application may be the process number one of the audio application 1 introduced in the foregoing embodiments.
第一操作可以是针对图8A中的接收控件1004的输入操作(例如单击)。第二应用可以是前述实施例介绍的音频类应用2(例如即时通信类应用)。The first operation may be an input operation (eg, click) on the receiving control 1004 in FIG. 8A . The second application may be the audio application 2 (such as an instant messaging application) introduced in the foregoing embodiments.
可选的,第一应用还可以是前述实施例介绍的音频类应用2(例如即时通信类应用)。第一应用的播放进程号可以是前述实施例介绍的音频类应用2的进程号二。Optionally, the first application may also be the audio application 2 (such as an instant messaging application) introduced in the foregoing embodiments. The playback process number of the first application may be the process number two of the audio application 2 described in the foregoing embodiments.
第一操作可以是针对图9B中的暂停/播放控件1002的输入操作(例如单击)。第二应用可以是前述实施例介绍的音频类应用1(例如音乐应用)。The first operation may be an input operation (eg, click) on the pause/play control 1002 in FIG. 9B . The second application may be the audio application 1 (such as a music application) introduced in the foregoing embodiments.
可选的,第一应用还可以是前述实施例介绍的音频类应用1(例如音乐应用)。第一应用的播放进程号可以是前述实施例介绍的音频类应用1的进程号一。Optionally, the first application may also be the audio application 1 (such as a music application) introduced in the foregoing embodiments. The playing process number of the first application may be the process number one of the audio application 1 introduced in the foregoing embodiments.
第一操作可以是针对10B中的图标1102的输入操作。第二应用可以是前述实施例介绍的音频类应用2(例如视频应用)。The first operation may be an input operation for the icon 1102 in 10B. The second application may be the audio application 2 (such as a video application) introduced in the foregoing embodiments.
S1203、响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。S1203. In response to the first operation, the electronic device determines, from the windows displayed by the electronic device, a target window whose process ID is the playing process ID of the first application.
其中,电子设备显示的窗口包括电子设备显示的父窗口,和电子设备显示的父窗口关联的子窗口。电子设备显示的父窗口可以包括多个,电子设备显示的每一个父窗口关联的子窗口也可以包括多个。Wherein, the window displayed by the electronic device includes a parent window displayed by the electronic device, and a child window associated with the parent window displayed by the electronic device. The parent window displayed by the electronic device may include multiple, and the child windows associated with each parent window displayed by the electronic device may also include multiple.
可选的,电子设备可以基于播放顺序确定出暂停播放的是第一应用。示例性的,由于第二应用的播放时间晚于第一应用的播放时间,则电子设备确定出暂停播放的是第一应用。Optionally, the electronic device may determine based on the playing sequence that the first application is paused for playing. Exemplarily, since the playing time of the second application is later than the playing time of the first application, the electronic device determines that it is the first application that is suspended for playing.
可选的,电子设备可以基于预设的应用优先级确定出暂停播放的是第一应用。示例性的,由于第二应用的优先级第一应用的优先级,则电子设备确定出暂停播放的是第一应用。Optionally, the electronic device may determine based on preset application priorities that the first application is paused for playback. Exemplarily, because the priority of the second application is the priority of the first application, the electronic device determines that the first application is paused.
可选的,电子设备可以基于应用播放的音频文件类型确定出暂停播放的是第一应用。Optionally, the electronic device may determine, based on the type of the audio file played by the application, that the first application is paused.
可选的,电子设备可以同时基于预设的应用优先级和应用播放的音频文件类型确定出暂停播放的是第一应用。Optionally, the electronic device may determine, based on the preset application priority and the type of the audio file played by the application, that it is the first application that is paused for playback.
响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:响应于第一操作,电子设备基于第一应用的优先级和第二应用的优先级,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。这样,电子设备可以基于预设的应用优先级,实现自动控制应用暂停播放音频。In response to the first operation, the electronic device determines, from the windows displayed by the electronic device, the target window whose process number is the playing process number of the first application, specifically including: in response to the first operation, the electronic device determines, based on the priority of the first application and The priority of the second application determines the target window whose process number is the playback process number of the first application from the windows displayed on the electronic device. In this way, the electronic device can automatically control the application to pause and play audio based on the preset application priority.
电子设备基于第一应用的优先级和第二应用的优先级,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:在第一应用的优先级低于第二应用的优先级的情况下,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。Based on the priority of the first application and the priority of the second application, the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: If the priority is lower than that of the second application, the electronic device determines the target window whose process number is the playing process number of the first application from the windows displayed on the electronic device.
在第一应用的优先级高于第二应用的优先级的情况下,电子设备继续播放第一应用中的第一音频文件,不播放第二应用中的第二音频文件。If the priority of the first application is higher than that of the second application, the electronic device continues to play the first audio file in the first application, and does not play the second audio file in the second application.
在第一应用的优先级与第二应用的优先级相同的情况下,电子设备输出第一提示信息,第一提示信息用于提示用户在播放第二应用中的第二音频文件之前,暂停播放第一应用中的第一音频文件。这样,可以提示用户暂停播放第一应用中的第一音频文件。When the priority of the first application is the same as that of the second application, the electronic device outputs first prompt information, and the first prompt information is used to prompt the user to pause the playback before playing the second audio file in the second application A first audio file in a first application. In this way, the user may be prompted to pause playing the first audio file in the first application.
可选的,响应于第一操作,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:响应于第一操作,电子设备基于第一音频文件的类型和第二音频文件的类型,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。这样,电子设备还可以基于应用中播放的音频文件的类型,实现自动控制应用暂停播放音频。Optionally, in response to the first operation, the electronic device determines, from the windows displayed by the electronic device, the target window whose process number is the playing process number of the first application, which specifically includes: in response to the first operation, the electronic device determines, based on the first audio The type of the file and the type of the second audio file determine the target window whose process number is the playing process number of the first application from the windows displayed on the electronic device. In this way, the electronic device can also automatically control the application to pause playing audio based on the type of the audio file played in the application.
可选的,电子设备还可以基于第一应用的优先级和第二应用的优先级、第一音频文件的类型和第二音频文件的类型从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。这样,电子设备还可以基于应用预设的优先级和应用中播放的音频文件的类型,实现自动控制应用暂停播放音频。Optionally, the electronic device may also determine from the window displayed by the electronic device that the process number is the first based on the priority of the first application and the priority of the second application, the type of the first audio file, and the type of the second audio file. The target window of the application's playback process ID. In this way, the electronic device can also automatically control the application to pause and play audio based on the preset priority of the application and the type of the audio file played in the application.
电子设备基于第一音频文件的类型和第二音频文件的类型,从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口,具体包括:在第一音频文件的类型为非实时类音频文件,第二音频文件的类型为实时类音频文件的情况下,电子设备从电子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口。也就是说,实时类音频文件的优先级最高。Based on the type of the first audio file and the type of the second audio file, the electronic device determines from the windows displayed on the electronic device the target window whose process number is the playback process number of the first application, specifically including: If the second audio file is a non-real-time audio file and the type of the second audio file is a real-time audio file, the electronic device determines the target window whose process ID is the playback process ID of the first application from the windows displayed on the electronic device. In other words, real-time audio files have the highest priority.
在电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件之前,方法还包括:在第一音频文件的类型为实时类音频文件的情况下,电子设备输出第二提示信息,第二提示信息用于指示用户暂停播放第一应用的第一音频文件;电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件,并控制第二应用播放第二音频文件,具体包括:电子设备接收用户的第二操作,响应于第二操作,电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,并控制第二应用播放第二音频文件。这样,由于实时类音频文件的优先级最高,可以避免电子设备将实时类音频文件切换为非实时类音频文件,影响用户体验。Before the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, the method further includes: when the type of the first audio file is a real-time audio file, the electronic device outputs second prompt information, The second prompt information is used to instruct the user to pause playing the first audio file of the first application; the electronic device controls the playback process of the first application corresponding to the target window to stop playing the first audio file, and controls the second application to play the second audio file, Specifically, the electronic device receives the user's second operation, and in response to the second operation, the electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, and controls the second application to play the second audio file. In this way, since the real-time audio file has the highest priority, the electronic device can avoid switching the real-time audio file to a non-real-time audio file, thereby affecting user experience.
S1204、电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,并控制第二应用播放第二音频文件。S1204. The electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, and controls the second application to play the second audio file.
可选的,电子设备控制目标窗口对应的第一应用的播放进程暂停播放第一音频文件,具体包括:电子设备获取到目标窗口的标识,并模拟出虚拟的空格键space key值;电子设备将目标窗口的标识和虚拟的space key值发送至第一应用的播放进程;电子设备通过目标窗口对应的第一应用的播放进程基于目标窗口的标识和虚拟的space key值控制第一应用暂停播放第一音频文件。这样,电子设备模拟出虚拟的space key值,不需要用户操作键盘上的空格键得到space key值,减少了用户操作。Optionally, the electronic device controls the playback process of the first application corresponding to the target window to pause the playback of the first audio file, specifically including: the electronic device obtains the identifier of the target window, and simulates a virtual space key value; the electronic device will The identification of the target window and the virtual space key value are sent to the playback process of the first application; the electronic device controls the first application to pause the playback of the first application based on the identification of the target window and the virtual space key value through the playback process of the first application corresponding to the target window an audio file. In this way, the electronic device simulates a virtual space key value, and the user does not need to operate the space key on the keyboard to obtain the space key value, which reduces user operations.
可选的,电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件,具体包括:电子设备依次遍历电子设备中显示的每一个父窗口,确定出进程号为第一应用的播放进程号的目标父窗口;电子设备控制目标父窗口对应的第一应用的播放进程停止播放第一音频文件;或者,电子设备依次遍历电子设备中的每一个父窗口,确定出进程号为第一应用的播放进程号的目标父窗口;在电子设备控制目标父窗口对应的第一应用的播放进程停止播放第一音频文件失败的情况下,电子设备依次遍历电子设备显示的每一个父窗口关联的每一个子窗口,获取到进程号为播放进程号的目标子窗口,或者,电子设备依次遍历电子设备显示的目标父窗口关联的每一个子窗口,获取到进程号为播放进程号的目标子窗口;电子设备控制目标子窗口对应的第一应用的播放进程停止播放第一音频文件。这样,电子设备先判断目标父窗口是否可以实现暂停播放音频,如果可以,则不需要遍历目标子窗口了,节省了电子设备查找目标子窗口的时间。若不可以,电子设备再遍历目标子窗口。Optionally, the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, which specifically includes: the electronic device sequentially traverses each parent window displayed in the electronic device, and determines that the process number is the first application's The target parent window of the playback process number; the electronic device controls the playback process of the first application corresponding to the target parent window to stop playing the first audio file; or, the electronic device traverses each parent window in the electronic device in turn, and determines that the process number is the first The target parent window of the playback process number of an application; in the case that the electronic device fails to control the playback process of the first application corresponding to the target parent window to stop playing the first audio file, the electronic device traverses in turn each parent window associated with the electronic device display For each sub-window of each sub-window, obtain the target sub-window whose process ID is the playback process ID, or, the electronic device sequentially traverses each sub-window associated with the target parent window displayed by the electronic device, and acquires the target sub-window whose process ID is the playback process ID Window: the electronic device controls the playing process of the first application corresponding to the target sub-window to stop playing the first audio file. In this way, the electronic device first judges whether the target parent window can pause and play audio, and if so, it does not need to traverse the target sub-window, which saves the time for the electronic device to search for the target sub-window. If not, the electronic device traverses the target sub-window again.
可选的,电子设备控制目标窗口对应的第一应用的播放进程停止播放第一音频文件,具体包括:电子设备依次遍历电子设备中显示的每一个父窗口,确定出进程号为第一应用的播放进程号的目标父窗口;电子设备依次遍历电子设备中显示的每一个子窗口,确定出进程号为第一应用的播放进程号的目标子窗口,或者,电子设备依次遍历电子设备显示的目标父窗口关联的每一个子窗口,确定出进程号为第一应用的播放进程号的目标子窗口;电子设备控制目标父窗口和目标子窗口对应的第一应用的播放进程停止播放第一音频文件。这样,实现播放逻辑的窗口要么是目标子窗口要么是目标父窗口,电子设备直接获取到目标父窗口和目标子窗口,即可实现控制应用赞同播放音频。Optionally, the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, which specifically includes: the electronic device sequentially traverses each parent window displayed in the electronic device, and determines that the process number is the first application's The target parent window of the playback process number; the electronic device traverses each sub-window displayed in the electronic device in turn, and determines the target sub-window whose process number is the playback process number of the first application, or the electronic device traverses the target displayed by the electronic device in turn For each child window associated with the parent window, determine the target child window whose process number is the playing process number of the first application; the electronic device controls the playing process of the first application corresponding to the target parent window and the target child window to stop playing the first audio file . In this way, the window implementing the playing logic is either the target child window or the target parent window, and the electronic device can directly obtain the target parent window and the target child window, so that the control application agrees to play audio.
对于,电子设备如何子设备显示的窗口中确定出进程号为第一应用的播放进程号的目标窗口收的,可以参考图7A-图7D所示的实施例。本申请实施例在此不再赘述。For how the electronic device determines the target window whose process number is the playing process number of the first application from the windows displayed by the sub-device, reference may be made to the embodiments shown in FIGS. 7A-7D . The embodiment of the present application will not be repeated here.
可选的,在电子设备开始输出第二应用中的第二音频文件之后,方法还包括:电子设备接收用户的第三操作,第三操作用于控制第二应用暂停播放第二音频文件;响应于第三操作,电子设备控制第二应用暂停播放第二音频文件,控制第一应用继续播放第一音频文件。这样,电子设备可以将控制由于系统设备导致应用暂停播放音频而不是用户主动触发操作导致应用暂停播放音频的应用再次自动开始播放音频,节省了用户操作。Optionally, after the electronic device starts to output the second audio file in the second application, the method further includes: the electronic device receives a third user operation, and the third operation is used to control the second application to pause playing the second audio file; responding In the third operation, the electronic device controls the second application to pause playing the second audio file, and controls the first application to continue playing the first audio file. In this way, the electronic device can control the application that pauses playing the audio due to the system device instead of the user actively triggering the operation to automatically start playing the audio again, which saves user operations.
可选的,电子设备接收用户的第四操作,第四操作用于控制第一应用暂停播放第一音频文件;响应于第四操作,电子设备控制第一应用暂停播放第一音频文件,控制第二应用继续暂停播放第二音频文件。这样,电子设备不会将控制由于用户主动触发操作导致应用暂停播放音频的应用再次自动开始播放音频,避免与用户的意愿发生冲突。Optionally, the electronic device receives a fourth user operation, and the fourth operation is used to control the first application to pause playing the first audio file; in response to the fourth operation, the electronic device controls the first application to pause playing the first audio file, and controls the first application The second application continues to pause and play the second audio file. In this way, the electronic device will not control the application that pauses to play the audio due to the active trigger operation of the user to automatically start playing the audio again, so as to avoid conflicts with the user's wishes.
本申请实施例还提供了一种电子设备,电子设备包括:一个或多个处理器、一个或多个存储器;一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器调用计算机指令以使得电子设备执行图12所示的一种音频播放方法。The embodiment of the present application also provides an electronic device, the electronic device includes: one or more processors, one or more memories; one or more memories are coupled with one or more processors, and one or more memories are used for Computer program codes are stored, and the computer program codes include computer instructions, and one or more processors call the computer instructions to make the electronic device execute an audio playback method shown in FIG. 12 .
本申请的各实施方式可以任意进行组合,以实现不同的技术效果。Various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the present application are generated in whole or in part. A computer can be a general purpose computer, special purpose computer, computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g. Coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server, a data center, etc. integrated with one or more available media. The usable medium may be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (solid state disk, SSD)), etc.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments are realized. The processes can be completed by computer programs to instruct related hardware. The programs can be stored in computer-readable storage media. When the programs are executed , may include the processes of the foregoing method embodiments. The aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk, and other various media that can store program codes.
总之,以上仅为本发明技术方案的实施例而已,并非用于限定本发明的保护范围。凡根据本发明的揭露,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围。In a word, the above are only examples of the technical solutions of the present invention, and are not intended to limit the protection scope of the present invention. All modifications, equivalent replacements, improvements, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.

Claims (15)

  1. 一种音频播放方法,其特征在于,所述方法包括:An audio playback method, characterized in that the method comprises:
    电子设备播放第一应用中的第一音频文件,并获取到所述第一应用的播放进程号和所述电子设备显示的窗口的进程号;The electronic device plays the first audio file in the first application, and obtains the playing process number of the first application and the process number of the window displayed by the electronic device;
    所述电子设备接收用户的第一操作,所述第一操作用于控制第二应用播放第二音频文件;The electronic device receives a user's first operation, and the first operation is used to control the second application to play the second audio file;
    响应于所述第一操作,所述电子设备从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的目标窗口;In response to the first operation, the electronic device determines, from the windows displayed by the electronic device, a target window whose process number is the playback process number of the first application;
    所述电子设备控制所述目标窗口对应的所述第一应用的播放进程暂停播放所述第一音频文件,并控制所述第二应用播放所述第二音频文件。The electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, and controls the second application to play the second audio file.
  2. 根据权利要求1所述的方法,其特征在于,所述电子设备控制所述目标窗口对应的所述第一应用的播放进程暂停播放所述第一音频文件,具体包括:The method according to claim 1, wherein the electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, specifically comprising:
    所述电子设备获取到所述目标窗口的标识,并模拟出虚拟的空格键space key值;The electronic device obtains the identification of the target window, and simulates a virtual space key space key value;
    所述电子设备将所述目标窗口的标识和所述虚拟的space key值发送至所述第一应用的播放进程;The electronic device sends the identity of the target window and the virtual space key value to the playback process of the first application;
    所述电子设备通过所述目标窗口对应的所述第一应用的播放进程基于所述目标窗口的标识和所述虚拟的space key值控制所述第一应用暂停播放所述第一音频文件。The electronic device controls the first application to pause playing the first audio file based on the identifier of the target window and the virtual space key value through the playing process of the first application corresponding to the target window.
  3. 根据权利要求1或2所述的方法,其特征在于,所述响应于所述第一操作,所述电子设备从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的目标窗口,具体包括:The method according to claim 1 or 2, wherein in response to the first operation, the electronic device determines that the process number is the playing of the first application from the window displayed by the electronic device The target window of the process ID, including:
    响应于所述第一操作,所述电子设备基于所述第一应用的优先级和所述第二应用的优先级,从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的所述目标窗口。In response to the first operation, based on the priority of the first application and the priority of the second application, the electronic device determines from a window displayed by the electronic device that the process number is the first application The playback process ID of the target window.
  4. 根据权利要求3所述的方法,其特征在于,所述电子设备基于所述第一应用的优先级和所述第二应用的优先级,从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的所述目标窗口,具体包括:The method according to claim 3, wherein, based on the priority of the first application and the priority of the second application, the electronic device determines that the process number is The target window of the playback process number of the first application specifically includes:
    在所述第一应用的优先级低于所述第二应用的优先级的情况下,所述电子设备从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的所述目标窗口。When the priority of the first application is lower than the priority of the second application, the electronic device determines that the process number is the playback process number of the first application from a window displayed by the electronic device of the target window.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, characterized in that the method further comprises:
    在所述第一应用的优先级高于所述第二应用的优先级的情况下,所述电子设备继续播放所述第一应用中的所述第一音频文件,不播放所述第二应用中的所述第二音频文件。If the priority of the first application is higher than the priority of the second application, the electronic device continues to play the first audio file in the first application without playing the second application The second audio file in .
  6. 根据权利要求4或5所述的方法,其特征在于,所述方法还包括:The method according to claim 4 or 5, characterized in that the method further comprises:
    在所述第一应用的优先级与所述第二应用的优先级相同的情况下,所述电子设备输出第一提示信息,所述第一提示信息用于提示用户在播放所述第二应用中的所述第二音频文件之前,暂停播放所述第一应用中的所述第一音频文件。When the priority of the first application is the same as that of the second application, the electronic device outputs first prompt information, the first prompt information is used to prompt the user to play the second application Before the second audio file in the application, pause playing the first audio file in the first application.
  7. 根据权利要求1或2所述的方法,其特征在于,所述响应于所述第一操作,所述电子设备从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的目标窗口,具体包括:The method according to claim 1 or 2, wherein in response to the first operation, the electronic device determines that the process number is the playing of the first application from the window displayed by the electronic device The target window of the process ID, including:
    响应于所述第一操作,所述电子设备基于所述第一音频文件的类型和所述第二音频文件的类型,从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的目标窗口。In response to the first operation, based on the type of the first audio file and the type of the second audio file, the electronic device determines from a window displayed by the electronic device that the process number is the first application The target window of the playback process ID.
  8. 根据权利要求7所述的方法,其特征在于,所述电子设备基于所述第一音频文件的类型和所述第二音频文件的类型,从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的目标窗口,具体包括:The method according to claim 7, wherein, based on the type of the first audio file and the type of the second audio file, the electronic device determines that the process number is The target window of the playback process number of the first application specifically includes:
    在所述第一音频文件的类型为非实时类音频文件,所述第二音频文件的类型为实时类音频文件的情况下,所述电子设备从所述电子设备显示的窗口中确定出进程号为所述第一应用的播放进程号的目标窗口。In the case where the type of the first audio file is a non-real-time audio file and the type of the second audio file is a real-time audio file, the electronic device determines the process number from the window displayed by the electronic device It is the target window of the playing process number of the first application.
  9. 根据权利要求7或8所述的方法,其特征在于,在所述电子设备控制所述目标窗口对应的所述第一应用的播放进程停止播放所述第一音频文件之前,所述方法还包括:The method according to claim 7 or 8, wherein before the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, the method further comprises :
    在所述第一音频文件的类型为实时类音频文件的情况下,所述电子设备输出第二提示信息,所述第二提示信息用于指示用户暂停播放所述第一应用的所述第一音频文件;When the type of the first audio file is a real-time audio file, the electronic device outputs second prompt information, and the second prompt information is used to instruct the user to pause playing the first audio file of the first application. audio files;
    所述电子设备控制所述目标窗口对应的所述第一应用的播放进程停止播放所述第一音频文件,并控制所述第二应用播放所述第二音频文件,具体包括:The electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, and controls the second application to play the second audio file, specifically including:
    所述电子设备接收用户的第二操作,响应于所述第二操作,所述电子设备控制所述目标窗口对应的所述第一应用的播放进程暂停播放所述第一音频文件,并控制所述第二应用播放所述第二音频文件。The electronic device receives the user's second operation, and in response to the second operation, the electronic device controls the playing process of the first application corresponding to the target window to pause playing the first audio file, and controls all The second application plays the second audio file.
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述电子设备控制所述目标窗口对应的所述第一应用的播放进程停止播放所述第一音频文件,具体包括:The method according to any one of claims 1-9, wherein the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, specifically comprising:
    所述电子设备依次遍历所述电子设备中显示的每一个父窗口,确定出进程号为所述第一应用的播放进程号的目标父窗口;The electronic device sequentially traverses each parent window displayed in the electronic device, and determines the target parent window whose process number is the playing process number of the first application;
    所述电子设备控制所述目标父窗口对应的所述第一应用的播放进程停止播放所述第一音频文件;The electronic device controls the playing process of the first application corresponding to the target parent window to stop playing the first audio file;
    或者,or,
    所述电子设备依次遍历所述电子设备中的每一个父窗口,确定出进程号为所述第一应用的播放进程号的目标父窗口;The electronic device sequentially traverses each parent window in the electronic device, and determines a target parent window whose process number is the playback process number of the first application;
    在所述电子设备控制所述目标父窗口对应的所述第一应用的播放进程停止播放所述第一音频文件失败的情况下,所述电子设备依次遍历所述电子设备显示的每一个父窗口关联的每一个子窗口,获取到进程号为所述播放进程号的目标子窗口;When the electronic device fails to control the playing process of the first application corresponding to the target parent window to stop playing the first audio file, the electronic device sequentially traverses each parent window displayed by the electronic device For each associated sub-window, obtain the target sub-window whose process ID is the playback process ID;
    所述电子设备控制所述目标子窗口对应的所述第一应用的播放进程停止播放所述第一音频文件。The electronic device controls the playing process of the first application corresponding to the target sub-window to stop playing the first audio file.
  11. 根据权利要求1-9任一项所述的方法,其特征在于,所述电子设备控制所述目标窗口对应的所述第一应用的播放进程停止播放所述第一音频文件,具体包括:The method according to any one of claims 1-9, wherein the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, specifically comprising:
    所述电子设备依次遍历所述电子设备中显示的每一个父窗口,确定出进程号为所述第一应用的播放进程号的目标父窗口;The electronic device sequentially traverses each parent window displayed in the electronic device, and determines the target parent window whose process number is the playing process number of the first application;
    所述电子设备依次遍历所述电子设备中显示的每一个子窗口,确定出进程号为所述第一应用的播放进程号的目标子窗口;The electronic device sequentially traverses each sub-window displayed in the electronic device, and determines a target sub-window whose process number is the playing process number of the first application;
    所述电子设备控制所述目标父窗口和所述目标子窗口对应的所述第一应用的播放进程停止播放所述第一音频文件。The electronic device controls the playing process of the first application corresponding to the target parent window and the target child window to stop playing the first audio file.
  12. 根据权利要求1-11任一项所述的方法,其特征在于,在所述电子设备开始输出所述第二应用中的所述第二音频文件之后,所述方法还包括:The method according to any one of claims 1-11, wherein after the electronic device starts to output the second audio file in the second application, the method further comprises:
    所述电子设备接收用户的第三操作,所述第三操作用于控制第二应用暂停播放第二音频文件;The electronic device receives a third operation of the user, and the third operation is used to control the second application to pause playing the second audio file;
    响应于所述第三操作,所述电子设备控制所述第二应用暂停播放所述第二音频文件,控制所述第一应用继续播放所述第一音频文件。In response to the third operation, the electronic device controls the second application to pause playing the second audio file, and controls the first application to continue playing the first audio file.
  13. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器、一个或多个存储器;所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行上述权利要求1-12中任一项所述的方法。An electronic device, characterized in that the electronic device includes: one or more processors, one or more memories; the one or more memories are coupled to the one or more processors, and the one or more A plurality of memories for storing computer program codes, the computer program codes comprising computer instructions, the one or more processors invoke the computer instructions to cause the electronic device to perform the electronic device described in any one of the preceding claims 1-12. described method.
  14. 一种计算机可读存储介质,用于存储计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行上述权利要求1-12中任一项所述的方法。A computer-readable storage medium for storing computer instructions, when the computer instructions are run on an electronic device, the electronic device is made to execute the method described in any one of claims 1-12 above.
  15. 一种计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行上述权利要求1-12中任一项所述的方法。A computer program product, characterized in that, when the computer program product is run on an electronic device, the electronic device is made to execute the method described in any one of claims 1-12.
PCT/CN2022/140714 2021-12-24 2022-12-21 Audio playback method and related apparatus WO2023116768A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111605105.6 2021-12-24
CN202111605105.6A CN116339672A (en) 2021-12-24 2021-12-24 Audio playing method and related device

Publications (1)

Publication Number Publication Date
WO2023116768A1 true WO2023116768A1 (en) 2023-06-29

Family

ID=86890288

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/140714 WO2023116768A1 (en) 2021-12-24 2022-12-21 Audio playback method and related apparatus

Country Status (2)

Country Link
CN (1) CN116339672A (en)
WO (1) WO2023116768A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117294509A (en) * 2023-10-16 2023-12-26 广东省中山市质量技术监督标准与编码所 Method, system, equipment and medium for identity verification based on dynamic information

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364188A (en) * 2008-09-12 2009-02-11 青岛海信移动通信技术股份有限公司 Mobile terminal and multimedia playing control method thereof
CN110851106A (en) * 2019-10-31 2020-02-28 维沃移动通信有限公司 Audio output method and electronic equipment
CN111694536A (en) * 2020-05-27 2020-09-22 维沃移动通信有限公司 Audio control method, electronic device and computer-readable storage medium
US20200326907A1 (en) * 2019-04-09 2020-10-15 Hisense Visual Technology Co., Ltd. Method for outputting audio data of applications and display device
CN112559044A (en) * 2020-12-23 2021-03-26 Oppo广东移动通信有限公司 Play switching method and device and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364188A (en) * 2008-09-12 2009-02-11 青岛海信移动通信技术股份有限公司 Mobile terminal and multimedia playing control method thereof
US20200326907A1 (en) * 2019-04-09 2020-10-15 Hisense Visual Technology Co., Ltd. Method for outputting audio data of applications and display device
CN110851106A (en) * 2019-10-31 2020-02-28 维沃移动通信有限公司 Audio output method and electronic equipment
CN111694536A (en) * 2020-05-27 2020-09-22 维沃移动通信有限公司 Audio control method, electronic device and computer-readable storage medium
CN112559044A (en) * 2020-12-23 2021-03-26 Oppo广东移动通信有限公司 Play switching method and device and computer readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117294509A (en) * 2023-10-16 2023-12-26 广东省中山市质量技术监督标准与编码所 Method, system, equipment and medium for identity verification based on dynamic information

Also Published As

Publication number Publication date
CN116339672A (en) 2023-06-27

Similar Documents

Publication Publication Date Title
US11144371B2 (en) Digital assistant extensibility to third party applications
US20210398534A1 (en) Digital assistant voice input integration
US11985374B2 (en) Method of controlling the sharing of videos and electronic device adapted thereto
KR101260770B1 (en) Mobile device and method for controlling play of contents in mobile device
US9378467B1 (en) User interaction pattern extraction for device personalization
US20240192986A1 (en) Application handoff method and apparatus
CN108027706A (en) A kind of application interface display methods and terminal device
US10798153B2 (en) Terminal apparatus and server and method of controlling the same
WO2023130991A1 (en) Collaborative calling method and apparatus, device, storage medium, and program product
US20200174741A1 (en) Audio Playing Method and Electronic Device
WO2018227495A1 (en) Electronic device and processing method therefor
US12015733B2 (en) Do-not-disturb method and terminal
WO2023088459A1 (en) Device collaboration method and related apparatus
WO2023116768A1 (en) Audio playback method and related apparatus
WO2023184825A1 (en) Video recording control method of electronic device, electronic device, and readable medium
WO2024045801A1 (en) Method for screenshotting, and electronic device, medium and program product
JP2023547821A (en) Control method and device, and electronic device
CN117714588A (en) Clamping suppression method and electronic equipment
WO2022188683A1 (en) Flexibly authorized access control method, and related apparatus and system
WO2022052928A1 (en) Application access method and related apparatus
CN112114736A (en) Operation control method and device, electronic equipment and storage medium
WO2023030196A1 (en) Device interaction method, electronic device and system
CN115706737A (en) Push message synchronization method, electronic equipment and system
CN118051289A (en) Page broadcasting mode switching method, electronic equipment and readable medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22910080

Country of ref document: EP

Kind code of ref document: A1