Audio playing method, device, equipment, medium and product

By creating different page player objects according to the system type, the problem of poor audio playback compatibility in the H5 mobile application nested by WebView is solved, and a stable and consistent audio playback effect is achieved.

CN119620998AActive Publication Date: 2025-03-14AGRICULTURAL BANK OF CHINA
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202411676404.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-14
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

In H5 mobile applications nested through WebView, when playing audio through audio tags, there is a problem of poor compatibility, resulting in inconsistent audio playback effects under different operating system versions.

Method used

By obtaining the system type corresponding to the audio player, create a target page player object and play the audio to be played based on the object. For iOS, create audio tags and set up monitoring events; for Android, create audioContext instances and generate audio head nodes, decode and splice audio data to form an audio source.

Benefits of technology

It solves the problem of poor audio playback compatibility under different operating systems, and achieves stable and consistent audio playback effects in H5 mobile applications nested by WebView.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119620998A_ABST
    Figure CN119620998A_ABST
Patent Text Reader

Abstract

The invention discloses an audio playing method, device and equipment, a medium and a product. The method comprises the following steps: acquiring a system type corresponding to an audio player; and creating a target page player object according to the system type, and playing a to-be-played audio based on the target page player object. According to the technical scheme, the technical problem that in H5 mobile terminal application nested through WebView, the playing compatibility is poor when audios are played through audio tags for different operating systems can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of audio playback technology, and in particular to an audio playback method, device, equipment, medium and product. Background Art

[0002] With the development of data network and wireless network technology, the use of mobile terminals has become indispensable, and audio and video playback has also penetrated into all aspects of technological life, such as new media, digital humans, metaverse and many other application fields. Moreover, since the mini-program mode can provide users with a more convenient user experience, integrating mini-program applications in major APPs (Applications) has become the current mainstream APP operation mode. Therefore, nesting H5 (HTML5, Hyper Text Markup Language5, the fifth edition of Hypertext Markup Language, the browser uses H5 to achieve code visualization) applications in WebView (a component used to display web content in an application, which allows developers to embed a complete web browser function in their own applications) has also become a mainstream development mode.

[0003] However, under this development model, the technical means of achieving audio playback mainly through the audio tag (used to embed audio content in H5, supporting the playback of audio files in multiple formats such as mp3 and wav) still have the problem of poor compatibility. For the mini-program applications integrated in major APPs, that is, the H5 applications nested in WebView, the audio playback effects show completely different problems under different mobile system versions: for the iOS (iPhone Operating System) system, some system versions show that it is only played once, and some system versions show that it is played normally; for the Android system, some system versions show that it cannot be played, and some system versions show that it is played normally. Audio playback is an indispensable part in fields such as artificial intelligence, such as speech synthesis, voice question and answer and other functions. Therefore, there is an urgent need for an audio playback method based on H5 applications nested in WebView to solve the above problems. Summary of the invention

[0004] The embodiments of the present invention provide an audio playback method, device, equipment, medium and product to solve the technical problem of poor playback compatibility when playing audio through audio tags for different operating systems in an H5 mobile application nested by WebView.

[0005] According to one aspect of the present invention, there is provided an audio playing method, comprising:

[0006] Get the system type corresponding to the audio player;

[0007] A target page player object is created according to the system type, and the audio to be played is played based on the target page player object.

[0008] In some embodiments of the present invention, creating a target page player object according to the system type, and playing the audio to be played based on the target page player object includes:

[0009] If the system type is the first operating system, a first page player object is created, and a monitoring event is set for the first page player object, and when it is monitored that the loading of the audio to be played is completed, the audio to be played is played;

[0010] If the system type is the second operating system, a second page player object is created, and an audio head node is created for the second page player object. The audio to be played is decoded and spliced ​​to the audio head node to obtain an audio source, and the audio source is played.

[0011] In some embodiments of the present invention, after creating the first page player object, the method further includes:

[0012] Obtain the audio to be played, and obtain the source type of the audio to be played;

[0013] If the source type of the audio to be played is a local audio file, the audio to be played is introduced into the play page, and the audio to be played is assigned to the target attribute of the first page player object;

[0014] If the source type of the audio to be played is a downloaded audio stream, the audio to be played is converted into target data, and a downloadable link is created according to the target data, and the downloadable link is assigned to the target attribute of the first page player object.

