CN108509176B - Method and device for playing audio data, storage medium and intelligent terminal - Google Patents
Method and device for playing audio data, storage medium and intelligent terminal Download PDFInfo
- Publication number
- CN108509176B CN108509176B CN201810316091.8A CN201810316091A CN108509176B CN 108509176 B CN108509176 B CN 108509176B CN 201810316091 A CN201810316091 A CN 201810316091A CN 108509176 B CN108509176 B CN 108509176B
- Authority
- CN
- China
- Prior art keywords
- state
- playing
- audio
- intelligent terminal
- connection
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/16—Sound input; Sound output
- G06F3/162—Interface to dedicated audio devices, e.g. audio drivers, interface to CODECs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/16—Sound input; Sound output
- G06F3/165—Management of the audio stream, e.g. setting of volume, audio stream path
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11B—INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
- G11B20/00—Signal processing not specific to the method of recording or reproducing; Circuits therefor
- G11B20/10—Digital recording or reproducing
- G11B20/10527—Audio or video recording; Data buffering arrangements
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11B—INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
- G11B20/00—Signal processing not specific to the method of recording or reproducing; Circuits therefor
- G11B20/10—Digital recording or reproducing
- G11B20/10527—Audio or video recording; Data buffering arrangements
- G11B2020/10537—Audio or video recording
- G11B2020/10546—Audio or video recording specifically adapted for audio data
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Signal Processing (AREA)
- Telephone Function (AREA)
Abstract
The embodiment of the application discloses a method and a device for playing audio data, a storage medium and an intelligent terminal. The method comprises the following steps: when the connection state of the intelligent terminal and the external audio equipment is a connection abnormal state, acquiring the playing state of the currently running audio playing application; when the playing state is a pause state, recording the duration of the pause state; and if the connection between the intelligent terminal and the external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold, controlling the audio playing application to play audio data. By adopting the technical scheme, the time threshold for automatically resuming playing is set for controlling the audio playing application, so that whether the duration of pause playing does not exceed the time threshold can be detected when the factor causing abnormal connection between the intelligent terminal and external audio equipment disappears, if so, the audio playing application is automatically controlled to resume playing, user intervention is not needed, and the control intelligence is improved.
Description
Technical Field
The embodiment of the application relates to audio processing technologies, and in particular, to a method and an apparatus for playing audio data, a storage medium, and an intelligent terminal.
Background
With the popularization of mobile terminals, the mobile terminals have become indispensable personal communication tools and entertainment assistants in daily life of people. The mobile terminal can play audio data in a wired or wireless connection mode with external audio equipment, for example, a user plays music or radio through a vehicle-mounted Bluetooth sound box when driving.
Currently, when the mobile terminal plays audio data through an external audio device, the playing may be suspended for some reasons, for example, the external audio device is damaged, and the mobile terminal is in poor contact with the external audio device. And after the reason for playing pause is eliminated, the control mode for enabling the external audio equipment to continue playing the audio data is not intelligent enough.
Disclosure of Invention
The embodiment of the application provides a method, a device, a storage medium and an intelligent terminal for playing audio data, which can optimize an audio playing scheme in the related technology and improve the intelligence of control.
In a first aspect, an embodiment of the present application provides a method for playing audio data, including:
when the connection state of the intelligent terminal and the external audio equipment is a connection abnormal state, acquiring the playing state of the currently running audio playing application;
when the playing state is a pause state, recording the duration of the pause state;
and if the connection between the intelligent terminal and the external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold, controlling the audio playing application to play audio data.
In a second aspect, an embodiment of the present application further provides an apparatus for playing audio data, where the apparatus includes:
the state acquisition module is used for acquiring the playing state of the currently running audio playing application when the connection state of the intelligent terminal and the external audio equipment is the abnormal connection state;
the time recording module is used for recording the duration time of the pause state when the playing state is the pause state;
and the audio playing module is used for controlling the audio playing application to play audio data if the connection between the intelligent terminal and external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold.
In a third aspect, embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for playing audio data as described in the first aspect above.
In a fourth aspect, an embodiment of the present application further provides an intelligent terminal, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the method for playing audio data according to the first aspect.
The application provides a scheme for playing audio data, wherein when the connection state of an intelligent terminal and external audio equipment is a connection abnormal state, the playing state of a currently running audio playing application is acquired; when the playing state is a pause state, recording the duration of the pause state; and if the duration time of the pause state does not exceed the preset time threshold when the connection is recovered to be normal, controlling the audio playing application to play the audio data. By adopting the technical scheme, the time window for automatically resuming playing (namely the preset time threshold) is set for controlling the audio playing application, so that whether the duration of the pause playing is within the time window can be detected when the factor causing the abnormal connection between the intelligent terminal and the external audio equipment disappears, if so, the audio playing application is automatically controlled to resume playing, the user intervention is not needed, and the control intelligence is improved.
Drawings
Fig. 1 is a flowchart of a method for playing audio data according to an embodiment of the present application;
fig. 2 is a flowchart of another method for playing audio data according to an embodiment of the present application;
fig. 3 is a flowchart of another method for playing audio data according to an embodiment of the present application;
fig. 4 is a flowchart of another method for playing audio data according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for playing audio data according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an intelligent terminal provided in an embodiment of the present application;
fig. 7 is a block diagram of a smart phone according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Fig. 1 is a flowchart of a method for playing audio data according to an embodiment of the present application, where the method is applicable to a situation where abnormal playing is caused by abnormal connection between an intelligent terminal and an external audio device, and the method may be executed by a device for playing audio data, where the device may be implemented by software and/or hardware, and may generally be integrated in an intelligent terminal such as a smart phone, a tablet computer, or an intelligent wearable device. As shown in fig. 1, the method includes:
and 110, when the connection state of the intelligent terminal and the external audio equipment is a connection abnormal state, acquiring the playing state of the currently running audio playing application.
It should be noted that the external audio device includes, but is not limited to, a line control earphone, a wireless earphone (such as a bluetooth earphone and an infrared earphone), a bluetooth speaker, a wired speaker, or a wireless speaker. The abnormal connection state includes but is not limited to the state that the intelligent terminal detects that the earphone is in the pull-out state due to the loosening of the wire control earphone interface, the Bluetooth connection is abnormally disconnected, or the WiFi is disconnected, and the like.
And the query task manager determines the currently running process and determines the currently running application program according to the process. And acquiring an application identifier of the currently running application program, and judging whether the application program is an audio playing application or not according to the application identifier. The application identifier includes an application package name or an application process number. If the application program is determined to be the audio playing application according to the application identifier, whether the audio playing application executes the operation of reading the audio data is further judged. The judgment method may be to monitor a process corresponding to the audio playing application, and determine that the audio playing application executes an operation of reading audio data if the process reads audio data from a preset cache space. The preset buffer space may be a default memory space for storing audio data. And determining the playing state of the audio playing application according to the judgment result. And if the audio playing application executes the operation of reading the audio data, determining that the audio playing application is in a playing state. If the audio playing application does not execute the reading operation of the audio data and the time length of the non-execution of the reading operation exceeds the set threshold, the audio playing application is determined to be in a pause state. The Pause state is a state in which audio data such as a song is paused, and may also be understood as a state in which a Play button in an audio Play application is switched from Play to Pause.
And 120, recording the duration of the pause state when the playing state is the pause state.
Illustratively, when the playing state of the audio playing application is a paused state, starting a first timer, starting timing by the first timer with a time point when a playing button in the audio playing application is switched from Play to Pause as a timing starting point, stopping the first timer when the connection between the intelligent terminal and the external audio equipment is recovered to be normal, and reading the value of the first timer as the duration of the paused state.
It should be noted that the performance that the connection between the intelligent terminal and the external Audio device is restored to normal may be that a line control earphone is inserted into a jack of the intelligent terminal, or that a bluetooth earphone or a bluetooth sound box is connected to the intelligent terminal through A2DP (an Advanced Audio Distribution Profile, a bluetooth Audio transmission model protocol, a specified protocol for transmitting Audio data for the bluetooth device), or that a WiFi sound box is connected to the intelligent terminal.
It should be noted that the preset time threshold is the longest fault-tolerant time during the playing of the audio file, and the preset time threshold is set by default by the system or set by the user according to the actual situation. That is, the pause time of the audio file in the playing pause state due to abnormal connection is recorded, and the pause time is compared with the fault-tolerant time threshold, so as to judge whether the duration time of the pause state does not exceed the preset time threshold.
And if the connection between the intelligent terminal and the external audio equipment is recovered to be normal and the duration time of the pause state does not exceed the preset time threshold, controlling the audio playing application to automatically recover playing. Illustratively, an audio file at the moment when the audio playing application is switched from the playing state to the pause state is obtained, and the audio playing application is controlled to continue playing audio data according to the attribute information of the audio file. The attribute information includes the name and the playing time of the audio file. Further, controlling the audio playing application to play the audio data according to the attribute information may be that the audio playing application reads the audio data from a cache storing the audio file, and the audio data is the target data after the playing time, and plays the target data.
According to the technical scheme of the embodiment, when the connection state of the intelligent terminal and the external audio equipment is the abnormal connection state, the playing state of the currently running audio playing application is obtained; when the playing state is a pause state, recording the duration of the pause state; and if the duration time of the pause state does not exceed the preset time threshold when the connection is recovered to be normal, controlling the audio playing application to play the audio data. By adopting the technical scheme, the time window (namely the preset time threshold) for automatically resuming the playing is set for controlling the audio playing application, so that whether the duration of the pause playing does not exceed the preset time threshold can be detected when the factor causing the abnormal connection between the intelligent terminal and the external audio equipment disappears, if so, the audio playing application is automatically controlled to resume the playing, the user intervention is not needed, and the control intelligence is improved.
Fig. 2 is a flowchart of another method for playing audio data according to an embodiment of the present application. As shown in fig. 2, the method includes:
It should be noted that the headset may be a line-controlled headset.
When detecting that the earphone is inserted into the earphone jack, the intelligent terminal triggers a state detection process to start.
The state detection process detects whether the earphone is pulled out according to a preset period. It should be noted that, there are many ways to query the insertion or extraction of the earphone, for example, defining a broadcastrechiver object, for the wired earphone, listening to the internal action _ hearing _ PLUG system broadcast, and sending out the broadcast when the earphone is inserted or extracted. Thus, whether the earphone is unplugged is determined by detecting whether a broadcast of earphone plugging or unplugging is received.
And 203, determining that the connection state of the intelligent terminal and the earphone is an abnormal connection state.
And when the earphone is detected to be pulled out from the earphone jack, determining that the connection between the intelligent terminal and the earphone is abnormal.
And step 204, acquiring the playing state of the currently running audio playing application.
When the connection state of the intelligent terminal and the earphone is the abnormal connection state, whether the audio playing application running at present reads audio data from a preset cache or not is detected, and the playing state of the audio playing application is judged according to the detection result. For example, if it is detected that the currently running audio playing application reads audio data from the preset cache, it is determined that the audio playing application is in a normal playing state. And if the audio playing application running currently is detected not to read the audio data from the preset cache for a long time, determining that the audio playing application is in a pause state. The long time may be a detection time interval set by the system or a detection time interval set by the user. For example, if it is detected that the currently running audio playing application does not read the audio data from the preset cache, the second timer is started to start timing. And detecting whether the audio playing application reads the audio data from the preset cache or not according to a preset detection period, and if the audio data is not read, continuing to detect. A reading of the second timer is taken and compared to the detection time interval. And if the reading exceeds the detection time interval, determining that the currently running audio playing application does not read the audio data from the preset cache for a long time.
And step 207, stopping the first timer when detecting that the connection between the intelligent terminal and the earphone is recovered to be normal.
In step 208, the value of the first timer is read as the duration of the pause state.
The duration is compared to a preset time threshold. If the duration is less than the predetermined time threshold, step 210 is executed.
The method comprises the steps of obtaining attribute information of an audio file at a preset moment, wherein the preset moment is a moment corresponding to the audio playing application switched from a playing state to a pause state, and the attribute information comprises a file name and a playing progress. And controlling the audio playing application to continue playing the audio file corresponding to the file name according to the playing progress.
And step 211, determining that the connection state of the intelligent terminal and the earphone is a normal connection state.
And determining that the connection state of the intelligent terminal and the earphone is a normal connection state, and normally playing the audio file by the audio playing application.
According to the technical scheme of the embodiment, when the connection between the intelligent terminal and the earphone is abnormal, the playing state of the currently running audio playing application is acquired; when the playing state is a pause state, recording the duration of the pause state; if the connection is recovered to be normal, the duration time of the pause state does not exceed the preset time threshold, the audio playing application is controlled to play the audio data, when the intelligent terminal and the earphone are recovered to be normal, whether the duration time of the pause playing does not exceed the preset time threshold is detected, if yes, the audio playing application is automatically controlled to recover playing, user intervention is not needed, and control intelligence is improved.
Fig. 3 is a flowchart of another method for playing audio data according to an embodiment of the present application. As shown in fig. 3, the method includes:
It should be noted that the bluetooth audio device includes a bluetooth headset, a bluetooth speaker, or the like.
When the intelligent terminal detects that the Bluetooth audio equipment is accessed, the state detection process is triggered to start.
The state detection process detects whether the Bluetooth audio device is accessed according to a preset period. It should be noted that there are many ways to query whether a bluetooth audio device is connected or not, for example, a broadcastereiver object is defined, and for a bluetooth audio device such as a bluetooth headset or a bluetooth speaker, the method monitors a bluetooth headset. Thus, whether the bluetooth device is accessed is determined by detecting whether the broadcast is received.
And step 303, determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is an abnormal connection state.
When the intelligent terminal is disconnected with the Bluetooth audio device, the abnormal connection condition comprises Bluetooth disconnection or A2DP protocol disconnection, and the abnormal connection of the intelligent terminal and the Bluetooth audio device is determined.
And step 304, acquiring the playing state of the currently running audio playing application.
When the connection state of the intelligent terminal and the Bluetooth audio equipment is a connection abnormal state, whether the audio playing application running at present reads audio data from a preset cache or not is detected, and the playing state of the audio playing application is judged according to the detection result. For example, if it is detected that the currently running audio playing application reads audio data from the preset cache, it is determined that the audio playing application is in a normal playing state. And if the audio playing application running currently is detected not to read the audio data from the preset cache for a long time, determining that the audio playing application is in a pause state. For example, if it is detected that the currently running audio playing application does not read the audio data from the preset cache, the second timer is started to start timing. And detecting whether the audio playing application reads the audio data from the preset cache or not according to a preset detection period, and if the audio data is not read, continuing to detect. A reading of the second timer is taken and compared to the detection time interval. If the reading exceeds the detection time interval, determining that the currently running audio playing application does not read the audio data from the preset cache for a long time, and determining that the playing state of the audio playing application is a pause state.
And 307, stopping the first timer when detecting that the connection between the intelligent terminal and the Bluetooth audio device is recovered to be normal.
In step 308, the value of the first timer is read as the duration of the pause state.
Step 309, determining whether the duration time does not exceed a preset time threshold, if so, executing step 310, otherwise, executing step 312.
The duration is compared to a preset time threshold. If the duration is less than the predetermined time threshold, step 310 is executed.
And step 310, controlling the audio playing application to play the audio data.
And 311, determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is a normal connection state.
And determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is a normal connection state, and normally playing the audio file by the audio playing application.
According to the technical scheme of the embodiment, when the intelligent terminal is abnormally connected with the Bluetooth audio equipment, the playing state of the currently running audio playing application is acquired; when the playing state is a pause state, recording the duration of the pause state; if the connection is recovered to be normal, the duration time of the pause state does not exceed the preset time threshold, the audio playing application is controlled to play the audio data, when the intelligent terminal and the Bluetooth audio device are recovered to be normal, whether the duration time of the pause playing does not exceed the preset time threshold is detected, if yes, the audio playing application is automatically controlled to recover playing, user intervention is not needed, and control intelligence is improved.
Fig. 4 is a flowchart of another method for playing audio data according to an embodiment of the present application. As shown in fig. 4, the method includes:
It should be noted that the sound box includes a wired sound box or a WiFi sound box.
When the intelligent terminal detects that the communication connection with the loudspeaker box is established, the state detection process is triggered to start.
The state detection process detects whether a sound box is accessed according to a preset period. It should be noted that, there are many ways to query whether the speaker is connected or not, for example, defining a broadcastrechiver object, monitoring the content.action _ hearing _ PLUG system broadcast, and sending out the broadcast when the PLUG of the cable speaker is plugged in or unplugged from the jack of the smart terminal. Thus, it is determined whether the cable speaker is pulled out by detecting whether the broadcast is received. Similarly, whether WiFi connection is established between the intelligent terminal and the WiFi loudspeaker box or not is judged in a broadcasting mode.
And 403, determining that the connection state of the intelligent terminal and the sound box is an abnormal connection state.
When the intelligent terminal is disconnected with the sound box, the abnormal connection condition comprises WiFi disconnection or looseness of a plug of the intelligent terminal inserted by the wired sound box, and the abnormal connection of the intelligent terminal and the sound box is determined.
When the connection state of the intelligent terminal and the loudspeaker box is the abnormal connection state, whether the currently running audio playing application reads audio data from a preset cache or not is detected, and the playing state of the audio playing application is judged according to the detection result. For example, if it is detected that the currently running audio playing application reads audio data from the preset cache, it is determined that the audio playing application is in a normal playing state. And if the audio playing application running currently is detected not to read the audio data from the preset cache for a long time, determining that the audio playing application is in a pause state. For example, if it is detected that the currently running audio playing application does not read the audio data from the preset cache, the second timer is started to start timing. And detecting whether the audio playing application reads the audio data from the preset cache or not according to a preset detection period, and if the audio data is not read, continuing to detect. A reading of the second timer is taken and compared to the detection time interval. If the reading exceeds the detection time interval, determining that the currently running audio playing application does not read the audio data from the preset cache for a long time, and determining that the playing state of the audio playing application is a pause state.
And 406, detecting whether the sound box is in communication connection with the intelligent terminal, if so, executing 407, otherwise, after waiting for a preset time interval, executing 406.
And 407, stopping the first timer when detecting that the connection between the intelligent terminal and the sound box is recovered to be normal.
The duration is compared to a preset time threshold. If the duration is less than the predetermined time threshold, step 410 is executed.
And step 410, controlling the audio playing application to play audio data.
And 411, determining that the connection state of the intelligent terminal and the sound box is a normal connection state.
And determining that the connection state of the intelligent terminal and the sound box is a normal connection state, and normally playing the audio file by the audio playing application.
In step 412, the audio playback application maintains the state of the audio file that was paused.
According to the technical scheme of the embodiment, when the intelligent terminal is abnormally connected with the sound box, the playing state of the currently running audio playing application is acquired; when the playing state is a pause state, recording the duration of the pause state; if the connection is recovered to be normal, the duration time of the pause state does not exceed the preset time threshold, the audio playing application is controlled to play the audio data, whether the duration time of the pause playing does not exceed the preset time threshold or not can be detected when the intelligent terminal and the loudspeaker box are recovered to be normal, if yes, the audio playing application is automatically controlled to recover playing, user intervention is not needed, and control intelligence is improved.
Fig. 5 is a schematic structural diagram of an apparatus for playing audio data according to an embodiment of the present application. The device can be realized through software and/or hardware, can be integrated in an intelligent terminal such as a smart phone, a tablet computer or a handheld game machine intelligent wearable device, and is used for executing the method for playing audio data provided by the embodiment of the application. As shown in fig. 5, the apparatus includes:
a state obtaining module 510, configured to obtain a playing state of a currently running audio playing application when a connection state of the intelligent terminal and an external audio device is a connection abnormal state;
a time recording module 520, configured to record a duration of the pause state when the play state is the pause state;
and the audio playing module 530 is configured to control the audio playing application to play audio data if it is detected that the connection between the intelligent terminal and the external audio device is restored to normal and the duration of the pause state does not exceed a preset time threshold.
The embodiment of the application provides a device for playing audio data, and the device can detect whether the duration of pause playing does not exceed the preset time threshold or not when a factor causing abnormal connection between an intelligent terminal and external audio equipment disappears by setting a time window (namely the preset time threshold) for automatically resuming playing for controlling audio playing application, and if so, automatically control the audio playing application to resume playing without user intervention, thereby improving control intelligence.
Optionally, the method further includes:
the first detection module is used for triggering a state detection process to detect whether the earphone is pulled out or not according to a preset period when the earphone is inserted into the earphone jack of the intelligent terminal;
if the earphone is detected to be pulled out, determining that the connection state of the intelligent terminal and the earphone is an abnormal connection state;
and if the earphone is not pulled out, determining that the connection state of the intelligent terminal and the earphone is a normal connection state.
Optionally, the method further includes:
the second detection module is used for triggering a state detection process to detect whether the Bluetooth connection is disconnected according to a preset period when the intelligent terminal is detected to be connected with the Bluetooth audio equipment in a Bluetooth mode;
if so, determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is an abnormal connection state;
otherwise, determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is a normal connection state.
Optionally, the method further includes:
the third detection module is used for triggering a state detection process to detect whether the communication connection is disconnected according to a preset period when the intelligent terminal is detected to be in communication connection with the sound box;
if so, determining that the connection state of the intelligent terminal and the sound box is an abnormal connection state;
otherwise, determining that the connection state of the intelligent terminal and the sound box is a normal connection state.
Optionally, the state obtaining module 510 is specifically configured to:
acquiring an application identifier of a currently running application program, and judging whether the application program is an audio playing application or not according to the application identifier;
if so, judging whether the audio playing application executes the operation of reading the audio data, and determining the playing state of the audio playing application according to the judgment result.
Optionally, the time recording module 520 is specifically configured to:
when the playing state is a pause state, starting a timer, stopping the timer when detecting that the connection between the intelligent terminal and the external audio equipment is recovered to be normal, and reading the value of the timer as the duration time of the pause state;
and, after recording the duration of the suspended state, further comprising:
and judging whether the duration time does not exceed a preset time threshold.
Optionally, the audio playing module 530 is specifically configured to:
acquiring attribute information of an audio file at a preset moment, wherein the preset moment is a moment corresponding to the switching of the audio playing application from a playing state to a pause state;
and controlling the audio playing application to play audio data according to the attribute information.
Embodiments of the present application also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method of playing audio data, the method comprising:
when the connection state of the intelligent terminal and the external audio equipment is a connection abnormal state, acquiring the playing state of the currently running audio playing application;
when the playing state is a pause state, recording the duration of the pause state;
and if the connection between the intelligent terminal and the external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold, controlling the audio playing application to play audio data.
Storage medium-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk, or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Lanbas (Rambus) RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network (such as the internet). The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations, such as in different computer systems that are connected by a network. The storage medium may store program instructions (e.g., embodied as a computer program) that are executable by one or more processors.
Of course, the storage medium provided in the embodiments of the present application contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of playing audio data as described above, and may also perform related operations in the method of playing audio data provided in any embodiments of the present application.
The embodiment of the application provides an intelligent terminal, an operating system is arranged in the intelligent terminal, and the device for playing audio data provided by the embodiment of the application can be integrated in the intelligent terminal. The intelligent terminal can be a smart phone, a PAD (PAD), an intelligent wearable device and the like. Fig. 6 is a schematic structural diagram of an intelligent terminal according to an embodiment of the present application. As shown in fig. 6, the smart terminal includes a memory 610 and a processor 620. The memory 610 is used for storing a computer program, a connection state of the intelligent terminal and external audio equipment, a playing state, duration of a pause state, audio data and the like; the processor 620 reads and executes the computer programs stored in the memory 610. The processor 620, when executing the computer program, performs the steps of: when the connection state of the intelligent terminal and the external audio equipment is a connection abnormal state, acquiring the playing state of the currently running audio playing application; when the playing state is a pause state, recording the duration of the pause state; and if the connection between the intelligent terminal and the external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold, controlling the audio playing application to play audio data.
The memory and the processor listed in the above examples are all part of components of the intelligent terminal, and the intelligent terminal may further include other components. Taking a smart phone as an example, a possible structure of the smart terminal is described. Fig. 7 is a block diagram of a smart phone according to an embodiment of the present application. As shown in fig. 7, the smart phone may include: memory 701, a Central Processing Unit (CPU) 702 (also known as a processor, hereinafter CPU), a peripheral interface 703, a Radio Frequency (RF) circuit 705, an audio circuit 706, a speaker 711, a touch screen 712, a power management chip 708, an input/output (I/O) subsystem 709, other input/control devices 710, and an external port 704, which communicate via one or more communication buses or signal lines 707.
It should be understood that the illustrated smartphone 700 is merely one example of a smart terminal, and that the smartphone 700 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
The following describes the smart phone integrated with the device for playing audio data according to the present embodiment in detail.
A memory 701, the memory 701 being accessible by the CPU702, the peripheral interface 703, and the like, the memory 701 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic disk storage devices, flash memory devices, or other volatile solid state storage devices. The memory 701 stores a computer program, and may also store a connection state, a play state, a duration of a pause state, audio data, and the like of the smart terminal and an external audio device.
A peripheral interface 703, said peripheral interface 703 may connect input and output peripherals of the device to the CPU702 and the memory 701.
An I/O subsystem 709, which I/O subsystem 709 may connect input and output peripherals on the device, such as a touch screen 712 and other input/control devices 710, to the peripheral interface 703. The I/O subsystem 709 may include a display controller 7091 and one or more input controllers 7092 for controlling other input/control devices 710. Where one or more input controllers 7092 receive electrical signals from or transmit electrical signals to other input/control devices 710, the other input/control devices 710 may include physical buttons (push buttons, rocker buttons, etc.), dials, slide switches, joysticks, click wheels. It is worth noting that the input controller 7092 may be connected to any one of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
A touch screen 712, the touch screen 712 being an input interface and an output interface between the user terminal and the user, displaying visual output to the user, which may include graphics, text, icons, video, and the like.
The display controller 7091 in the I/O subsystem 709 receives electrical signals from the touch screen 712 or transmits electrical signals to the touch screen 712. The touch screen 712 detects a contact on the touch screen, and the display controller 7091 converts the detected contact into an interaction with a user interface object displayed on the touch screen 712, i.e., implements a human-computer interaction, and the user interface object displayed on the touch screen 712 may be an icon for running a game, an icon networked to a corresponding network, or the like. It is worth mentioning that the device may also comprise a light mouse, which is a touch sensitive surface that does not show visual output, or an extension of the touch sensitive surface formed by the touch screen.
The RF circuit 705 is mainly used to establish communication between the mobile phone and the wireless network (i.e., network side), and implement data reception and transmission between the mobile phone and the wireless network. Such as sending and receiving short messages, e-mails, etc. In particular, RF circuitry 705 receives and transmits RF signals, also referred to as electromagnetic signals, through which RF circuitry 705 converts electrical signals to or from electromagnetic signals and communicates with communication networks and other devices. RF circuitry 705 may include known circuitry for performing these functions including, but not limited to, an antenna system, an RF transceiver, one or more amplifiers, a tuner, one or more oscillators, a digital signal processor, a CODEC (CODEC) chipset, a Subscriber Identity Module (SIM), and so forth.
The audio circuit 706 is mainly used to receive audio data from the peripheral interface 703, convert the audio data into an electric signal, and transmit the electric signal to the speaker 711.
The speaker 711 is used to convert the voice signal received by the handset from the wireless network through the RF circuit 705 into sound and play the sound to the user.
And a power management chip 708 for supplying power and managing power to the hardware connected to the CPU702, the I/O subsystem, and the peripheral interface.
According to the intelligent terminal provided by the embodiment of the application, the time window (namely the preset time threshold) for automatically resuming playing is set for controlling the audio playing application, so that whether the duration of the pause playing does not exceed the preset time threshold can be detected when the factor causing abnormal connection between the intelligent terminal and external audio equipment disappears, if so, the audio playing application is automatically controlled to resume playing, the user intervention is not needed, and the control intelligence is improved.
The device, the storage medium and the intelligent terminal for playing the audio data provided in the above embodiments can execute the method for playing the audio data provided in any embodiment of the present application, and have corresponding functional modules and beneficial effects for executing the method. For technical details not described in detail in the above embodiments, reference may be made to a method for playing audio data provided in any embodiment of the present application.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. It will be understood by those skilled in the art that the present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims (10)
1. A method of playing audio data, comprising:
when the connection state of the intelligent terminal and the external audio equipment is a connection abnormal state, acquiring the playing state of the currently running audio playing application;
when the playing state is a Pause state, starting a first timer, starting timing by using the time when a playing button is switched from Play to Pause in the audio playing application as a timing starting point, stopping the first timer when the connection between the intelligent terminal and external audio equipment is recovered to be normal, and reading the value of the first timer as the duration time of the Pause state;
and if the connection between the intelligent terminal and the external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold, controlling the audio playing application to play audio data.
2. The method of claim 1, further comprising:
when detecting that an earphone is inserted into an earphone jack of the intelligent terminal, triggering a state detection process to detect whether the earphone is pulled out or not according to a preset period;
if the earphone is detected to be pulled out, determining that the connection state of the intelligent terminal and the earphone is an abnormal connection state;
and if the earphone is not pulled out, determining that the connection state of the intelligent terminal and the earphone is a normal connection state.
3. The method of claim 1, further comprising:
when the situation that the intelligent terminal establishes Bluetooth connection with Bluetooth audio equipment is detected, a state detection process is triggered to detect whether the Bluetooth connection is disconnected or not according to a preset period;
if so, determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is an abnormal connection state;
otherwise, determining that the connection state of the intelligent terminal and the Bluetooth audio equipment is a normal connection state.
4. The method of claim 1, further comprising:
when the intelligent terminal is detected to be in communication connection with the sound box, triggering a state detection process to detect whether the communication connection is disconnected according to a preset period;
if so, determining that the connection state of the intelligent terminal and the sound box is an abnormal connection state;
otherwise, determining that the connection state of the intelligent terminal and the sound box is a normal connection state.
5. The method of claim 1, wherein obtaining the playing status of the currently running audio playing application comprises:
acquiring an application identifier of a currently running application program, and judging whether the application program is an audio playing application or not according to the application identifier;
if so, judging whether the audio playing application executes the operation of reading the audio data, and determining the playing state of the audio playing application according to the judgment result.
6. The method of claim 1, wherein recording the duration of the pause state when the play state is the pause state comprises:
when the playing state is a pause state, starting a timer, stopping the timer when detecting that the connection between the intelligent terminal and the external audio equipment is recovered to be normal, and reading the value of the timer as the duration time of the pause state;
and, after recording the duration of the suspended state, further comprising:
and judging whether the duration time does not exceed a preset time threshold.
7. The method of any of claims 1 to 6, wherein controlling the audio playback application to play back audio data comprises:
acquiring attribute information of an audio file at a preset moment, wherein the preset moment is a moment corresponding to the switching of the audio playing application from a playing state to a pause state;
and controlling the audio playing application to play audio data according to the attribute information.
8. An apparatus for playing audio data, comprising:
the state acquisition module is used for acquiring the playing state of the currently running audio playing application when the connection state of the intelligent terminal and the external audio equipment is the abnormal connection state;
the time recording module is used for starting a first timer when the playing state is the Pause state, starting timing by the first timer by taking the time when a playing button is switched from Play to Pause in the audio playing application as a timing starting point, stopping the first timer when the connection between the intelligent terminal and external audio equipment is recovered to be normal, and reading the value of the first timer as the duration time of the Pause state;
and the audio playing module is used for controlling the audio playing application to play audio data if the connection between the intelligent terminal and external audio equipment is detected to be recovered to be normal and the duration time of the pause state does not exceed a preset time threshold.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of playing audio data according to any one of claims 1 to 7.
10. An intelligent terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of playing audio data according to any of claims 1 to 7 when executing the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810316091.8A CN108509176B (en) | 2018-04-10 | 2018-04-10 | Method and device for playing audio data, storage medium and intelligent terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810316091.8A CN108509176B (en) | 2018-04-10 | 2018-04-10 | Method and device for playing audio data, storage medium and intelligent terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108509176A CN108509176A (en) | 2018-09-07 |
CN108509176B true CN108509176B (en) | 2021-06-08 |
Family
ID=63381399
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810316091.8A Active CN108509176B (en) | 2018-04-10 | 2018-04-10 | Method and device for playing audio data, storage medium and intelligent terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108509176B (en) |
Families Citing this family (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2020072430A (en) * | 2018-11-01 | 2020-05-07 | 本田技研工業株式会社 | Portable terminal and program |
CN112997507B (en) * | 2018-11-21 | 2022-12-09 | 深圳市欢太科技有限公司 | Audio system control method, device, terminal and computer readable storage medium |
WO2020113525A1 (en) * | 2018-12-06 | 2020-06-11 | 深圳市欢太科技有限公司 | Playing control method and apparatus, and computer-readable storage medium and electronic device |
CN111339351B (en) * | 2018-12-19 | 2023-08-11 | 成都鼎桥通信技术有限公司 | Audio playing method in Android system |
CN110297705B (en) * | 2019-06-27 | 2021-12-14 | 百度在线网络技术(北京)有限公司 | Function switching processing method, device, equipment and storage medium |
CN113129902B (en) * | 2019-12-30 | 2023-10-24 | 北京猎户星空科技有限公司 | Voice processing method and device, electronic equipment and storage medium |
CN111078186A (en) * | 2019-12-31 | 2020-04-28 | 维沃移动通信有限公司 | Playing method and electronic equipment |
CN111580776B (en) * | 2020-04-28 | 2023-07-21 | 广州市百果园信息技术有限公司 | Audio function recovery method, device, terminal and storage medium |
CN113849241A (en) * | 2020-06-10 | 2021-12-28 | Oppo(重庆)智能科技有限公司 | Audio playing control method, intelligent watch and device with storage function |
CN112000261B (en) * | 2020-07-23 | 2022-07-01 | 北京达佳互联信息技术有限公司 | Player control method and device, server and electronic equipment |
CN114827797A (en) * | 2021-01-21 | 2022-07-29 | 北京轩辕联科技有限公司 | In-vehicle multi-audio playing method and device based on earphone and storage medium |
CN113271577B (en) * | 2021-04-13 | 2022-04-22 | 荣耀终端有限公司 | Media data playing system, method and related device |
CN115359810A (en) * | 2022-08-11 | 2022-11-18 | 维沃移动通信有限公司 | Data processing method, device and readable storage medium |
CN117040677B (en) * | 2023-09-15 | 2024-06-14 | 深圳旷世科技有限公司 | Synchronization method, synchronization device and equipment for multichannel data transmission |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101304269A (en) * | 2008-06-26 | 2008-11-12 | 宇龙计算机通信科技(深圳)有限公司 | Method and terminal for implementing bluetooth play |
CN101887735A (en) * | 2009-05-12 | 2010-11-17 | 爱克发医疗保健公司 | Audio recording method |
CN104010071A (en) * | 2013-02-26 | 2014-08-27 | 三星电子株式会社 | Application control method and apparatus for mobile terminal, earphone device and application control system |
CN106126158A (en) * | 2016-06-15 | 2016-11-16 | 北京小米移动软件有限公司 | A kind of method and apparatus of playing audio-fequency data |
CN106325805A (en) * | 2016-08-17 | 2017-01-11 | 北京小米移动软件有限公司 | Audio playing method and audio playing device |
CN106407792A (en) * | 2016-09-26 | 2017-02-15 | 广东欧珀移动通信有限公司 | Method for controlling mobile terminal and sound box |
-
2018
- 2018-04-10 CN CN201810316091.8A patent/CN108509176B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101304269A (en) * | 2008-06-26 | 2008-11-12 | 宇龙计算机通信科技(深圳)有限公司 | Method and terminal for implementing bluetooth play |
CN101887735A (en) * | 2009-05-12 | 2010-11-17 | 爱克发医疗保健公司 | Audio recording method |
CN104010071A (en) * | 2013-02-26 | 2014-08-27 | 三星电子株式会社 | Application control method and apparatus for mobile terminal, earphone device and application control system |
CN106126158A (en) * | 2016-06-15 | 2016-11-16 | 北京小米移动软件有限公司 | A kind of method and apparatus of playing audio-fequency data |
CN106325805A (en) * | 2016-08-17 | 2017-01-11 | 北京小米移动软件有限公司 | Audio playing method and audio playing device |
CN106407792A (en) * | 2016-09-26 | 2017-02-15 | 广东欧珀移动通信有限公司 | Method for controlling mobile terminal and sound box |
Also Published As
Publication number | Publication date |
---|---|
CN108509176A (en) | 2018-09-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108509176B (en) | Method and device for playing audio data, storage medium and intelligent terminal | |
CN108810749B (en) | Player control method, device, terminal equipment and storage medium | |
CN107889092B (en) | Bluetooth device communication control method, device, terminal device and storage medium | |
CN108024128B (en) | Control method and device for Bluetooth music playing, terminal equipment and storage medium | |
CA2740581C (en) | System and method for resuming media | |
CN108153647B (en) | Log processing method and device, terminal equipment and storage medium | |
CN108038231B (en) | Log processing method and device, terminal equipment and storage medium | |
WO2017181708A1 (en) | Audio switching method and device for terminal, and electronic device | |
KR101512918B1 (en) | System timeout reset based on media detection | |
CN106713653B (en) | Audio and video playing control method and device and terminal | |
US9179215B2 (en) | Electronic device, accessory, and method for detecting an accessory | |
CN110784858B (en) | Bluetooth device control method and device, electronic device and storage medium | |
CN105430547A (en) | Dormancy method and apparatus of bluetooth earphones | |
CN107831886B (en) | Control method and device for associated starting application, storage medium and intelligent terminal | |
CN108093451B (en) | Random access control method, device, storage medium and mobile terminal | |
CN107844341B (en) | Process starting control method and device, storage medium and mobile terminal | |
CN111193978A (en) | Charging box control method, earphone charging box and computer readable storage medium | |
CN103631613A (en) | Terminal unlocking and program running triggering method | |
CN109165114B (en) | Application program no-response processing method and device, storage medium and intelligent terminal | |
CN104539999A (en) | Multimedia data sharing method and terminal | |
CN102830943B (en) | Method and system for playing multimedia files in external USB (universal serial bus) storage on the basis of Android platform | |
CN107885588B (en) | Application service control method and device, storage medium and mobile terminal | |
CN110730948A (en) | Volume adjusting method and device, storage medium and mobile terminal | |
CN110989816B (en) | Application processing method and device and storage medium | |
CN111988693B (en) | Earphone control method and system based on earphone charging box and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |