CN116339672A - Audio playing method and related device - Google Patents

Audio playing method and related device Download PDF

Info

Publication number
CN116339672A
CN116339672A CN202111605105.6A CN202111605105A CN116339672A CN 116339672 A CN116339672 A CN 116339672A CN 202111605105 A CN202111605105 A CN 202111605105A CN 116339672 A CN116339672 A CN 116339672A
Authority
CN
China
Prior art keywords
application
playing
audio
electronic device
window
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111605105.6A
Other languages
Chinese (zh)
Inventor
宋孟
李洪江
庾能国
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202111605105.6A priority Critical patent/CN116339672A/en
Priority to PCT/CN2022/140714 priority patent/WO2023116768A1/en
Publication of CN116339672A publication Critical patent/CN116339672A/en
Pending legal-status Critical Current

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

Abstract

The application provides an audio playing method and a related device. The method comprises the following steps: when the electronic equipment monitors that the audio outputs in two different applications are in the same moment, the electronic equipment determines which application to pause playing audio according to the preset priority, playing sequence, audio type and other factors. And then, the electronic equipment determines a target window for realizing the playing logic from windows displayed by the application needing to pause playing the audio. Finally, the electronic device controls the application to pause playing the audio based on the playing process corresponding to the target window, and controls the other application to start playing the audio. Therefore, the electronic equipment is controlled to play only one path of audio at the same time, and the user experience is improved.

Description