[0015] In some embodiments of the present invention, creating a second page player object, creating an audio head node for the second page player object, decoding the audio to be played and splicing it to the audio head node to obtain an audio source, and playing the audio source includes:

[0016] Create a second page player object, and create an audio head node and an audio tail node for the second page player object;

[0017] Acquire the audio to be played, and convert the audio to be played into a target object;

[0018] Decoding the target object and splicing the decoded data to the audio head node;

[0019] The audio head node is connected to the audio tail node to obtain an audio source, and the audio source is played.

[0020] In some embodiments of the present invention, obtaining audio to be played includes:

[0021] If the source type of the audio to be played is a local audio file, the audio to be played is imported, and an audio stream is obtained through a target request;

[0022] If the source type of the audio to be played is a downloaded audio stream, the audio stream is obtained through the target request.

[0023] In some embodiments of the present invention, after creating the first page player object, the method further includes:

[0024] Set the control properties of the first page player object and display the audio control panel.

[0025] According to another aspect of the present invention, there is provided an audio playback device, the device comprising:

[0026] An acquisition module is used to obtain the system type corresponding to the audio player;

[0027] The creation and playing module is used to create a target page player object according to the system type, and play the audio to be played based on the target page player object.

[0028] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0029] at least one processor; and

[0030] a memory communicatively connected to the at least one processor; wherein,

[0031] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the audio playback method described in any embodiment of the present invention.

[0032] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the audio playback method described in any embodiment of the present invention when executed.

[0033] According to another aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the audio playback method described in any embodiment of the present invention is implemented.

[0034] The embodiment of the present invention obtains the system type corresponding to the audio player, creates a target page player object according to the system type, and plays the audio to be played based on the target page player object. The technical solution of the present invention can solve the technical problem of poor playback compatibility when playing audio through the audio tag for different operating systems in an H5 mobile application nested by WebView.

[0035] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0037] Figure 1 is a flow chart of an audio playback method in an embodiment of the present invention;

[0038] Figure 2 is a structural schematic diagram of an audio playback device in an embodiment of the present invention;

[0039] Figure 3 It is a structural schematic diagram of an electronic device for implementing the audio playing method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0041] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and their meanings are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0042] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0043] Embodiment 1

[0044] Figure 1 is a flow chart of an audio playback method in an embodiment of the present invention. This embodiment is applicable to audio playback. The method can be executed by an audio playback device in an embodiment of the present invention. The device can be implemented in software and / or hardware. Figure 1 As shown, the method specifically comprises the following steps:

[0045] S101. Obtain the system type corresponding to the audio player.

[0046] In this embodiment, the audio player can be, for example, an audio player of an H5 mobile application nested in WebView, that is, an audio player of a mini-program application integrated in each major APP.

[0047] Exemplarily, the system type can be divided into iOS system and Android system. In actual operation, the H5 application needs to first determine whether the current system environment of the container is iOS or Android. For different system types, the embodiment of the present invention adopts different audio playback methods.

[0048] S102: Create a target page player object according to the system type, and play the audio to be played based on the target page player object.

[0049] In this embodiment, the target page player object can be an object created on the H5 page to successfully play audio. Exemplarily, for the iOS system, to achieve audio playback, you first need to create an audio tag on the H5 page, and this audio tag is the target page player object corresponding to the iOS system; for the Android system, to achieve audio playback, you first need to create an audioContext (the core of the Web Audio API, which provides an audio processing and playback interface that can create and connect various audio sources, processors, and outputters. Among them, the Web Audio API is a powerful Web standard for processing and synthesizing audio on web pages. It provides an advanced, cross-platform audio processing capability that allows developers to implement complex audio effects in the browser, such as mixing, sound effect processing, audio analysis, etc.) instance on the H5 page, and this audioContext instance is the target page player object corresponding to the Android system.

[0050] The audio to be played may be audio data to be played selected by a user. Exemplarily, the audio to be played may be a local audio file or an audio stream downloaded from a server.

[0051] Specifically, for different system types, different page player objects are created, and the audio to be played is played based on the created target page player object to complete the audio playback operation.

