Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a schematic flowchart of a method for playing web page audio according to an embodiment of the present invention.
As shown in fig. 1, a method for playing web page audio includes the following steps:
importing an Audio component and an Audio control instruction, and initializing the Audio component to obtain an initialized Audio component;
acquiring an audio file through a web page, and splitting the audio file to obtain an uplink audio file and a downlink audio file;
and controlling the initialized Audio assembly to analyze Audio playing of the uplink Audio file and/or the downlink Audio file according to the Audio control instruction to obtain an Audio playing result.
It should be understood that the Audio component may be an Audio player.
It should be understood that the Audio component is an Audio player loaded with a web page for subsequent Audio playback through an html web page display player interface.
Specifically, the initialization refers to display initialization of buttons for displaying an interface of an Audio play control (i.e., the Audio component), such as length, width, height, position, and the like, displaying a play time, pausing, playing, synchronizing, and the like.
It should be understood that obtaining the audio file through the web page means downloading the audio file by means of a file stream using an http connection of the web page, connecting to a specified audio file address.
It should be understood that the file (i.e., the audio file) is split up and down using existing conventional audio splitting techniques, splitting into two audio files, i.e., the up audio file and the down audio file.
In the above embodiment, the initialized Audio component is obtained by initializing the Audio component, the uplink Audio file and the downlink Audio file are obtained by splitting the Audio file, and the initialized Audio component is controlled to perform Audio playing analysis on the uplink Audio file and/or the downlink Audio file according to the Audio control instruction to obtain an Audio playing result, so that the problem that the Audio can be independently played in uplink and downlink is solved, the requirements of a user are met, and the practicability of the Audio player is improved.
Optionally, as an embodiment of the present invention, the process of controlling the initialized Audio component to perform Audio playing analysis on the uplink Audio file and/or the downlink Audio file according to the Audio control instruction to obtain an Audio playing result includes:
if the Audio control instruction is a first Audio control instruction, controlling the initialized Audio component to play the uplink Audio file and the downlink Audio file according to the first Audio control instruction to obtain a first Audio playing result, and taking the first Audio playing result as an Audio playing result;
if the Audio control instruction is a second Audio control instruction, controlling the initialized Audio component to play the uplink Audio file according to the second Audio control instruction to obtain a second Audio playing result, and taking the second Audio playing result as an Audio playing result;
and if the Audio control instruction is a third Audio control instruction, controlling the initialized Audio component to play the downlink Audio file according to the third Audio control instruction to obtain a third Audio playing result, and taking the third Audio playing result as an Audio playing result.
In the above embodiment, the Audio control instruction controls the initialized Audio component to perform Audio playing analysis on the uplink Audio file and/or the downlink Audio file to obtain an Audio playing result, so that uplink and downlink Audio can be played according to requirements, the problem that the Audio can be played independently in uplink and downlink is solved, the requirements of users are met, and the practicability of the Audio player is improved.
Optionally, as an embodiment of the present invention, the initialized Audio component includes an upstream Audio component and a downstream Audio component, and the process of controlling the initialized Audio component to play the upstream Audio file and the downstream Audio file according to the first Audio control instruction to obtain a first Audio playing result includes:
controlling the uplink Audio component to play the uplink Audio file according to the first Audio control instruction to obtain an uplink Audio playing result,
controlling the downlink Audio component to play the downlink Audio file according to the first Audio control instruction to obtain a downlink Audio playing result;
and taking the uplink audio playing result and the downlink audio playing result as a first audio playing result.
It should be understood that the initialized Audio component includes an upstream playing control and a downstream playing control, which are composed of a self-contained Audio player of a web page, that is, two Audio playing controls (that is, the upstream Audio component and the downstream Audio component) for playing corresponding Audio files (that is, the upstream Audio file and the downstream Audio file), and the Audio files (that is, the upstream Audio file and the downstream Audio file) can be dragged to a specified position for playing in a playing process.
Specifically, the initialized Audio component comprises two Audio controls carried by the web pages, one Audio control (i.e., the uplink Audio component) plays an uplink Audio (i.e., the uplink Audio file), one Audio control (i.e., the downlink Audio component) plays a downlink Audio (i.e., the downlink Audio file), the total duration of the Audio is respectively and synchronously displayed, the played duration is displayed, the Audio playing duration is displayed, the display duration is 0:00 and is less than 60 seconds, the display duration is 0:58 and is greater than one minute, the display duration is 01:30 seconds, the left side is minutes, and the right side is seconds, wherein the display duration is 0:00 and is less than 60 seconds, the display duration is 58 seconds.
In the above embodiment, the first Audio control instruction controls the uplink Audio component to play the uplink Audio file to obtain the uplink Audio playing result, the first Audio control instruction controls the downlink Audio component to play the downlink Audio file to obtain the downlink Audio playing result, and the uplink Audio playing result and the downlink Audio playing result are taken as the first Audio playing result, so that uplink and downlink Audio can be synchronized, the requirements of a user are met, and the practicability of the Audio player is improved.
Optionally, as an embodiment of the present invention, the step of controlling the initialized Audio component to play the uplink Audio file according to the second Audio control instruction to obtain a second Audio playing result includes:
and controlling the uplink Audio assembly to play the uplink Audio file according to the second Audio control instruction to obtain a second Audio playing result.
In the above embodiment, the uplink Audio component is controlled by the second Audio control instruction to play the uplink Audio file to obtain the second Audio playing result, so that the problem that the Audio can be played independently in the uplink and the downlink is solved, the requirements of users are met, and the practicability of the Audio player is improved.
Optionally, as an embodiment of the present invention, the step of controlling the initialized Audio component to play the downlink Audio file according to the third Audio control instruction to obtain a third Audio playing result includes:
and controlling the downlink Audio component to play the downlink Audio file according to the third Audio control instruction to obtain a third Audio playing result.
In the above embodiment, the downlink Audio component is controlled by the third Audio control instruction to play the downlink Audio file to obtain the third Audio playing result, so that the problem that the Audio can be played independently in the uplink and the downlink is solved, the requirements of users are met, and the practicability of the Audio player is improved.
Optionally, as another embodiment of the present invention, a client is opened at a web page end, an Audio player (i.e., the initialized Audio component) is loaded on the web page, the Audio file is downloaded from a server and split by using a web conventional http network request technology, and the two split Audio files (i.e., the upstream Audio file and the downstream Audio file) are played by the Audio player (i.e., the initialized Audio component).
The opening of the client at the web page end refers to the opening of the client by accessing items through a computer browser (a general browser such as google and dog search).
Loading an Audio player (i.e. the initialized Audio component) on a webpage, which means loading the Audio player carried by the webpage through an html webpage display player interface so as to perform subsequent Audio playing, wherein the Audio playing comprises upper Audio playing alone or lower Audio playing alone or upper and lower Audio playing simultaneously; loading the Audio player (i.e., the initialized Audio component) further comprises: the system comprises an upstream player and a downstream player (namely the upstream Audio component and the downstream Audio component), wherein each player (namely the upstream Audio component or the downstream Audio component) consists of a single Audio, each player (namely the upstream Audio component or the downstream Audio component) has play/pause, fast and slow play, and a play speed scale adjustment unit value is 0.25. The player (i.e., the upstream Audio component or the downstream Audio component) includes play, pause, acceleration, deceleration, synchronization, Audio duration display, and Audio waveform diagram display, where the Audio duration display uses a display duration of 0:00, is less than 60 seconds, such as 58 seconds to display 0:58, is greater than one minute, such as 90 seconds to display 01:30 seconds, the left side is minutes, and the right side is seconds.
The method comprises the steps of downloading an audio file from a server by using a web conventional http network request technology, wherein the conventional http network address configuration, parameter configuration, IP address configuration, downloading logic processing configuration and the like are included, the audio file is downloaded locally, the file (namely the audio file) is split up and down by using the conventional audio splitting technology, the audio file is split into an uplink audio file and a downlink audio file (namely the uplink audio file and the downlink audio file), and whether the uplink audio file and the downlink audio file exist simultaneously or not is judged after the audio file is split.
Optionally, as another embodiment of the present invention, the play control (i.e., the initialized Audio component) may perform synchronous or asynchronous selection (i.e., the first Audio control instruction, the second Audio control instruction, or the third Audio control instruction), and be controlled by the synchronization button, when asynchronous selection (i.e., the second Audio control instruction or the third Audio control instruction) is performed, each individual play control (i.e., the uplink Audio component or the downlink Audio component) is displayed, and each play control (i.e., the uplink Audio component or the downlink Audio component) displays a pause/play button for playing the decoded split uplink and downlink two audios (i.e., the uplink Audio file and the downlink Audio file), respectively. When synchronous playing (namely a first Audio control instruction) is selected, an upper Audio player and a lower Audio player (namely the uplink Audio component and the downlink Audio component) respectively play an upper Audio file and a lower Audio file (namely the uplink Audio file and the downlink Audio file) which are decoded and split, a single player (namely the uplink Audio component or the downlink Audio component) cannot be independently and respectively operated under a synchronous state (namely the first Audio control instruction), and only two players (namely the uplink Audio component and the downlink Audio component) can be synchronously and simultaneously operated, namely a progress bar is synchronously paused, synchronously played and synchronously dragged to a fixed position player.
Fig. 2 is a block diagram of a webpage audio playing apparatus according to an embodiment of the present invention.
Optionally, as another embodiment of the present invention, as shown in fig. 2, an audio playing apparatus for a web page includes:
the device comprises an assembly initialization module, a control module and a control module, wherein the assembly initialization module is used for importing an Audio assembly and an Audio control instruction and initializing the Audio assembly to obtain an initialized Audio assembly;
the audio splitting module is used for obtaining an audio file through a web page and splitting the audio file to obtain an uplink audio file and a downlink audio file;
and the Audio playing result obtaining module is used for controlling the initialized Audio assembly to carry out Audio playing analysis on the uplink Audio file and/or the downlink Audio file according to the Audio control instruction to obtain an Audio playing result.
Optionally, as an embodiment of the present invention, the audio playing result obtaining module is specifically configured to:
if the Audio control instruction is a first Audio control instruction, controlling the initialized Audio component to play the uplink Audio file and the downlink Audio file according to the first Audio control instruction to obtain a first Audio playing result, and taking the first Audio playing result as an Audio playing result;
if the Audio control instruction is a second Audio control instruction, controlling the initialized Audio component to play the uplink Audio file according to the second Audio control instruction to obtain a second Audio playing result, and taking the second Audio playing result as an Audio playing result;
and if the Audio control instruction is a third Audio control instruction, controlling the initialized Audio component to play the downlink Audio file according to the third Audio control instruction to obtain a third Audio playing result, and taking the third Audio playing result as an Audio playing result.
Optionally, as an embodiment of the present invention, the initialized Audio component includes an upstream Audio component and a downstream Audio component, and the Audio playing result obtaining module is further configured to:
controlling the uplink Audio component to play the uplink Audio file according to the first Audio control instruction to obtain an uplink Audio playing result,
controlling the downlink Audio component to play the downlink Audio file according to the first Audio control instruction to obtain a downlink Audio playing result;
and taking the uplink audio playing result and the downlink audio playing result as a first audio playing result.
Optionally, another embodiment of the present invention provides a web page audio playing apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the web page audio playing method as described above is implemented. The device may be a computer or the like.
Alternatively, another embodiment of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the web page audio playing method as described above.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.