Audio playing method and related device
Technical Field
The application relates to the technical field of audio processing, in particular to an audio playing method and a related device.
Background
Currently, many electronic devices (such as a personal computer) can smoothly play audio files in one audio application when only one application is running, but when a plurality of different types of audio applications are running together, the plurality of different types of applications can normally play, but the plurality of different types of applications can simultaneously output different audio files, and interference can be generated between the different types of applications, so that a user is more confused.
Therefore, how to avoid confusion caused by mixing of multiple audio outputs at the same time is a problem to be solved.
Disclosure of Invention
The audio playing method and the related device provided by the application realize that only one audio file is output at the same time, avoid confusion caused by mixing of multiple paths of audio output at the same time, and improve user experience.
In a first aspect, the present application provides an audio playing method, including: the electronic equipment 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 equipment; the electronic equipment receives a first operation of a user, wherein the first operation is used for controlling a second application to play a second audio file; responding to the first operation, and determining a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment; the electronic equipment controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file.
The window displayed by the electronic device comprises 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 of the electronic device display may include a plurality of child windows associated with each parent window of the electronic device display may also include a plurality of child windows.
Alternatively, the electronic device may determine that it is the first application to pause the playback based on the playback order. For example, 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 pauses playing.
Optionally, the electronic device may determine that the first application is paused based on a preset application priority. Illustratively, the electronic device determines that it is the first application that is paused because of the priority of the second application and the priority of the first application.
Alternatively, the electronic device may determine that the first application is paused based on the type of audio file played by the application.
Optionally, the electronic device may determine that the first application is paused based on the preset application priority and the type of the audio file to be played.
By the audio playing method provided by the first aspect, the fact that only one audio file is output at the same time is achieved, confusion caused by mixing of multiple paths of audio output at the same time is avoided, and user experience is improved.
With reference to the first aspect, in one possible implementation manner, the electronic device controls a playing process of a first application corresponding to the target window to pause playing of the first audio file, and specifically includes: the electronic equipment acquires the identification of the target window and simulates a virtual space key value; the electronic equipment sends the identification of the target window and the virtual space key value to a playing process of the first application; the electronic equipment controls the first application to pause playing the first audio file based on the identification of the target window and the virtual space key value through the playing process of the first application corresponding to the target window. Thus, the electronic device simulates a virtual space key value, and the first application can be automatically controlled to pause playing the first audio file without operating a space key on the keyboard by a user to obtain the space key value.
With reference to the first aspect, in one possible implementation manner, in response to a first operation, determining, by the electronic device, from windows displayed by the electronic device, a target window with a process number being a play process number of the first application, where the target window specifically includes: and responding to the first operation, and determining the target window with the process number being the playing process number of the first application from the windows displayed by the electronic equipment 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 playing audio based on the preset application priority.
With reference to the first aspect, in one possible implementation manner, the determining, by the electronic device, from windows displayed by the electronic device, a target window with a process number being a play process number of the first application based on the priority of the first application and the priority of the second application specifically includes: and under the condition that the priority of the first application is lower than that of the second application, the electronic equipment determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment.
With reference to the first aspect, in one possible implementation manner, in a case where 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 second audio file in the second application. Optionally, in one implementation, in a case where the priority of the first application is higher than the priority of the second application, after the electronic device receives the first operation for controlling the second application to play the second audio file, the electronic device may play the second audio file in the second application first, that is, play the first audio file and the second audio file simultaneously; and then pause the second audio file in a manner similar to the pause of the first audio file described in the embodiments of the present application. That is, traversing the target window to the second application and then sending the simulated space key value causes the second application to pause playing the second audio file. So that the electronic device continues to play the first audio file without playing the second audio file.
With reference to the first aspect, in one possible implementation manner, the method further includes: and under the condition that the priority of the first application is the same as that of the second application, the electronic equipment outputs first prompt information, and the first prompt information is used for prompting a user to pause playing of the first audio file in the first application before playing of the second audio file in the second application. 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 one possible implementation manner, in response to a first operation, determining, by the electronic device, from windows displayed by the electronic device, a target window with a process number being a play process number of the first application, where the target window specifically includes: and responding to the first operation, and determining the target window with the process number being the playing process number of the first application from the windows displayed by the electronic equipment based on the type of the first audio file and the type of the second audio file. Thus, the electronic device can 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 one possible implementation manner, the electronic device may further determine, from the windows displayed by the electronic device, a target window with a process number that is a playing process number of the first application, 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. Thus, the electronic device can automatically control the application to pause playing of the 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 one possible implementation manner, the determining, by the electronic device, from windows displayed by the electronic device, a target window with a process number being a playing process number of the first application based on the type of the first audio file and the type of the second audio file specifically includes: and under the condition that the type of the first audio file is a non-real-time type audio file and the type of the second audio file is a real-time type audio file, the electronic equipment determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment. That is, the real-time class audio files have the highest priority.
With reference to the first aspect, in one 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: outputting second prompt information by the electronic equipment under the condition that the type of the first audio file is a real-time audio file, wherein the second prompt information is used for indicating a 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, and controls the second application to play the second audio file, and the method specifically comprises the following steps: the electronic equipment receives a second operation of the user, responds to the second operation, controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file. Therefore, the priority of the real-time audio files is highest, so that the electronic equipment can be prevented from switching the real-time audio files into the non-real-time audio files, and the user experience is prevented from being influenced.
With reference to the first aspect, in one possible implementation manner, the electronic device controls a playing process of a first application corresponding to the target window to stop playing the first audio file, and specifically includes: the electronic equipment sequentially traverses each parent window displayed in the electronic equipment, and a target parent window with a process number being a playing process number of the first application is determined; the electronic equipment controls the playing process of the first application corresponding to the target father window to stop playing the first audio file; or the electronic equipment sequentially traverses each parent window in the electronic equipment to determine a target parent window with a process number of a playing process number of the first application; under the condition that the electronic equipment fails to control the playing process of the first application corresponding to the target father window to stop playing the first audio file, the electronic equipment sequentially traverses each child window associated with each father window displayed by the electronic equipment to obtain a target child window with a process number of playing process number, or sequentially traverses each child window associated with the target father window displayed by the electronic equipment to obtain a target child window with a process number of playing process number; and the electronic equipment controls the playing process of the first application corresponding to the target sub-window to stop playing the first audio file. Therefore, the electronic device firstly judges whether the target parent window can realize the pause of playing the audio, if so, the target child window does not need to be traversed, and the time for the electronic device to search the target child window is saved. If not, the electronic device traverses the target sub-window again.
With reference to the first aspect, in one possible implementation manner, the electronic device controls a playing process of a first application corresponding to the target window to stop playing the first audio file, and specifically includes: the electronic equipment sequentially traverses each parent window displayed in the electronic equipment, and a target parent window with a process number being a playing process number of the first application is determined; the electronic equipment sequentially traverses each sub-window displayed in the electronic equipment to determine a target sub-window with a process number of the playing process number of the first application, or sequentially traverses each sub-window associated with a target parent window displayed by the electronic equipment to determine a target sub-window with a process number of the playing process number of the first application; and the electronic equipment 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 for realizing the playing logic is either the target child window or the target parent window, and the electronic device directly acquires the target parent window and the target child window, so that the control application can realize approval of playing the audio.
With reference to the first aspect, in one possible implementation manner, after the electronic device starts outputting the second audio file in the second application, the method further includes: the electronic equipment receives a third operation of a user, wherein the third operation is used for controlling 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. Therefore, the electronic equipment can control the application which pauses the audio playing due to the system equipment instead of the application which pauses the audio playing due to the active triggering operation of the user to automatically start the audio playing again, so that the user operation is saved.
With reference to the first aspect, in one possible implementation manner, the electronic device receives a fourth operation of a user, where 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 second application to continue to pause playing the second audio file. Therefore, the electronic equipment cannot control the application which pauses the audio playing due to the active triggering operation of the user to automatically start the audio playing again, and the conflict with the wish of the user is avoided.
In a second aspect, an embodiment of the present application provides an electronic device, including: one or more processors, one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories for storing computer program code comprising computer instructions that the one or more processors call to cause the electronic device to perform one of the audio playback methods provided in the first aspect.
In a third aspect, embodiments of the present application provide an electronic device, a computer readable storage medium storing computer instructions that, when executed on the electronic device, cause the electronic device to provide an audio playing method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a computer program product, which when run on an electronic device, causes the electronic device to provide an audio playing method according to the first aspect.
With reference to the advantages of the first aspect, embodiments of the present application are not repeated herein.
Drawings
Fig. 1A-1E are schematic diagrams illustrating a group of electronic devices 100 playing multiple audio channels simultaneously according to an embodiment of the present application;
fig. 2 is a timing chart of the electronic device 100 according to the embodiment of the present application for simultaneously playing multiple channels of audio;
fig. 3 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application;
fig. 4 is a schematic diagram of a functional module of how the electronic device 100 controls that only one audio can be played at the same time;
fig. 5 is a schematic diagram of a functional module 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;
FIGS. 6A-6B are schematic diagrams of a parent window and child window provided in an embodiment of the present application;
FIG. 7A is a schematic diagram showing how the cross-process management module 430 controls the audio class application 1 to stop playing audio based on the process number I and the pause instruction according to the embodiment of the present application;
FIG. 7B is a schematic diagram of how another cross-process management module 430 according to an embodiment of the present application controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction;
FIG. 7C is a schematic diagram of how a further jump Cheng Guanli module 430 according to an embodiment of the present application controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction;
fig. 7D is a schematic diagram illustrating how still another step-in Cheng Guanli module 430 according to an embodiment of the present application controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction;
fig. 8A-8B are schematic diagrams of how the electronic device 100 outputs audio when a group of low-priority audio applications is switched to a high-priority audio application according to an embodiment of the present application;
fig. 9A-9C are schematic diagrams of how the electronic device 100 outputs audio when a group of high-priority audio applications is switched to low-priority audio applications according to the embodiments of the present application;
FIGS. 10A-10C are diagrams illustrating how the electronic device 100 outputs audio when switching a set of audio class applications with the same priority provided in embodiments of the present application;
FIG. 11 is a timing chart of another embodiment of the present application for simultaneously playing multiple audio channels;
fig. 12 is a flowchart of an audio playing method according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and thoroughly described below with reference to the accompanying drawings. Wherein, in the description of the embodiments of the present application, "/" means or is meant unless otherwise indicated, for example, a/B may represent a or B; the text "and/or" is merely an association relation describing the associated object, and indicates that three relations may exist, for example, a and/or B may indicate: the three cases where a exists alone, a and B exist together, and B exists alone, and in addition, in the description of the embodiments of the present application, "plural" means two or more than two.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature, and in the description of embodiments of the present application, unless otherwise indicated, the meaning of "a plurality" is two or more.
The term "User Interface (UI)" in the following embodiments of the present application is a media interface for interaction and information exchange between an application program or an operating system and a user, which enables conversion between an internal form of information and an acceptable form of the user. The user interface is a source code written in a specific computer language such as java, extensible markup language (extensible markup language, XML) and the like, and the interface source code is analyzed and rendered on the electronic equipment to finally be presented as content which can be identified by a user. A commonly used presentation form of the user interface is a graphical user interface (graphic user interface, GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It may be a visual interface element of text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc., displayed in a display of the electronic device.
At present, for carrying Windows @ Or other operating systems, such as personal computers (personal computer, PCs), because the operating system on the electronic device 100 does not have the multi-channel audio playing control strategy, when the electronic device 100 simultaneously plays multi-channel audio, the electronic device 100 simultaneously plays the multi-channel audio, and the audio effect heard by the user is a mixing effect.
1A-1E illustrate schematic diagrams of the electronic device 100 playing multiple audio channels simultaneously.
Fig. 1A illustrates a desktop of an electronic device 100. The desktop may include icons, notification bars, etc. for one or more applications. The icons of the one or more application programs include, but are not limited to, an icon of the computer application, an icon of the recycle bin application, an icon of the instant messaging application, an icon of the music application, and an icon of the video application. The talk bars may include time indicators, volume indicators, search areas, and the like.
As shown in fig. 1A, the electronic device 100 receives an input operation (e.g., a double click operation) for an icon of a music application, and the electronic device 100 displays a user interface 1001 of the music application as shown in fig. 1B on a desktop. The user interface 1001 may be understood as a main user interface of a music application. The user interface 1001 includes a theme zone with music application, a recommended song zone, and a music play zone. Wherein the subject area includes singers, ranks, songs, stations, and the like. The recommended song area treasury has a plurality of recommended songs, such as "Song 1-artist 1", "Song 2-artist 2", and "Song 3-artist 3". The music playing area includes the name of the song "song a", pause/play control 1002, last song control, next song control, volume adjustment progress bar, and the like. As can be seen from fig. 1A, the song to be played "song a" in the music playing area has been paused.
As shown in fig. 1B, the electronic device 100 receives an input operation (e.g., a click operation) for a pause/play control 1002 in the music play area, and as shown in fig. 1C, the electronic device 100 starts playing the song "song a". In this way, the user may hear songs played by electronic device 100.
As shown in fig. 1D, during the process of playing music by the electronic device 100, the electronic device 100 receives a voice call request sent by another electronic device, and the electronic device 100 displays a prompt bar 1003 on the desktop. The prompt field 1003 includes prompt information "lie invite you to make a voice call", and the prompt field 1003 further includes a receiving control 1004 and a rejecting control 1005. As shown in fig. 1D, the electronic device 100 receives an input operation (e.g., a single click) by the user for the receiving control 1004 in the prompt field 1003, and the electronic device 100 establishes a voice call connection with the electronic device used by the contact "lie".
As shown in fig. 1E, after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "anywhere," the electronic device 100 displays a voice call user interface 1006 on the desktop. The user interface 1006 may display a call duration (e.g., 8 seconds in duration), the user interface 1006 further including a mute control, a reject control, and a volume control, among others. As shown in fig. 1E, after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "lie", the electronic device 100 does not pause the music being played by the music application, and the electronic device 100 continues to play the song "song a". Meanwhile, the electronic device 100 may play the voice of the contact "anywhere in the world", and the voice content may be "wait for two minutes slightly before waiting for other people to come online".
To more clearly illustrate that the electronic device 100 is playing multiple audio simultaneously, fig. 2 illustrates a timing diagram of the electronic device 100 playing multiple audio simultaneously.
In fig. 2, at 0ms, the electronic device 100 receives an operation of the user to start playing a song in the music application, and after a period of time (for example, 360 ms), the electronic device 100 receives a voice call sent by the electronic device to which the user operation has accessed the use of the contact "anywhere". As shown in fig. 2, after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "anywhere," the electronic device 100 may play the voice of the contact "anywhere. For example, if the call duration is 480ms, the electronic device 100 continues to play songs in the music application while the electronic device 100 plays the voice of the contact "anywhere from 0ms to 480 ms. That is, the electronic device 100 plays a song between 360ms and 840ms in the music application and a real-time voice between 0ms and 480ms in the conversation application in an overlapping manner, and the user hears the mixing effect during the period. After the real-time voice in the real-time voice/real-time video class has lasted 480ms, the voice call ends and the electronic device 100 pauses to play the real-time voice in the call application. The electronic device 100 continues to play songs in the music application.
From the above analysis, when the electronic device 100 plays multiple audio channels, the electronic device 100 plays the multiple audio channels in an overlapping manner, so that the user hears the audio mixing effect, and the user experience is poor. During the process of listening to music or watching a movie, the user accesses a voice call through the electronic device 100. During the voice communication, the user continuously plays music or movies, so that the user misses the audible music or the wonderful movie, and the user experience is poor.
Based on this, the embodiment of the application provides an audio playing method, which can be applied to the installation of Windows @ Or other operating system, electronic device 100, method packageThe method comprises the following steps: the electronic equipment 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 equipment; the electronic equipment receives a first operation of a user, wherein the first operation is used for controlling a second application to play a second audio file; responding to the first operation, and determining a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment; the electronic equipment controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file. In this way, the electronic device 100 can play only one audio at the same time without active triggering of the user, and user experience is improved.
How the electronic device 100 controls only one audio output at the same time will be described in detail in the following embodiments, which are not described herein.
Fig. 3 exemplarily shows a schematic structural diagram of the electronic device 100.
The electronic device 100 may be a Windows-loaded device @ Or other operating system, such as personal computers (personal computer), notebook computers, handheld computers, tablet computers, desktop computers, etc., as well as non-portable terminal devices such as Laptop computers (Laptop), ultra-mobile personal computers (ultra-mobile personal computer, UMPC) with touch sensitive surfaces or touch panels. The embodiment of the present application does not particularly 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 170, a power switch 180, a motor 190, and keys 1000.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The internal memory 120 may include one or more random access memories (random access memory, RAM) and one or more non-volatile memories (NVM).
The random access memory may include a static random-access memory (SRAM), a dynamic random-access memory (dynamic random access memory, DRAM), a synchronous dynamic random-access memory (synchronous dynamic random access memory, SDRAM), a double data rate synchronous dynamic random-access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as fifth generation DDR SDRAM is commonly referred to as DDR5 SDRAM), etc.; the nonvolatile memory may include a disk storage device, a flash memory (flash memory).
The FLASH memory may include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. divided according to an operation principle, may include single-level memory cells (SLC), multi-level memory cells (MLC), triple-level memory cells (TLC), quad-level memory cells (QLC), etc. divided according to a storage specification, may include universal FLASH memory (english: universal FLASH storage, UFS), embedded multimedia memory cards (embedded multi media Card, eMMC), etc. divided according to a storage specification.
The random access memory may be read directly from and written to by the processor 110, may be used to store executable programs (e.g., machine instructions) for an operating system or other on-the-fly programs, may also be used to store data for users and applications, and the like.
The nonvolatile memory may store executable programs, store data of users and applications, and the like, and may 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 may be implemented by the antenna 130A, the wireless communication module 130, a modem processor, a baseband processor, and the like.
The antenna 130A may be used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas.
The wireless communication module 130 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc. applied on the electronic device 100. 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, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 130 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 130A.
The 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 for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device or displays images or video through the display 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.
Among them, the acceleration sensor 1501 may be used to detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
The temperature sensor 1502 is used to detect temperature. In some embodiments, the electronic device 100 utilizes the temperature detected by the temperature sensor 1502 to execute a temperature processing strategy. For example, when the temperature reported by temperature sensor 1502 exceeds a threshold, electronic device 100 performs a reduction in performance of a processor located in proximity to temperature sensor 1502 in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery to avoid abnormal shutdown caused by low temperatures.
The touch sensor 1503 is also referred to as a "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, which is also called a "touch screen". The touch sensor 1503 is for detecting a touch operation acting thereon or therearound. The touch sensor 1503 may communicate the detected touch operation to an application processor to determine the type of touch event. Visual output related to touch operations may be provided through the display 170. In other embodiments, the touch sensor 1503 may also be disposed on the surface of the electronic device 100 at a different location than the display 170.
The pressure sensor 1504 is used to sense a pressure signal, which can be converted into an electrical signal. In some embodiments, the pressure sensor 1504 may be provided to the display 170. The pressure sensor 1504 is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising 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 strength of the pressure from the change in capacitance. When a touch operation is applied to the display 170, the electronic apparatus 100 detects the touch operation intensity from the pressure sensor 1504. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 1504. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The audio module 160 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a 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 disposed in the processor 110, or some functional modules of the audio module 160 may be disposed in the processor 110.
A speaker 1601, also referred to as a "horn," is used to convert the audio electrical signal into a sound signal. The electronic device 100 may listen to music through the speaker 1601.
A microphone 1602, also called a "microphone," is used to convert sound signals into electrical signals. When transmitting voice information, a user may input a sound signal to the microphone 1602. The electronic device 100 may be provided with at least one microphone 1602. In other embodiments, the electronic device 100 may be provided with two microphones 1602, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 1602 to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The electronic device 100 implements display functions through a GPU, a display screen 170, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 170 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display 170 is used to display images, videos, and the like. The display 170 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro led, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 170, N being a positive integer greater than 1.
The power switch 180 may be used to control the power supplied by the power source to the electronic device 100.
The motor 190 may generate a vibration alert. The motor 190 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., audio playback, etc.) may correspond to different vibration feedback effects. The motor 190 may also correspond to different vibration feedback effects by touch operations applied to different areas of the display 170. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch shock feedback effect may also support customization.
The keys 1000 include a power on key, a volume key, etc. The key 1000 may be a mechanical key. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
It should be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
As shown in fig. 4, fig. 4 is a schematic functional block diagram illustrating how the electronic device 100 controls that only one audio can be played at the same time.
The electronic device 100 includes an audio notification management module (audio notification managermodule) 410, a process management module (process managermodule) 420, and a cross-process management module (remote control module) 430.
The audio notification management module 410 is configured to monitor an operation state of an audio application in the electronic device 100, where the operation state of the audio application may be divided into an on state and an off state, and the on state may be divided into a play state and a pause state. When the audio class application is in an open state, the electronic device 100 has created a process of the audio class application and configured a corresponding process number. When the audio class application is in an unopened state, the process of the unopened audio class application is not created. The play state refers to the electronic device 100 being playing an audio file in a certain audio class application. The pause state refers to that a certain audio class application is started, but the electronic device 100 does not play the audio file in the certain audio class application, or the electronic device 100 plays the audio file in the certain audio class application before, but the current electronic device 100 pauses to play the audio file in the certain audio class application.
The audio notification management module 410 is configured to send the process number of the audio class application and the on state of the audio class application to the process management module 420. When the open state of the same audio class application changes, for example, the open state of the audio class application changes from the play state to the pause state, or the open state of the audio class application changes from the pause state to the play state, the audio notification management module 410 is further configured to send the changed open state of the audio class application to the process management module 420 again.
Illustratively, the electronic device 100 receives a 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 a process number of the music application 1, and the electronic device 100 sends the open state (pause state) of the music application 1 and the process number of the music application 1 to the process management module 420.
For example, after the electronic device 100 opens the music application 1, the electronic device 100 receives a user operation to open the video application 1 and play the video file in the video application 1, the electronic device 100 creates a process number for playing the video application 1, and the electronic device 100 sends the open state (play state) of the video application 1 and the process number of the video application 1 to the process management module 420.
If at some point, the electronic device 100 receives the user operation to pause playing of the video file in the video application 1, the on state of the video application 1 is changed from the play state to the pause state. Since the on state of the video application 1 also changes, the audio notification management module 410 again transmits the on state (suspended state) of the video application 1 and the process number of the video application 1 to the process management module 420.
The process management module 420 is used for controlling a plurality of audio class applications to play audio at the same time, and only one audio class application can play audio. Specifically, the process management module 420 is configured to receive the open state of the audio class application and the process number of the audio class application sent by the audio notification management module 410. And determining which audio application needs to be managed and controlled based on the starting state of the audio application and a preset priority strategy.
Optionally, the process management module 420 may also determine which audio class application needs to be managed based on the whitelist policy and a preset priority policy. The white list policy is a preset set of applications that need to be managed. Only if an application is within the white list will the process management module 420 manage the process of the application. If the application is not in the white list, the process management module 420 does not manage the process of the application. In this way, the process management module 420 may be prevented from managing all applications within the electronic device 100, which may result in an excessive load on the process management module 420.
Alternatively, the process management module 420 may manage applications within the whitelist based on the frequency of use of the user. For example, if the user does not use an application for a certain period of time (e.g., a month), then the process management module 420 may remove the application from the whitelist. When the process management module 420 removes the certain application from the white list, the process management module 420 monitors that the number of times the certain application is used by the user for a certain period of time (for example, within a week) is greater than a preset value, and then the process management module 420 may add the certain application to the white list again.
If the process management module 420 monitors that two audio class applications are in a playing state at the same time, for example, the audio class application 1 and the audio class application 2 are in a playing state, the process management module 420 determines one audio class application with a lower priority from the two audio class applications based on a preset priority policy, for example, the priority of the audio class application 1 is lower than the priority of the audio class application 2, and the process management module 420 obtains the process number one of the audio class application 1 and sends the process number to the cross-over Cheng Guanli module 430.
Illustratively, the audio class application 1 may be a music application 1 and the audio class application 2 may be a video application 1. At the same time, if the process management module 420 monitors that the open states of the music application 1 and the video application 1 are both in the play state, the process management module 420 determines, based on the preset priority policy, one audio application with a lower priority from the music application 1 and the video application 1, for example, if the process management module 420 determines that the priority of the music application 1 is lower, the process management module 420 obtains the process number of the music application 1 and sends the process number and the pause instruction of the music application 1 to the step-in Cheng Guanli module 430.
The cross-process management module 430 is configured to receive the process number one and the pause instruction of the audio class application 1 sent by the process management module 420, and control the audio class application 1 to stop playing audio based on the process number one and the pause instruction of the audio class application 1. Therefore, by controlling the audio application, only one path of audio can be played at the same time. Specifically, how the span Cheng Guanli module 430 controls the audio class application 1 to stop playing audio based on the process number one of the audio class application 1 will be described in detail in the following embodiments, which are not described herein.
Illustratively, the cross-over Cheng Guanli module 430 receives the process number of the music application 1 sent by the process management module 420, and the cross-over process management module 430 controls 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 achieved that the electronic device 100 can only play audio in one audio class application at the same time.
It should be noted that one or more of the above functional modules may be optionally combined to realize that the electronic device 100 may only play audio in one audio class application at a time.
As shown in fig. 5, fig. 5 is a functional block diagram schematically illustrating how the cross-process management module 430 controls the audio class application 1 to continue playing music after controlling the audio class application 1 to stop playing music.
The functional modules in fig. 5 are similar to the functional modules in fig. 4, and the embodiments of the present application are not repeated here.
In the embodiment shown in fig. 4, when the process management module 420 determines that the audio class application 1 is controlled to pause playing audio based on the playing priority policy, the process management module 420 further needs to mark the first process number of the audio class application 1, so that the process management module 420 records that the audio class application 1 pauses playing audio due to the playing priority policy, and the user does not actively trigger the audio class application 1 to pause playing audio. Alternatively, the process management module 420 may store the process number of the audio class application 1 locally, so when the process management module 420 controls the audio class application 1 to change from the state of suspending playing audio to the state of continuing playing audio, it may find out whether the process number one of the audio class application 1 that needs to continue playing audio can be found from the locally stored process numbers of the audio class application. If found, the process management module 420 controls the audio class application 1 to pause playing audio based on the playing policy before, instead of the user actively triggering to cause the audio class application 1 to pause playing audio, in which case, the process management module 420 sends the process number one and the playing instruction of the audio class application 1 to the cross-over Cheng Guanli module 430, and the cross-over Cheng Guanli module 430 controls the cross-over Cheng Guanli module 430 to continue playing audio after receiving the process number one and the playing instruction of the audio class application 1 sent by the process management module 420. If not, it is indicated that the process management module 420 has not previously controlled the audio class application 1 to pause playing of audio based on the playing policy, but the audio class application 1 is paused to play of audio due to active triggering of the user, in which case, the process management module 420 will not send the process number one and the playing instruction of the audio class application 1 to the span Cheng Guanli module 430, so as to avoid a conflict with the user's desire to actively trigger the audio class application 1 to pause playing of audio.
It should be noted that, the process management module 420 may also mark the first process number of the audio class application 1 based on other manners, which is not limited to the manner in which the first process number of the audio class application 1 is kept locally, but the embodiment of the present application is not limited thereto.
Specifically, after the cross-process management module 430 controls the audio class application 1 to stop playing audio, the audio notification management module 410 changes the obtained on state of the audio class application 1 from the playing state to the pause state, and then the audio notification management module 410 sends the on state (i.e., the pause state) of the audio class application 1 and the process number of the audio class application 1 to the process management module 420. Then the process management module 420 monitors the on state of audio class application 1 as a pause state and the on state of audio class application 2 as a play state. I.e., the process management module 420 monitors only one audio output.
After a section, it is assumed that the on state of the audio class application 2 is changed from the play state to the pause state. The audio notification management module 410 changes the acquired on state of the audio class application 2 from the play state to the pause state, and the audio notification management module 410 transmits the on state (i.e., the pause state) of the audio class application 2 and the process number of the audio class application 2 to the process management module 420. Then the process management module 420 monitors the on state of audio class application 1 as a suspended state and the on state of audio class application 2 as a suspended state.
At this time, assuming that the process management module 420 monitors that the audio class application 2 is changed from the play state to the pause state, the process management module 420 determines the audio class application to be continuously played based on the preset priority policy, the process number of the audio class application stored in the process management module 420, and the on states of other audio class applications except for the audio class application 2.
In some embodiments, if, except for the audio class application 2, the process management module 420 only monitors that the audio class application 1 is in the pause state, and the process number of the audio class application stored in the process management module 420 includes the process number one of the audio class application 1, 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 sends the process number one of the audio class application 1 and a play instruction to the skip Cheng Guanli module 430.
The cross-process management module 430, upon receiving the process number one and the play instruction of the audio class application 1 sent by the process management module 420, the cross-process Cheng Guanli module 430 controls the audio class application 1 to continue playing the audio based on the process number one and the play instruction.
In other embodiments, if the process management module 420 monitors that the audio class application 1 is in the pause state except for the audio class application 2, but the process number of the audio class application stored in the process management module 420 does not include the process number one of the audio class application 1, which means that the process management module 420 controls the audio class application 1 to pause playing audio based on the playing priority policy before, and may be actively triggered by the user to cause the audio class application 1 to pause playing audio, so the process management module 420 determines that the audio class application 1 is not controlled to continue playing audio, so that the process management module 420 does not conflict with the user's intention to actively trigger the audio class application 1 to pause playing audio, and also does not send the process number one and the playing instruction of the audio class application 1 to the span Cheng Guanli module 430.
The cross-process management module 430, upon receiving the process number one and the play instruction of the audio class application 1 sent by the process management module 420, the cross-process Cheng Guanli module 430 controls the audio class application 1 to continue playing the audio based on the process number one and the play instruction.
In other embodiments, if the process management module 420 monitors that the audio class application 1 and the audio class application 3 are in a suspended state except for the audio class application 2, but the priority of the audio class application 1 is higher than that of the audio class application 3, and the process number of the audio class application stored in the process management module 420 includes the process number one of the audio class application 1, 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 sends the process number one of the audio class application 1 and a play instruction to the span Cheng Guanli module 430.
The cross-process management module 430, upon receiving the process number one and the play instruction of the audio class application 3 sent by the process management module 420, the cross-process Cheng Guanli module 430 controls the audio class application 1 to continue playing the audio based on the process number one and the play instruction.
Optionally, if, except for the audio class application 2, the process management module 420 only monitors that both the audio class application 1 and the audio class application 3 are in the pause state, the priority of the audio class application 1 is higher than that of the audio class application 3, but the process number of the audio class application stored by the process management module 420 does not include the process number one of the audio class application 1, but includes the process number three of the audio class application 3, which means that the process management module 420 controls the audio class application 1 to pause playing audio based on the playing priority policy before, and may be that the user actively triggers to cause the audio class application 1 to pause playing audio, but the process management module 420 controls the audio class application 3 to pause playing audio based on the playing priority policy. Therefore, the process management module 420 determines that even if the priority of the audio class application 1 is higher than the priority of the audio class application 3, the process management module 420 does not control the audio class application 1 to continue playing audio, so as to avoid conflict with the user's intention of suspending the audio class application 1 from playing audio by active triggering, but the process management module 420 controls the audio class application 3 to continue playing audio, and the process management module 420 sends the process number three and the playing instruction of the audio class application 3 to the span Cheng Guanli module 430.
The cross-process management module 430, upon receiving the process number three and the play instruction of the audio class application 3 sent by the process management module 420, the cross-process Cheng Guanli module 430 controls the audio class application 3 to continue playing audio based on the process number three and the play instruction.
Here, how the span Cheng Guanli module 430 controls the audio class application to continue playing the audio based on the process number and the playing instruction will be described in detail in the following embodiments, which are not described herein.
It should be noted that, the step-in Cheng Guanli module 430 is generally used for controlling the audio class application of the non-real-time voice call or the video call of the non-real-time class to continue playing the audio after the pause. For an audio class application of a non-real-time voice call or a video call of a non-real-time class, the electronic device 100 essentially buffers, entirely or partially, an audio file to be played by the audio class application of the non-real-time voice call or the video call of the non-real-time class locally, and the cross-process management module 430 may control the audio class application of the non-real-time voice call or the video call of the non-real-time class to continue playing audio based on the buffered entire or partially audio file.
Next, it is described how the cross-process management module 430 controls the audio class application to pause playing audio based on the process number and the play instruction.
First, the concepts of the parent window and child window will be described.
After the application is started, the parent window of the application is established, and after the application is closed, the parent window of the application is not present. Each application has different definitions for parent and child windows, each application corresponding to one or more parent windows, a parent window for carrying child windows, and a parent window may have one or more child windows.
The definition of the parent window and child window is specifically explained below using a music application as an example.
The electronic device 100 opens a music application and displays a user interface 1001 of the music application shown in fig. 1B. After the electronic device 100 opens the music application, the parent window of the music application is already established, but the electronic device 100 does not display the parent window of the music application.
The music application is based on functional modules, dividing the user interface 1001 into several sub-windows. As shown in fig. 6A, for example, an area 601 in a user interface 1001 is a sub-window 1, and the function of the sub-window 1 is to implement a search function, such as searching for songs, singers, music clips (MVs), and the like. The area 602 in the user interface 1001 is sub-window 2, and the function of sub-window 2 is to implement a song presentation function such as singer popularity ranking, popular song leaderboard, personal favorite song, station, etc. The area 603 in the user interface 1001 is a sub-window 3, and the function of the sub-window 3 is to implement a recommendation function, for example, recommending music that the user likes to listen to based on the user's preference, or big data analysis to recommend a currently popular single song or MV. The area 604 in the user interface 1001 is a sub-window 4, and the function of the sub-window 4 is to enable play/pause of music. The sub-window 4 includes play/pause controls, last song control, next song control, volume adjustment control, and the like.
As shown in fig. 6B, fig. 6B shows a schematic diagram of a relationship between a parent window and a plurality of child windows in a music application.
The parent window in the music application is the bearer of all child windows in the music application, and child windows associated with the parent window can include child window 1, child window 2, child window 3, and child window 4. If the electronic device 100 receives the first input operation of the user in the sub-window 1, the electronic device 100 will superimpose and display other user interfaces on the user interface 1001. One or more sub-windows may be included in the other user interface displayed by the electronic device 100, e.g. sub-window 5 and sub-window 6 are included in the other user interface, the sub-window 5 and sub-window 6 each belonging to the sub-window of sub-window 1.
It should be noted that, the parent window and the child window in the application each include a unique window identifier, where the window identifier is used to indicate which parent window or which child window is specifically. The window identifier may include, but is not limited to, information such as a handle of the window, which may be understood as a number of the window, and the index of each window is different. In this way, the electronic device 100 may find the corresponding window based on the handle of the window.
It should be noted that, the definitions of the parent window and the child window of each application are different, and the above explanation in fig. 6A-6B is only for explaining the present application, which is not limited by the embodiment of the present application.
Fig. 7A illustrates a schematic diagram of how the skip Cheng Guanli module 430 controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction.
S701A, the span Cheng Guanli module 430 traverses each parent window in turn, and obtains all parent windows with the process number of process number one as target parent windows.
Alternatively, after acquiring all the parent windows, the cross-process management module 430 may divide all the parent windows into a system parent window and an application class parent window. Because electronic device 100 typically plays audio through an application, cross-process management module 430 may filter out application-class parent windows from among all parent windows.
For example, if the electronic device 100 opens application 1 and application 2, the electronic device 100 plays audio through application 1. The span Cheng Guanli module 430 obtains that all parent windows may include the parent window of application 1, the parent window of application 2, and the system parent window. Because electronic device 100 is typically playing audio through an application, cross-process management module 430 can filter from application 1's parent window, application 2's parent window, and the system's parent window to obtain application 1's parent window and application 2's parent window.
Alternatively, after acquiring all the parent windows, the cross-process management module 430 may divide all the parent windows into a system parent window and an application class parent window. Because the electronic device 100 generally plays audio through the audio application, the cross-process management module 430 may screen all the parent windows to obtain the application parent window, and then screen all the application parent windows to obtain the parent window of the audio application.
For example, if the electronic device 100 opens the application 1 and the application 2, the application 1 is an audio class application, the application 2 is a non-audio class application, and the electronic device 100 plays the audio through the application 1. The span Cheng Guanli module 430 obtains that all parent windows may include the parent window of application 1, the parent window of application 2, and the system parent window. Because electronic device 100 typically plays audio through an audio class application, cross-process management module 430 can filter out 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 is started, the process number of the application is created, the application corresponds to one or more processes, and each process corresponds to a parent window. Thus, an open application may have one parent window or may have multiple parent windows, which is not limited by the embodiments of the present application.
Illustratively, if the same application on electronic device 100 is only opened once, the application has a parent window that corresponds to a process number. If the same application on the electronic device 100 is opened multiple times at the same time, there are multiple parent windows of the application, and the process number of each of the multiple parent windows of the same application is different.
Electronic device 100 may launch an application and then there is at least one parent window for the application. If the electronic device 100 opens two or more applications, 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.
Illustratively, if the electronic device 100 has opened 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-over Cheng Guanli module 430 traverses each parent window in turn, and if the current parent window has a process number of one, the cross-process management module 43 takes the parent window as the target parent window.
Optionally, after the step Cheng Guanli module 430 finds the target parent window, the step Cheng Guanli module 430 may stop traversing other windows, so that the step Cheng Guanli module 430 can save time to find the target parent window.
Alternatively, the cross-process management module 430 may continue to traverse other windows until all the parent windows have been traversed, so that the situation that the cross-process management module 430 leaks to find the target parent window may be avoided.
S702A, the span Cheng Guanli module 430 obtains the identity of the target parent window.
S703A, the stride Cheng Guanli module 430 sends a pause instruction and an identification of the target parent window to the process of process number one.
The cross-process management module 430 obtains the target parent window after obtaining the parent window of process number one. The span Cheng Guanli module 430 obtains the identity of the target parent window and sends a pause instruction and the identity of the target parent window to the process of process number one. Thus, due to the diversity of applications, 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. Thus, the span Cheng Guanli module 430 first sends a pause instruction to the target parent window to determine whether control of the current audio pause play can be achieved.
Alternatively, the pause instruction may be a simulated space key (space key) value. The simulated space key value corresponds to the electronic device 100 receiving a click operation of the space key on the keyboard by the user. In this way, the process management module 420 sends the simulated space key value to the process of the first process number, so that the process of the first process number controls the audio class application 1 to play audio, which is equivalent to simulating that the user manually clicks the space key on the keyboard, and the automatic pause of the audio class application 1 is realized.
S704A, is the cross-process management module 430 determining that the audio class application 1 stops playing audio?
If the cross-process management module 430 determines that the audio class application 1 stops playing audio, the window that indicates that the audio class application 1 implements the play/pause function is the parent window of the audio class application 1, and the process ends.
If the cross-process management module 430 determines that the audio class application 1 does not stop playing audio, it indicates that the window of the audio class application 1 for playing/pausing is not a parent window of the audio class application 1, and the cross-process Cheng Guanli module 430 performs S705.
S705A, the stride Cheng Guanli module 430 traverses all child windows under each parent window in turn, and obtains all child windows with process number one as target child windows.
Since the cross-over Cheng Guanli module 430 cannot know which child window implements the pause/play function, the cross-process management module 430 needs to obtain all child windows with process number one as target child windows.
The cross-over Cheng Guanli module 430 traverses each child window associated under the parent window in turn, and if the process number of the child window associated under the current parent window is process number one, the cross-process management module 43 takes the child window associated under the current parent window as the target child window.
Optionally, after the step-in Cheng Guanli module 430 finds the target child window, the step-in Cheng Guanli module 430 may stop the associated child window under other parent windows, so that the time for the step-in Cheng Guanli module 430 to find the target child window may be saved.
Optionally, the cross-process management module 430 may continue to traverse the associated child windows under other parent windows until all the child windows associated under the parent windows are traversed, so that the situation that the cross-process management module 430 leaks to find the target child window may be avoided.
It should be noted that the number of all child windows under each parent window may be one, or may be two or more.
Illustratively, if the electronic device 100 has opened the music application 1 and the video application 1, there is one parent window of the music application 1 and one parent window of the video application 1 in the electronic device 100. The cross-process management module 430 needs to find all child windows in the parent window of the music application 1 first, and then the cross-process management module 430 finds all child windows in the parent window of the video application 1.
If the span Cheng Guanli module 430 finds all the child windows in the parent window of the music application 1, and obtains the process numbers of all the child windows of the music application 1, when the process numbers of all the child windows of the music application 1 are the process numbers one, all the child windows of the music application 1 are used as target child windows. When the process number of the part of the sub-windows of the music application 1 is one, the part of the sub-windows of the music application 1 are all used as target sub-windows. When none of the process numbers of the partial sub-windows of the music application 1 is the process number one, it is indicated that the sub-windows in the music application 1 do not contain the target sub-window. The cross-process management module 430 continues to find all child windows in the parent window of video application 1.
Alternatively, if the cross-process management module 430 finds all child windows with process number one in the parent window of the music application 1. The cross-process management module 430 also needs to find all child windows in the parent window of the video application 1 and obtain the process numbers of all child windows of the video application 1. When the process number of all the sub-windows of the video application 1 is one, taking all the sub-windows of the video application 1 as target sub-windows. When the process number of the part of the sub-windows of the video application 1 is one, the part of the sub-windows of the video application 1 are all used as target sub-windows.
In this way, until the span Cheng Guanli module 430 finds all child windows with process number one in the parent window.
When the stride Cheng Guanli module 430 first finds a target child window in the child windows of the music application 1, the stride Cheng Guanli module 430 may also continue to find whether the target child window exists in the video application 1 until all child windows in the parent window have been traversed in sequence. In this way, the situation that the cross-process management module 430 leaks to find the target sub-window can be avoided, and the accuracy of realizing audio playing control through the cross-process is improved.
S706A, the stride Cheng Guanli module 430 obtains the identity of the target child window.
Here, the target sub-window may be identified by one or a plurality of target sub-windows.
The identification of the target sub-window may be information such as a handle of the target sub-window. The handle of the target sub-window may be understood as the number of the target sub-window, and the reference number of each target sub-window is 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, the stride Cheng Guanli module 430 sends a pause instruction and an identification of the target sub-window to the process of process number one.
The cross-process management module 430 sends a pause instruction and the identification of the target sub-window to the process of the first process number after acquiring the identification of the target sub-window, and the process of the first process number pauses the playing of the audio by controlling the target sub-window corresponding to the identification of the target sub-window after receiving the pause instruction and the identification of the target sub-window. Thus, the cross-process management module 430 realizes the function of cross-process control audio suspension, and avoids the situation that multiple paths of audio outputs exist at the same time, thereby bringing bad user experience to users.
Fig. 7B illustrates another schematic diagram of how the jumpers Cheng Guanli module 430 controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction.
S701B, the span Cheng Guanli module 430 traverses each parent window in turn, and obtains all parent windows with the process number of process number one as target parent windows.
S702B, the span Cheng Guanli module 430 traverses all child windows under each parent window in sequence, and obtains all child windows with the process number of process number one as target child windows.
S703B, the span Cheng Guanli module 430 obtains the identification of the target parent window and the identification of the target child window.
S704B, the stride Cheng Guanli module 430 sends a pause instruction, an identification of the target parent window, and an identification of the target child window to the process of process number one.
Fig. 7B is different from fig. 7A in that the cross-process management module 430 does not need to perform the determining step of S704A in fig. 7A, because the cross-process management module 430 cannot acquire in advance which parent window or which child window is the window implementing the play/pause function, and the window implementing the play/pause function is either in the parent window or in the child window. Thus, the cross-process management module 430 directly sends a pause instruction to all the target child windows and the target parent windows, so that the audio class application 1 stops playing audio.
Fig. 7C illustrates a schematic diagram of how still another step-in Cheng Guanli module 430 controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction.
S701C, the span Cheng Guanli module 430 traverses each parent window in turn, and obtains all parent windows with the process number of process number one as target parent windows.
S702C, the span Cheng Guanli module 430 obtains the identity of the target parent window.
S703C, the stride Cheng Guanli module 430 sends a pause instruction and an identification of the target parent window to the process of process number one.
S704C, is the cross-process management module 430 determining that the audio class application 1 stops playing audio?
If the cross-process management module 430 determines that the audio class application 1 stops playing audio, the window that indicates that the audio class application 1 implements the play/pause function is the parent window of the audio class application 1, and the process ends.
If the cross-process management module 430 determines that the audio class application 1 does not stop playing audio, it indicates that the window of the audio class application 1 for playing/pausing is not a parent window of the audio class application 1, and the cross-process Cheng Guanli module 430 performs S705C.
S705C, the stride Cheng Guanli module 430 traverses each child window associated with the target parent window in turn, and obtains all child windows with process number one as the target child windows.
S706C, the step Cheng Guanli module 430 obtains the identification of the target child window.
S707C, the step Cheng Guanli module 430 sends a pause instruction and the identification of the target sub-window to the process of process number one.
Fig. 7C is different from fig. 7A in that the cross-process management module 430 does not need to perform the step of S705A in fig. 7A, but replaces S705A with S705C. In S705C, the span Cheng Guanli module 430 does not need to traverse the child windows under each parent window in sequence, and obtains child windows with a process number of one from all child windows. The cross-process management module 430 can directly traverse to the child window with the process number of one from the child window associated with the target parent window, so that the time for the cross-process Cheng Guanli module 430 to find the child window with the process number of one is saved as the target child window, and the efficiency of controlling the audio class application 1 to stop playing the audio by the cross-process management module 430 is improved.
Fig. 7D illustrates a schematic diagram of how still another step-in Cheng Guanli module 430 controls the audio class application 1 to stop playing audio based on the process number one and the pause instruction.
S701D, the stride Cheng Guanli module 430 traverses each parent window in turn, traversing to the next parent window.
S702D, sending a pause instruction and the identification of the next parent window to the process of the process number one.
S703D, is the cross-process management module 430 determining that the audio class application 1 stops playing audio?
If the cross-process management module 430 determines that the audio class application 1 does not stop playing audio, it indicates that the window of the audio class application 1 for playing/pausing is not a parent window of the audio class application 1, and the cross-process Cheng Guanli module 430 performs S704D.
If the cross-process management module 430 determines that the audio class application 1 stops playing audio, the window that indicates that the audio class application 1 implements the play/pause function is the parent window of the audio class application 1, and the process ends.
S704D, the step Cheng Guanli module 430 traverses the child window associated with the next parent window in turn.
S705D, is the cross-process management module 430 determines that the process number of the child window associated with the next parent window is process number one?
If so, the span Cheng Guanli module 430 executes S706D, which indicates that the window of the audio class application 1 implementing the play/pause function may be a child window associated with the next parent window. If not, the window indicating that the audio class application 1 implements the play/pause function is not a child window associated with the next parent window, and the step Cheng Guanli module 430 executes S701D.
S706D, the step Cheng Guanli module 430 sends a pause instruction and an identification of the child window associated with the next parent window of process number one to the process of process number one.
After the cross-over Cheng Guanli module 430 sends the pause instruction and the identification of the child window associated with the next parent window of process number one to the process of process number one, the cross-process management module 430 performs the determining step of S703D. If the audio class application 1 stops playing audio, it is indicated that the window of the audio class application 1 implementing the play/pause function is a child window associated with the next parent window, and the process ends. If not, the window indicating that the audio class application 1 implements the play/pause function is not a child window associated with the next parent window, the skip Cheng Guanli module 430 executes S701D, and the skip Cheng Guanli module 430 continues to search for the child window associated with the next parent window and the next parent window until the skip Cheng Guanli module 430 searches for a parent window or a child window associated with a parent window that causes the audio class application 1 to stop playing audio.
Fig. 7C differs from fig. 7A in that, first, the step-in Cheng Guanli module 430 does not need to determine the process number of the parent window, but directly sends the identifier and the pause instruction of the parent window being traversed to the process with the process number of one when traversing to each parent window. Second, instead of searching all child windows associated with the parent window at a time, the cross-process management module 430 only traverses child windows associated with the parent window being traversed, and the cross-process Cheng Guanli module 430 sends the identifier of the child window associated with the parent window being traversed and a pause instruction to the process with the process number one, if the operation causes the audio class application 1 to pause playing audio, the cross-process Cheng Guanli module 430 does not need to traverse other parent windows and child windows, and compared with S705A in fig. 7A, the time for the cross-process management module 430 to traverse all child windows associated with the parent window is saved. If the operation does not cause the audio class application 1 to pause playing audio, the step-in Cheng Guanli module 430 continues to execute S701D.
After audio class application 2 pauses playing audio, the step-in Cheng Guanli module 430 can also automatically control audio class application 1 to continue playing audio. The principle of how the cross-over Cheng Guanli module 430 controls the audio class application 1 to continue playing audio based on the process number one is similar to the principle of how the cross-over Cheng Guanli module 430 controls the audio class application 1 to pause playing audio based on the process number one. In particular, reference may be made to the relevant descriptions in fig. 7A-7C. Except that the former continues to play audio and the latter pauses to play audio, the difference between the former and the latter is that before the cross-process management module 430 controls the audio class application 1 to continue to play audio, the cross-process Cheng Guanli module 430 needs to determine whether the triggering operation of the previous audio class application 1 to pause to play audio is actively triggered by the user or triggered by the play priority policy of the system. If the cross-process management module 430 determines that the triggering operation of the audio class application 1 to pause playing audio is actively triggered by the user, the cross-process Cheng Guanli module 430 does not control the audio class application 1 to continue playing audio, so as to avoid collision with the user's will. If the cross-process management module 430 determines that the triggering operation of the audio class application 1 to pause playing audio is triggered by the playing priority policy of the system, the cross-process Cheng Guanli module 430 controls the audio class application 1 to continue playing audio. For how the cross-over Cheng Guanli module 430 determines whether the triggering operation of the audio class application 1 to pause playing audio is actively triggered by the user or triggered by the generic playing priority policy, reference may be made to the detailed description in the embodiment of fig. 5, and this embodiment of the application will not be repeated here.
The preset priority policy according to the embodiment of the present application is explained next.
It should be noted that, the preset priority policy is set for the audio class application, that is, the electronic device 100 may divide the audio class application into different priorities.
Mode one: applications in the electronic device 100 are classified into different priority levels. For example, the first level, the second level, the third level, the fourth level, and so on, wherein the first level has a priority greater than the second level, the second level has a priority greater than the third level, and the third level has a priority greater than the fourth level. The electronic device 100 classifies different applications into different priority levels.
TABLE 1
Figure BDA0003433431130000181
Table 1 exemplarily shows the results of the prioritization of applications in the electronic device 100. For example, the priority level of the real-time voice/real-time video class application is a first level, and the real-time voice/real-time video class application may include, but is not limited to, a telephony application, a social application (e.g., an instant messaging class application, etc.). The priority level of the navigation class application is a second level, and the navigation class application may include, but is not limited to, a hundred degree map application, and the like. The priority level of the game-like application is a third level, and the game-like application may include, but is not limited to, a king glowing application, etc. The priority level of the music class application is a fourth level, and the music class application may include, but is not limited to, a networkcloud music application, and the like. The priority level of the video class application is also a fourth level, and the video class application may include, but is not limited to, a Tencel video application, etc.
It should be noted that table 1 only exemplarily shows the result of the prioritization of the partial applications. In a specific implementation, other levels may be included that are more than the levels of priority in table 1, and the categories of audio applications may be more, which is not limited in this embodiment of the present application.
Since the kind of applications in the electronic device 100 changes in real time, the electronic device 100 can periodically update the priority level of the applications in the electronic device 100. Alternatively, the electronic device 100 may alter the priority level of the application in the electronic device 100 based on the frequency of use by the user and the usage habits of the user. That is, the priority level of applications in the electronic device 100 may vary. Optionally, the electronic device 100 may also receive the priority level of the application in the user-defined electronic device 100, so that the priority level of the unused application may be set according to the user's wish, thereby further improving the user experience.
Taking an audio class application 1 and an audio class application 2 as examples, how to perform audio play control according to a preset priority policy is described below.
1. When the priority of the audio class application 1 is the same as the priority of the audio class application 2, that is, the peer switch, the electronic device 100 defaults that the audio class application with the later playing time can continue to play the audio, and the audio class application with the earlier playing time pauses to play the audio. For example, when the audio class application 1 is playing audio, the electronic device 100 receives a user operation to start playing audio through the audio class application 2, and since the playing time of the audio class application 2 is later than the playing time of the audio class application 1, the electronic device 100 will control the audio class application 1 to pause playing and control the audio class application 2 to start playing audio.
2. When the priority of the audio class application 1 is higher than the priority of the audio class application 2, that is, the high-level switch is performed, the electronic device 100 may give a prompt message, where the prompt message is used to prompt the user to pause the audio class application with the higher priority to play audio, or prompt the user to fail to switch the audio class application to play audio. For example, when the audio class application 1 is playing audio, the electronic device 100 receives a user operation to start playing audio through the audio class application 2, and since the priority of the audio class application 1 is higher than that of the audio class application 2, the electronic device 100 cannot control the audio class application 1 to pause playing and control the audio class application 2 to start playing audio. Alternatively, the electronic device 100 may output a prompt for prompting the user that the audio class application 2 cannot be controlled to start playing audio. Optionally, the electronic device 100 may also output a prompt message, where the prompt message is used to prompt the user to pause the audio played by the audio class application 1 if the user wants to start playing the audio by the audio class application 2.
3. When the priority of the audio class application 1 is lower than the priority of the audio class application 2, that is, the low-level is switched to the high-level, the electronic device 100 may directly pause the audio class application with the low priority from playing audio, and control the audio class application with the high priority to play audio. For example, when the audio class application 1 is playing audio, the electronic device 100 receives a user operation to start playing audio through the audio class application 2, and since the priority of the audio class application 1 is lower than that of the audio class application 2, the electronic device 100 can directly pause the audio played by the audio class application 1 and control the audio class application 2 to start playing audio.
Mode two: the electronic device 100 does not prioritize the audio class applications in the electronic device 100 but determines whether to switch based on the play time. The electronic device 100 defaults to the priority of the audio class application with the later playing time being always higher than the priority of the audio class application with the earlier playing time. For example, when the audio class application 1 is playing audio, the electronic device 100 receives a user operation to start playing audio through the audio class application 2, and since the playing time of the audio class application 2 is later than the playing time of the audio class application 1, the electronic device 100 will control the audio class application 1 to pause playing and control the audio class application 2 to start playing audio.
It should be noted that, the method is not limited to the preset priority policies described in the first and second modes, but may include other priority policies, which are not limited in this embodiment of the present application.
Next, an audio playing method provided in the embodiments of the present application is described based on the above-described preset priority policy with reference to the accompanying drawings.
Fig. 8A-8B are schematic diagrams illustrating how the electronic device 100 outputs audio when switching from a low priority audio class application to a high priority audio class application.
Illustratively, the audio class application 1 may be a music application and the audio class application 2 may be an instant messaging class application. The priority of the music application is lower than the priority of the instant messaging application. Instant messaging applications have the functionality of voice chat or video chat.
In particular, referring to the associated description of 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 a desktop.
Then, as shown in fig. 8A, during the process of playing music by the electronic device 100, the electronic device 100 receives a voice call request sent by another electronic device, the electronic device 100 receives an input operation (for example, clicking) of the user on the receiving control 1004 in the prompt field 1003, and the electronic device 100 establishes a voice call connection with the electronic device used by the contact "anywhere. After the electronic device 100 establishes a voice call connection with the electronic device used by the contact "anywhere," because the priority of the instant messaging application is higher than that of the music application, in order to control only one audio output at the same time, the electronic device 100 will control the application with low priority to pause playing audio, i.e. the electronic device 100 controls the music application to pause playing audio.
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 pause state. Meanwhile, the electronic device 100 displays a voice call user interface 1006, and the electronic device 100 controls the instant messaging application to play the voice of the contact "anywhere else" and the voice content may be "wait for two minutes" waiting for the other people to come online.
After the electronic device 100 finishes establishing the voice call connection with the electronic device used by the contact "anywhere", the electronic device 100 stops displaying the voice call user interface 1006, the electronic device 100 also displays the user interface 1001 on the desktop, and the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a play state, that is, after finishing the voice call, if the electronic device 100 pauses the playing of the audio by the music application due to the play priority policy before, instead of the user actively triggering the operation to pause the playing of the audio by the music application, the electronic device 100 may automatically continue playing the audio in the music application.
Fig. 9A-9C are schematic diagrams illustrating how the electronic device 100 outputs audio when switching from a high priority audio class application to a low priority audio class application.
Illustratively, the audio class application 1 may be an instant messaging class application and the audio class application 2 may be a music application. The priority of the music application is lower than the priority of the instant messaging application.
Specifically, as shown in fig. 9A, and with specific reference to the descriptions in fig. 1D-1E, the electronic device 100 first establishes a voice call connection with the electronic device used by the contact "lie", and displays a voice call user interface 1006 as shown in fig. 9A on the desktop.
Then, when the user is in the process of making a voice call with the contact "anywhere", the user again wants to play music through the music application. As shown in fig. 9B, and with specific reference to the description in fig. 1A-1B, the electronic device 100 in turn displays a user interface 1001 of the music application as shown in fig. 9B on a desktop.
As shown in fig. 9B, the electronic device 100 receives an input operation (e.g., a click) by a user with respect to a pause/play control 1002 in the user interface 1001, and in response to the input operation by the user, the electronic device 100 displays a reminder bar 901 of the music application shown in fig. 9C on a desktop. The content of the prompt in the prompt field 901 may be "please end the ongoing voice call before starting to play music", or the content of the prompt in the prompt field 901 may be "currently ongoing voice call, cannot play music", etc. In this way, when the audio class application with high priority is switched to the audio class application with low priority, the electronic device 100 can output the prompt information, so as to prevent the electronic device 100 from being directly switched to the audio class application with low priority to play the audio, and apply the user experience.
Fig. 10A-10C are schematic diagrams illustrating how the electronic device 100 outputs audio when switching audio class applications of the same priority.
Illustratively, the audio class application 1 may be a music application and the audio class application 2 may be a video application. The priority of the music application is the same as the priority of the video application.
In particular, as shown in FIG. 10A, the electronic device 10 plays music through a music application, as may be described with reference to the associated descriptions in FIGS. 1A-1C. The electronic device 100 displays a user interface 1001 of a music application as shown in fig. 10A on a desktop.
Thereafter, when the user plays the video through the video application, the electronic device 100 receives an input operation (e.g., double click) by the user with respect to an icon of the video on the desktop, and the electronic device 100 displays a 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 icon 1102 of video a.
As shown in fig. 10B, when the electronic device 100 receives an input operation from the user for the icon 1102, the electronic device 100 displays a playing interface of the video a. Since the priority of the music application is the same as the priority of the video application, as shown in fig. 10C, the electronic device 100 can directly control the music application to pause playing of music, and after the electronic device 100 controls the music application to pause playing of audio, the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a pause state. Meanwhile, the electronic device 100 displays the video playback interface 1103 of video a, where the video playback interface 1103 may include a playback control, a previous set control, a next set control, a selection control, and so on. While the electronic device 100 displays the video playback interface 1103, the electronic device 100 controls the video application to play audio in video a.
Optionally, after the electronic device 100 finishes playing the video by the video application, if the electronic device 100 pauses playing the audio by the music application due to the play priority policy before, instead of the user actively triggering the operation to pause playing the audio by the music application, the electronic device 100 may automatically start playing the audio in the music application, and the electronic device 100 displays the display form of the pause/play control 1002 in the user interface 1001 as a play state, that is, after the video is played, the electronic device 100 may automatically continue playing the audio in the music application.
Optionally, if the two applications with the same priority are two different real-time voice/real-time video applications, firstly, the electronic device 100 performs a voice call with the contact person through the real-time voice/real-time video application one, then, the contact person of the real-time voice/real-time video application two also initiates a voice call request to the user, when the user receives the voice call request of the contact person of the real-time voice/real-time video application two, the electronic device 100 first continuously hangs up the voice call with the contact person of the real-time voice/real-time video application one, but firstly outputs prompt information, and the prompt information is used for prompting the user to end the voice call with the contact person of the real-time voice/real-time video application one after receiving the voice call request of the contact person of the real-time voice/real-time video application two. In this way, when switching between two real-time voice/real-time video applications, the electronic device 100 may output a prompt message to prompt whether to switch the voice call, thereby improving the user experience.
In the case where the audio class application in the electronic device 100 is not prioritized for the electronic device 100, it is determined whether to switch or not based on the play time. I.e. the priority of the later played audio is always higher than the priority of the previously played audio. For the case of a switch between non-real time voice/real time video type applications, the electronic device 100 may switch directly. When the real-time voice/real-time video application needs to be switched to another audio application, the electronic device 100 may output a prompt message, so as to avoid suddenly switching the voice call and affecting the user experience.
As shown in fig. 11, fig. 11 illustrates another timing chart for simultaneously playing multiple audio signals according to an embodiment of the present application.
And the embodiments are described by taking the example of switching from playing audio by a low priority application to playing audio by a high priority application.
By way of example, the low priority application may be a music application and the high priority application may be a real-time voice/real-time video class application.
In fig. 11, at 0ms, the electronic device 100 receives an operation of the user to start playing a song in the music application, and after a period of time (for example, 360 ms), the electronic device 100 receives a voice call sent by the electronic device to which the user operation has accessed the use of the contact "anywhere". As shown in fig. 11, after the electronic device 100 establishes a voice call connection with the electronic device used by the contact "anywhere," the electronic device 100 may play the voice of the contact "anywhere," while the electronic device 100 pauses playing the song in the music application. For example, if the call duration is 480ms, the electronic device 100 pauses the playing of the song in the music application when the electronic device 100 plays the voice of the contact "anywhere from 0ms to 480 ms. That is, when playing audio in a high-priority application, the electronic device 100 may pause playing audio in a low-priority application, so as to avoid that multiple audio channels are played simultaneously, which results in a mixing effect. After the voice call in the real-time voice/real-time video class application has lasted 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 songs in the music application.
As can be seen from the above analysis, when the electronic device 100 plays multiple audio channels, the electronic device 100 pauses playing audio in low-priority applications when playing audio in high-priority applications, so as to avoid the audio mixing effect heard by the user due to simultaneous playing of multiple audio channels. For example, during a user listening to music or watching a movie, the user has access to a voice call via the electronic device 100. In the process of voice call, the user pauses the playing of music or films, and after the voice call is ended, the music or films continue to be played, so that the user is prevented from missing audible music fragments or wonderful film fragments in the process of answering the voice call, and the user experience is improved.
Fig. 12 is a schematic flow chart of an audio playing method according to an embodiment of the present application.
S1201, the electronic device 100 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.
S1202, the electronic equipment receives a first operation of a user, wherein the first operation is used for controlling a second application to play a second audio file.
Alternatively, the first application may be the audio class application 1 (e.g. a music application) described in the foregoing embodiment. The play progress number of the first application may be the progress number one of the audio class application 1 described in the foregoing embodiment.
The first operation may be an input operation (e.g., a single click) to the receive control 1004 in fig. 8A. The second application may be an audio class application 2 (e.g., an instant messaging class application) as described in the previous embodiments.
Alternatively, the first application may also be the audio class application 2 (e.g. instant messaging class application) described in the foregoing embodiment. The play progress number of the first application may be the progress number two of the audio class application 2 described in the foregoing embodiment.
The first operation may be an input operation (e.g., a single click) for pause/play control 1002 in fig. 9B. The second application may be an audio class application 1 (e.g. a music application) as described in the previous embodiments.
Alternatively, the first application may also be the audio class application 1 (e.g. a music application) described in the foregoing embodiment. The play progress number of the first application may be the progress number one of the audio class application 1 described in the foregoing embodiment.
The first operation may be an input operation for icon 1102 in 10B. The second application may be an audio class application 2 (e.g. a video application) as described in the previous embodiments.
And S1203, responding to the first operation, and determining a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment.
The window displayed by the electronic device comprises 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 of the electronic device display may include a plurality of child windows associated with each parent window of the electronic device display may also include a plurality of child windows.
Alternatively, the electronic device may determine that it is the first application to pause the playback based on the playback order. For example, 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 pauses playing.
Optionally, the electronic device may determine that the first application is paused based on a preset application priority. Illustratively, the electronic device determines that it is the first application that is paused because of the priority of the second application and the priority of the first application.
Alternatively, the electronic device may determine that the first application is paused based on the type of audio file played by the application.
Optionally, the electronic device may determine that the first application is paused based on the preset application priority and the type of the audio file to be played.
Responding to the first operation, the electronic equipment determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment, and the method specifically comprises the following steps: and responding to the first operation, and determining the target window with the process number being the playing process number of the first application from the windows displayed by the electronic equipment 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 playing audio based on the preset application priority.
The electronic device determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic device based on the priority of the first application and the priority of the second application, and specifically comprises the following steps: and under the condition that the priority of the first application is lower than that of the second application, the electronic equipment determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment.
And under the condition that the priority of the first application is higher than that of the second application, the electronic equipment continues to play the first audio file in the first application and does not play the second audio file in the second application.
And under the condition that the priority of the first application is the same as that of the second application, the electronic equipment outputs first prompt information, and the first prompt information is used for prompting a user to pause playing of the first audio file in the first application before playing of the second audio file in the second 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, a target window with a process number being a play process number of the first application, and specifically includes: and responding to the first operation, and determining the target window with the process number being the playing process number of the first application from the windows displayed by the electronic equipment based on the type of the first audio file and the type of the second audio file. Thus, the electronic device can 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 further determine, from the windows displayed by the electronic device, a target window with a process number that is a playing process number of the first application, 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. Thus, the electronic device can automatically control the application to pause playing of the audio based on the preset priority of the application and the type of the audio file played in the application.
The electronic device determines a target window with a process number being a playing process number of a first application from windows displayed by the electronic device based on the type of the first audio file and the type of the second audio file, and specifically comprises the following steps: and under the condition that the type of the first audio file is a non-real-time type audio file and the type of the second audio file is a real-time type audio file, the electronic equipment determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment. That is, the real-time class 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 comprises the following steps: outputting second prompt information by the electronic equipment under the condition that the type of the first audio file is a real-time audio file, wherein the second prompt information is used for indicating a 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, and controls the second application to play the second audio file, and the method specifically comprises the following steps: the electronic equipment receives a second operation of the user, responds to the second operation, controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file. Therefore, the priority of the real-time audio files is highest, so that the electronic equipment can be prevented from switching the real-time audio files into the non-real-time audio files, and the user experience is prevented from being influenced.
S1204, the electronic equipment controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file.
Optionally, the electronic device controls a playing process of the first application corresponding to the target window to pause playing the first audio file, and specifically includes: the electronic equipment acquires the identification of the target window and simulates a virtual space key value; the electronic equipment sends the identification of the target window and the virtual space key value to a playing process of the first application; the electronic equipment controls the first application to pause playing the first audio file based on the identification of the target window and the virtual space key value through the playing process of the first application corresponding to the target window. In this way, the electronic equipment simulates the virtual space key value, and the space key value is obtained without the need for a user to operate a space key on the keyboard, so that the user operation is reduced.
Optionally, the electronic device controls the playing process of the first application corresponding to the target window to stop playing the first audio file, and specifically includes: the electronic equipment sequentially traverses each parent window displayed in the electronic equipment, and a target parent window with a process number being a playing process number of the first application is determined; the electronic equipment controls the playing process of the first application corresponding to the target father window to stop playing the first audio file; or the electronic equipment sequentially traverses each parent window in the electronic equipment to determine a target parent window with a process number of a playing process number of the first application; under the condition that the electronic equipment fails to control the playing process of the first application corresponding to the target father window to stop playing the first audio file, the electronic equipment sequentially traverses each child window associated with each father window displayed by the electronic equipment to obtain a target child window with a process number of playing process number, or sequentially traverses each child window associated with the target father window displayed by the electronic equipment to obtain a target child window with a process number of playing process number; and the electronic equipment controls the playing process of the first application corresponding to the target sub-window to stop playing the first audio file. Therefore, the electronic device firstly judges whether the target parent window can realize the pause of playing the audio, if so, the target child window does not need to be traversed, and the time for the electronic device to search the target child window is saved. 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, and specifically includes: the electronic equipment sequentially traverses each parent window displayed in the electronic equipment, and a target parent window with a process number being a playing process number of the first application is determined; the electronic equipment sequentially traverses each sub-window displayed in the electronic equipment to determine a target sub-window with a process number of the playing process number of the first application, or sequentially traverses each sub-window associated with a target parent window displayed by the electronic equipment to determine a target sub-window with a process number of the playing process number of the first application; and the electronic equipment 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 for realizing the playing logic is either the target child window or the target parent window, and the electronic device directly acquires the target parent window and the target child window, so that the control application can realize approval of playing the audio.
For how the electronic device determines that the process number is the target window of the playing process number of the first application in the windows displayed by the sub-devices, reference may be made to the embodiments shown in fig. 7A to 7D. The embodiments of the present application are not described herein.
Optionally, after the electronic device starts outputting the second audio file in the second application, the method further comprises: the electronic equipment receives a third operation of a user, wherein the third operation is used for controlling 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. Therefore, the electronic equipment can control the application which pauses the audio playing due to the system equipment instead of the application which pauses the audio playing due to the active triggering operation of the user to automatically start the audio playing again, so that the user operation is saved.
Optionally, the electronic device receives a fourth operation of the user, where 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 second application to continue to pause playing the second audio file. Therefore, the electronic equipment cannot control the application which pauses the audio playing due to the active triggering operation of the user to automatically start the audio playing again, and the conflict with the wish of the user is avoided.
The embodiment of the application also provides electronic equipment, which comprises: one or more processors, one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories for storing computer program code, the computer program code comprising computer instructions that the one or more processors call to cause the electronic device to perform one of the audio playback methods shown in fig. 12.
The embodiments of the present application may be arbitrarily combined to achieve different technical effects.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line), or wireless (e.g., infrared, wireless, microwave, etc.). Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc., that contain an integration of one or more available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid State Disks (SSDs)), among others.
Those of ordinary skill in the art will appreciate that implementing all or part of the above-described method embodiments may be accomplished by a computer program to instruct related hardware, the program may be stored in a computer readable storage medium, and the program may include the above-described method embodiments when executed. And the aforementioned storage medium includes: ROM or random access memory RAM, magnetic or optical disk, etc.
In summary, the foregoing is merely an example of the technical solution of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention should be included in the protection scope of the present invention.