[0052] The embodiment of the present invention obtains the system type corresponding to the audio player, creates a target page player object according to the system type, and plays the audio to be played based on the target page player object. The technical solution of the present invention can solve the technical problem of poor playback compatibility when playing audio through the audio tag for different operating systems in an H5 mobile application nested by WebView.

[0053] Optionally, a target page player object is created according to the system type, and the audio to be played is played based on the target page player object, including:

[0054] If the system type is the first operating system, a first page player object is created, and a monitoring event is set for the first page player object. When it is monitored that the loading of the audio to be played is completed, the audio to be played is played.

[0055] In this embodiment, the first operating system may be an iOS system, and the first page player object may be an audio tag.

[0056] It should be noted that the monitoring event can be a loadedmetadata event used to monitor whether the audio to be played has been loaded. It can be known that the loadedmetadata event is usually used with <video>and <audio>This event is triggered when the media data is loaded and ready to play. This means that all the data of the media file has been loaded and can be rendered and played, but the entire media file does not necessarily need to be played.

[0057] In this embodiment, loading and playing the audio object is a crucial step for the normal audio playback in the iOS system. First, add a listening event to the audio object to listen to the loadedmetadata event of the audio object, then execute the load method of the audio object to load the audio object. Once the loadedmetadata event is listened, the play method of the audio object can be executed to play the audio object. At this point, the audio file of the H5 application based on WebView nesting in the iOS system can be played normally.

[0058] Specifically, for the iOS system, first create an audio tag in H5 and specify the audio source, then add a listening event to the audio tag, that is, to listen to the loadedmetadata event of the audio tag. When the audio tag obtains the audio source, first load the source file, listen to the completion of the loading of the source file, and then play the source file, which can solve the playback problem shown by iOS.

[0059] If the system type is the second operating system, a second page player object is created, and an audio head node is created for the second page player object. The audio to be played is decoded and spliced ​​to the audio head node to obtain an audio source, and the audio source is played.

[0060] In this embodiment, the second operating system may be an Android system, and the second page player object may be an audioContext instance.

[0061] It is known that in the Web Audio API, the audio head node is the starting point of the entire audio processing graph, which represents an audio processing context. The audio head node is responsible for controlling the audio clock, node creation and connection, and audio rendering.

[0062] The audio source may be an audio source obtained by decoding the audio to be played to obtain audio data and splicing the audio data to an audio head node.

[0063] Specifically, for the Android system, first create an audioContext instance in H5, create an audio head node for the instance, then convert the acquired audio stream (that is, the audio to be played) into an arrayBuffer object and decode it into the audio data type corresponding to the audioContext, then mount the audio data to the audio source, and finally connect the audio head and tail nodes to the driver hardware for playback, which can solve the playback problem of the Android system.

[0064] Optionally, after creating the first page player object, it also includes:

[0065] Get the audio to be played and the source type of the audio to be played.

[0066] It should be noted that the source type may refer to whether the audio to be played is a local audio file or an audio stream downloaded from a server.

[0067] If the source type of the audio to be played is a local audio file, the audio to be played is introduced into the playback page, and the audio to be played is assigned to the target property of the first page player object.

[0068] The local audio file may be an audio data file stored in a local device (the local device may be a smart device such as a smart phone, a computer, etc.). In this embodiment, the playback page may specifically be an H5 page.

[0069] It should be explained that the target attribute in this embodiment can specifically be a src attribute. It is known that in HTML and Web development, the src attribute is a commonly used attribute for specifying the URL (Uniform Resource Locator) address of an external resource. This attribute can be used in a variety of HTML tags to include or reference external resources.

[0070] Specifically, if the source type of the audio to be played is a local audio file, you need to first import this file into the H5 page, and then assign it to the src attribute of the audio object. It is worth noting that if the relative path or absolute path of the audio file is directly assigned to src, when loading this file, an error may occur because the available source file cannot be found and the loading fails.

[0071] If the source type of the audio to be played is a downloadable audio stream, the audio to be played is converted into target data, and a downloadable link is created according to the target data, and the downloadable link is assigned to the target attribute of the first page player object.

[0072] It should be noted that the downloaded audio stream may be an audio stream downloaded from the server. In this embodiment, the target data may be Blob (Binary Large Object) data, which is a data type used to represent binary files and is widely used in Web development to process non-text data such as pictures, videos, audio files, etc. The downloadable link may be a link that can download the audio to be played.

[0073] Specifically, if the audio to be played is an audio stream downloaded from the server, the audio stream needs to be converted into Blob data, and then a downloadable link of the window object is created based on the Blob data, and the download link is assigned to src. In order to facilitate network transmission of multimedia data, the server sometimes needs to encode the data stream in base64. After the H5 application obtains the base64 data, it first decodes the base64 data, then converts it into Blob data and performs a series of subsequent operations.

[0074] Optionally, create a second page player object, create an audio head node for the second page player object, decode the audio to be played and splice it to the audio head node to obtain an audio source, and play the audio source, including:

[0075] Create a second page player object, and create an audio head node and an audio tail node for the second page player object.

[0076] It can be known that in the Web Audio API, the audio head node and the audio tail node are two important concepts, which represent the beginning and end of the audio processing graph respectively.

[0077] The audio head node is the starting point of the entire audio processing graph. It is responsible for managing the life cycle of the audio stream, including creating and connecting other audio nodes, controlling playback and pause, etc. The audio head node provides a global timeline for synchronizing audio events. In addition, the audio head node is also responsible for outputting the final audio mix to the device's audio hardware.

[0078] The audio tail node is the end point of the audio processing graph. It is the last node in the audio stream. After the audio signal reaches here, it will be sent to the audio hardware for playback. In the Web Audio API, the audio tail node is usually represented by the destination property of the audio head node. Developers cannot create an audio tail node directly. It is automatically created by the audio head node and is unique in the audio processing graph.

[0079] In actual operation, for the Android system, to achieve audio playback, you first need to create an audioContext instance on the H5 page and generate an audio header node through the createBufferSource method of the audioContext instance.

[0080] Get the audio to be played and convert it into a target object.

[0081] In this embodiment, the target object may be an arrayBuffer object, which is a byte array object representing a piece of binary data in memory and can store multiple types of data.

[0082] Specifically, after obtaining the audio stream, convert it into an arrayBuffer object.

[0083] Decode the target object and concatenate the decoded data to the audio head node.

[0084] In actual operation, the decodeAudioData method of audioContext is used to decode the arrayBuffer object of the audio source, and the decoded data is spliced ​​to the audio header node.

[0085] Connect the audio head node with the audio tail node to obtain the audio source, and play the audio source.

[0086] In actual operation, the connect method of the audio head node is used to connect the audio head node with the tail node destination to obtain a complete audio source. Finally, the start method of the audio source can be used to play the audio immediately.

[0087] Optionally, obtain the audio to be played, including:

[0088] If the source type of the audio to be played is a local audio file, the audio to be played is imported, and the audio stream is obtained through the target request.

[0089] In this embodiment, the target request may be a fetch request. It is known that a fetch request is an API used to initiate a network request in a browser in modern Web development, which provides an interface for asynchronously acquiring resources from a server.

[0090] Specifically, if the audio to be played is a local audio file, it needs to be imported first, and then the audio stream is obtained through a fetch request.

[0091] If the source type of the audio to be played is a downloaded audio stream, the audio stream is obtained through a target request.

[0092] Specifically, if the audio to be played is an audio stream downloaded from the server, it can be downloaded directly through a fetch request.

[0093] Optionally, after creating the first page player object, it also includes:

[0094] Set the control properties of the player object on the first page and display the audio control panel.

[0095] In this embodiment, the control attribute may be a controls attribute, which may be understood as a control attribute capable of controlling the progress of the audio to be played. The audio control panel may be a panel capable of controlling the progress of the audio to be played, and the control content may include, for example, play, pause, fast forward, fast rewind, previous song, and next song.

[0096] Specifically, for iOS, to achieve audio playback, you first need to create an audio tag in the H5 page. If you need to display the audio control panel, you need to set the controls property of audio; if you do not need to display the audio control panel, you need to set the display property of audio to none, and then append the audio tag to the DOM entity.