Claims (15)

1. An audio playing method, characterized in that the method comprises:
the method comprises the steps that electronic equipment plays a first audio file in a first application, and obtains a playing process number of the first application and a process number of a window displayed by the electronic equipment;
the electronic equipment receives a first operation of a user, wherein the first operation is used for controlling a second application to play a second audio file;
responding to the first operation, and determining a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment;
And the electronic equipment controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file.
2. The method of claim 1, wherein the electronic device controls a playing process of the first application corresponding to the target window to pause playing the first audio file, specifically including:
the electronic equipment acquires the identification of the target window and simulates a virtual space key value;
the electronic equipment sends the identification of the target window and the virtual space key value to a playing process of the first application;
and the electronic equipment controls the first application to pause playing the first audio file through the playing process of the first application corresponding to the target window based on the identification of the target window and the virtual space key value.
3. The method according to claim 1 or 2, wherein in response to the first operation, the electronic device determines, from the windows displayed by the electronic device, a target window with a process number that is a play process number of the first application, and specifically includes:
And responding to the first operation, and determining the target window with the process number being the playing process number of the first application from the windows displayed by the electronic equipment based on the priority of the first application and the priority of the second application.
4. The method of claim 3, wherein the determining, by the electronic device, the target window with the process number being the playing 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, specifically includes:
and under the condition that the priority of the first application is lower than that of the second application, the electronic equipment determines the target window with the process number being the playing process number of the first application from the windows displayed by the electronic equipment.
5. The method according to claim 4, wherein the method further comprises:
and under the condition that the priority of the first application is higher than that of the second application, the electronic equipment continues to play the first audio file in the first application and does not play the second audio file in the second application.
6. The method according to claim 4 or 5, characterized in that the method further comprises:
and under the condition that the priority of the first application is the same as that of the second application, the electronic equipment outputs first prompt information, wherein the first prompt information is used for prompting a user to pause playing the first audio file in the first application before playing the second audio file in the second application.
7. The method according to claim 1 or 2, wherein in response to the first operation, the electronic device determines, from the windows displayed by the electronic device, a target window with a process number that is a play process number of the first application, and specifically includes:
and responding to the first operation, and determining a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment based on the type of the first audio file and the type of the second audio file.
8. The method according to claim 7, wherein the electronic device determines, from the windows displayed by the electronic device, a target window with a process number that is a play process number of the first application based on the type of the first audio file and the type of the second audio file, specifically including:
And under the condition that the type of the first audio file is a non-real-time type audio file and the type of the second audio file is a real-time type audio file, the electronic equipment determines a target window with a process number being a playing process number of the first application from windows displayed by the electronic equipment.
9. 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:
outputting second prompt information by the electronic equipment under the condition that the type of the first audio file is a real-time audio file, wherein the second prompt information is used for indicating a 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, and controls the second application to play the second audio file, and the method specifically comprises the following steps:
and the electronic equipment receives a second operation of a user, responds to the second operation, controls the playing process of the first application corresponding to the target window to pause the playing of the first audio file, and controls the second application to play the second audio file.
10. The method of any one of claims 1 to 9, wherein the electronic device controls a playing process of the first application corresponding to the target window to stop playing the first audio file, and specifically includes:
the electronic equipment sequentially traverses each parent window displayed in the electronic equipment, and determines that the process number is a target parent window of the playing process number of the first application;
the electronic equipment controls the playing process of the first application corresponding to the target father window to stop playing the first audio file;
or alternatively, the process may be performed,
the electronic equipment sequentially traverses each parent window in the electronic equipment, and a target parent window with a process number being a playing process number of the first application is determined;
under the condition that the electronic equipment 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 equipment sequentially traverses each child window associated with each parent window displayed by the electronic equipment, and a target child window with a process number being the playing process number is obtained;
and the electronic equipment controls the playing process of the first application corresponding to the target sub-window to stop playing the first audio file.
11. The method of any one of claims 1 to 9, wherein the electronic device controls a playing process of the first application corresponding to the target window to stop playing the first audio file, and specifically includes:
the electronic equipment sequentially traverses each parent window displayed in the electronic equipment, and determines that the process number is a target parent window of the playing process number of the first application;
the electronic equipment sequentially traverses each sub-window displayed in the electronic equipment, and determines that the process number is a target sub-window of the playing process number of the first application;
and the electronic equipment controls the playing process of the first application corresponding to the target father window and the target child window to stop playing the first audio file.
12. The method of any of claims 1-11, wherein after the electronic device begins outputting the second audio file in the second application, the method further comprises:
the electronic equipment receives a third operation of a user, wherein the third operation is used for controlling a second application to pause playing a second audio file;
and in response to the third operation, the electronic equipment controls the second application to pause playing the second audio file and controls the first application to continue playing the first audio file.
13. An electronic device, the electronic device comprising: one or more processors, one or more memories; the one or more memories coupled with the one or more processors, the one or more memories to store computer program code comprising computer instructions that the one or more processors invoke to cause the electronic device to perform the method of any of the above claims 1-12.
14. A computer readable storage medium storing computer instructions which, when run on an electronic device, cause the electronic device to perform the method of any one of the preceding claims 1-12.
15. A computer program product, characterized in that the computer program product, when run on an electronic device, causes the electronic device to perform the method of any of the preceding claims 1-12.
CN202111605105.6A 2021-12-24 2021-12-24 Audio playing method and related device Pending CN116339672A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111605105.6A CN116339672A (en) 2021-12-24 2021-12-24 Audio playing method and related device
PCT/CN2022/140714 WO2023116768A1 (en) 2021-12-24 2022-12-21 Audio playback method and related apparatus