[0097] The technical solution of the embodiment of the present invention solves the technical problem of poor playback compatibility when playing audio through the audio tag based on the H5 mobile application nested in WebView, and proposes an audio playback method based on the H5 mobile application nested in WebView. Different page player objects are created for different operating systems, and the playback of the audio to be played is realized based on different page player objects. For the iOS system, by creating an audio tag to load and play audio, the audio file may be played only once. In this regard, the embodiment of the present invention proposes to add a loadedmetadata listening event to the audio object. In the process of loading audio, the playing method of the audio object will not be executed until the loadedmetadata listening event is entered, and then the loaded audio file is played, and the audio can be played normally; for the Android system, by creating an audio tag to load and play audio, the audio file may not be played at all. In this regard, the embodiment of the present invention proposes to create an audioContext instance, generate the audio head node of the instance, decode and splice the acquired audio stream data to the audio head node, and then obtain the audio tail node of the instance and connect the audio head and tail nodes, and execute the start method of the audio source to play this complete audio normally. In the entire audio playback implementation process, the source type of the audio source is crucial. The audio tag playback method of the iOS system proposed in the embodiment of the present invention, if it is a local audio file, needs to first execute import in the H5 page to introduce the audio file, and then assign the audio file to the audio source; if it is an audio file obtained from the server, the audio source needs to convert the Blob data into a browser URL link. The audioContext object playback method of the Android system proposed in the embodiment of the present invention, if it is a local audio file, also needs to first execute import in the H5 page to introduce the audio file, and then use the audio file as a request parameter to execute a fetch request to obtain the audio source; if it is an audio stream obtained from the server, it can be directly downloaded through a fetch request. Only through the above method can the audio source be correctly obtained for audio playback. Through the technical solution of the present invention, it is possible to solve the technical problem of poor playback compatibility when playing audio through the audio tag for different operating systems in H5 mobile applications nested by WebView.

[0098] Embodiment 2

[0099] Figure 2 is a schematic diagram of the structure of an audio playback device in an embodiment of the present invention. This embodiment is applicable to audio playback. The device can be implemented in software and / or hardware. The device can be integrated in any device that provides audio playback functions, such as Figure 2 As shown, the audio playback device specifically includes: an acquisition module 201 and a creation and playback module 202.

[0100] Wherein, the acquisition module 201 is used to obtain the system type corresponding to the audio player;

[0101] The creation and playing module 202 is used to create a target page player object according to the system type, and play the audio to be played based on the target page player object.

[0102] Optionally, the creation and playing module 202 includes:

[0103] A first creation and playing unit is used to create a first page player object if the system type is a first operating system, and set a monitoring event for the first page player object, and play the audio to be played when it is monitored that the loading of the audio to be played is completed;

[0104] The second creation and playback unit is used to create a second page player object if the system type is a second operating system, and to create an audio head node for the second page player object, decode the audio to be played and splice it to the audio head node to obtain an audio source, and play the audio source.

[0105] Optionally, the device further comprises:

[0106] An acquisition unit, used to acquire the audio to be played and acquire the source type of the audio to be played;

[0107] An import unit, used for importing the audio to be played on the play page if the source type of the audio to be played is a local audio file, and assigning the audio to be played to the target attribute of the first page player object;

[0108] A conversion unit is used to convert the audio to be played into target data if the source type of the audio to be played is a downloaded audio stream, create a downloadable link according to the target data, and assign the downloadable link to the target attribute of the first page player object.

[0109] Optionally, the second creating and playing unit includes:

[0110] A subunit is created to create a second page player object, and to create an audio head node and an audio tail node for the second page player object;

[0111] The acquisition and conversion subunit is used to acquire the audio to be played and convert the audio to be played into a target object;

[0112] A decoding and splicing subunit, used for decoding the target object and splicing the decoded data to the audio head node;

[0113] The connection and playing subunit is used to connect the audio head node with the audio tail node to obtain the audio source and play the audio source.

[0114] Optionally, the acquisition and conversion subunit is specifically used for:

[0115] If the source type of the audio to be played is a local audio file, the audio to be played is imported, and an audio stream is obtained through a target request;

[0116] If the source type of the audio to be played is a downloaded audio stream, the audio stream is obtained through the target request.

[0117] Optionally, the device further comprises:

[0118] The setting and display unit is used to set the control properties of the first page player object and display the audio control panel.

[0119] The above-mentioned product can execute the audio playback method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0120] Embodiment 3

[0121] Figure 3 A schematic diagram of the structure of an electronic device 30 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0122] like Figure 3 As shown, the electronic device 30 includes at least one processor 31, and a memory connected to the at least one processor 31, such as a read-only memory (ROM) 32, a random access memory (RAM) 33, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 31 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 32 or the computer program loaded from the storage unit 38 to the random access memory (RAM) 33. In the RAM 33, various programs and data required for the operation of the electronic device 30 can also be stored. The processor 31, the ROM 32, and the RAM 33 are connected to each other through a bus 34. An input / output (I / O) interface 35 is also connected to the bus 34.

[0123] A number of components in the electronic device 30 are connected to the I / O interface 35, including: an input unit 36, such as a keyboard, a mouse, etc.; an output unit 37, such as various types of displays, speakers, etc.; a storage unit 38, such as a disk, an optical disk, etc.; and a communication unit 39, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 39 allows the electronic device 30 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0124] The processor 31 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 31 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 31 performs the various methods and processes described above, such as the audio playback method:

[0125] Get the system type corresponding to the audio player;

[0126] A target page player object is created according to the system type, and the audio to be played is played based on the target page player object.

[0127] In some embodiments, the audio playback method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 30 via the ROM 32 and / or the communication unit 39. When the computer program is loaded into the RAM 33 and executed by the processor 31, one or more steps of the audio playback method described above may be performed. Alternatively, in other embodiments, the processor 31 may be configured to perform the audio playback method in any other appropriate manner (e.g., by means of firmware).

[0128] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0129] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0130] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0131] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0132] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0133] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0134] In one embodiment, the embodiment of the present invention further includes a computer program product, the computer program product includes a computer program, and the computer program implements the audio playback method of any embodiment of the present invention when executed by a processor.

[0135] The computer program product may be implemented by writing computer program code for performing the operations of the present invention in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0136] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0137] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.< / audio> < / video>

Claims

1. An audio playback method, characterized in that: include: Get the system type corresponding to the audio player; A target page player object is created according to the system type, and the audio to be played is played based on the target page player object.

2. The method according to claim 1, characterized in that: Creating a target page player object according to the system type, and playing the audio to be played based on the target page player object, including: If the system type is the first operating system, a first page player object is created, and a monitoring event is set for the first page player object, and when it is monitored that the loading of the audio to be played is completed, the audio to be played is played; If the system type is the second operating system, a second page player object is created, and an audio head node is created for the second page player object. The audio to be played is decoded and spliced ​​to the audio head node to obtain an audio source, and the audio source is played.

3. The method according to claim 2, characterized in that After creating the first page player object, also include: Obtain the audio to be played, and obtain the source type of the audio to be played; If the source type of the audio to be played is a local audio file, the audio to be played is introduced into the play page, and the audio to be played is assigned to the target attribute of the first page player object; If the source type of the audio to be played is a downloaded audio stream, the audio to be played is converted into target data, and a downloadable link is created according to the target data, and the downloadable link is assigned to the target attribute of the first page player object.

4. The method according to claim 2, characterized in that: Creating a second page player object, and creating an audio head node for the second page player object, decoding the audio to be played and splicing it to the audio head node to obtain an audio source, and playing the audio source, including: Create a second page player object, and create an audio head node and an audio tail node for the second page player object; Acquire the audio to be played, and convert the audio to be played into a target object; Decoding the target object and splicing the decoded data to the audio head node; The audio head node is connected to the audio tail node to obtain an audio source, and the audio source is played.

5. The method according to claim 4, characterized in that Get the audio to be played, including: If the source type of the audio to be played is a local audio file, the audio to be played is imported, and an audio stream is obtained through a target request; If the source type of the audio to be played is a downloaded audio stream, the audio stream is obtained through the target request.

6. The method according to claim 2, characterized in that After creating the first page player object, also include: Set the control properties of the first page player object and display the audio control panel.

7. An audio playback device, characterized in that: include: An acquisition module is used to obtain the system type corresponding to the audio player; The creation and playing module is used to create a target page player object according to the system type, and play the audio to be played based on the target page player object.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the audio playback method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the audio playback method according to any one of claims 1 to 6 when executed.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the audio playing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Video subscribing instrument system and method using the same

    CN101141454A

  • Self-adaptive Web platform audio playing method and device

    CN103077191A

  • Player and embedded play box based on Android operating system

    CN106101751A

  • Audio and video playing method and apparatus, and terminal

    CN107465598A

  • Music playing method and system, readable storage medium and intelligent terminal equipment

    CN107943447A