Applications Claiming Priority (1)

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

Publications (1)

Publication Number Publication Date
CN116339672A true CN116339672A (en) 2023-06-27

Family

ID=86890288

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (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

Family Cites Families (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
US11288033B2 (en) * 2019-04-09 2022-03-29 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

Also Published As

Publication number Publication date
WO2023116768A1 (en) 2023-06-29

Similar Documents

Publication Publication Date Title
US11144371B2 (en) Digital assistant extensibility to third party applications
US10871872B2 (en) Intelligent productivity monitoring with a digital assistant
EP3245579B1 (en) User interaction pattern extraction for device personalization
US20210004247A1 (en) Suggesting Actions Based on Machine Learning
KR101260770B1 (en) Mobile device and method for controlling play of contents in mobile device
US10725972B2 (en) Continuous and concurrent device experience in a multi-device ecosystem
CN102572091B (en) Mobile terminal and method of sharing information therein
CN106133826B (en) flexible schema for language model customization
CN102905014A (en) Mobile terminal
US20170237930A1 (en) Method of controlling the sharing of videos and electronic device adapted thereto
US20240111473A1 (en) Distributed display method and terminal for application interface
US10084850B2 (en) Terminal apparatus, server and method of controlling the same
KR20130053935A (en) Contents transferring method and device, server using the method
KR20170010447A (en) Wireless communication device having deterministic control of foreground access of the user interface
WO2023116768A1 (en) Audio playback method and related apparatus
WO2022135157A1 (en) Page display method and apparatus, and electronic device and readable storage medium
WO2022160991A1 (en) Permission control method and electronic device
WO2022134691A1 (en) Method and device for screech processing in terminal device, and terminal
JP2023547821A (en) Control method and device, and electronic device
WO2022188683A1 (en) Flexibly authorized access control method, and related apparatus and system
US11985374B2 (en) Method of controlling the sharing of videos and electronic device adapted thereto
EP4290827A1 (en) Access control method and related apparatus
CN106096392B (en) Mobile terminal, application program starting control method and device
EP3319328A1 (en) Streaming service method and device
CN117850716A (en) Information processing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination