Text-to-speech playback method, device, equipment and storage medium

By establishing a communication mechanism between the H5 page and the client and using the client's voice synthesis capabilities, the problem of the lack of text to voice ability on the H5 page is solved, and simple and convenient text to voice playback is achieved, reducing development complexity and resource consumption.

CN119760268APending Publication Date: 2025-04-04GUOSEN SECURITIES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410618142.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The H5 page lacks built-in text to voice capabilities. The existing technical solutions require the embedding of additional modules in the H5 page or relying on third-party services, resulting in high development complexity and high resource consumption.

Method used

By establishing a mutually recognizable communication mechanism between the H5 page and the client, the client's local voice synthesis capability is used to realize text-to-speech playback. The specific steps include the H5 page responding to the playback instructions, obtaining text and playback parameters, generating a protocol to send it to the client, and the client parsing the protocol and playing voice data.

Benefits of technology

It realizes simple and convenient text-to-speech playback on the H5 page, reducing development complexity, reducing dependence on network requests, and reducing the load and resource consumption of the backend server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760268A_ABST
    Figure CN119760268A_ABST
Patent Text Reader

Abstract

The embodiment of the present invention relates to the field of communication technology, and discloses a text-to-speech playback method, device, equipment and storage medium, the method comprising: the H5 page responds to the playback instruction received on the H5 page, determines the text to be played on the H5 page based on the playback instruction, and the H5 page is the page currently displayed by the client; the H5 page obtains the first playback parameter of the text to be played, generates a first protocol according to the first playback parameter and the text to be played, and sends the first protocol to the client; the client parses the first protocol, obtains the first playback parameter and the text to be played in the first protocol; the client converts the text to be played into voice data, and plays the voice data according to the first playback parameter. Through the above method, the embodiment of the present invention realizes the simple and convenient implementation of text-to-speech playback on the H5 page, reducing the complexity of development.
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 communication technology, and in particular to a text-to-speech playback method, device, equipment and storage medium. Background Art

[0002] H5 pages are pages developed based on the HTML5 standard. Both desktop clients and mobile clients will have some H5 pages. With the rapid development of mobile Internet technology, HTML5 has introduced many new features and APIs, such as semantic tags, audio and video playback, etc., making H5 pages more functional and interactive. However, H5 pages have shortcomings in text-to-speech. They generally lack built-in text-to-speech capabilities. In existing technical solutions, in order to realize text-to-speech playback on H5 pages, it is usually necessary to embed additional modules or third-party services in the H5 pages. This method of development is highly complex, consumes a lot of resources, and is time-consuming and labor-intensive. Summary of the invention

[0003] In view of the above problems, the embodiments of the present invention provide a text-to-speech playback method, device, equipment and storage medium, which are used to solve the problem of how to simply and conveniently implement text-to-speech playback on an H5 page and reduce the complexity of development.

[0004] According to one aspect of an embodiment of the present invention, a text-to-speech playback method is provided, comprising:

[0005] The H5 page responds to the play instruction received on the H5 page, and determines the text to be voice played on the H5 page based on the play instruction, the H5 page being the page currently displayed by the client;

[0006] The H5 page obtains a first playback parameter of the text to be played by voice, generates a first protocol according to the first playback parameter and the text to be played by voice, and sends the first protocol to the client;

[0007] The client parses the first protocol to obtain the first playback parameter and the text to be voice played in the first protocol;

[0008] The client converts the text to be voice played into voice data, and plays the voice data according to the first playing parameter.

[0009] In an optional manner, the H5 page obtains a first playback parameter of the text to be played in voice, and generates a first protocol according to the first playback parameter and the text to be played in voice, including:

[0010] Acquire a first playback parameter and a callback function of the text to be played in voice, and generate a first protocol according to the first playback parameter, the callback function and the text to be played in voice;

[0011] After the client converts the text to be played as voice data and plays the voice data according to the first playing parameter, the method further includes:

[0012] The client monitors the current playback status, and sends the monitored playback status information to the H5 page based on the callback function, so that the H5 page updates the currently displayed playback status.

[0013] In an optional manner, the H5 page displays the playback controls corresponding to the text to be voice played, and the H5 page updates the currently displayed playback status, including: the H5 page updates the playback controls.

[0014] In an optional manner, after the client parses the first protocol and obtains the first playback parameter and the text to be voice played in the first protocol, the method further includes:

[0015] The client verifies whether the protocol name of the first protocol is a predetermined protocol name, and verifies whether the first playback parameter complies with a preset parameter rule;

[0016] If the name of the first protocol is a predetermined protocol name and the first playback parameter meets a preset parameter rule, a step of converting the text to be voice played into voice data is performed.

[0017] In an optional manner, the converting the text to be voice played into voice data, and playing the voice data according to the first playing parameter, further includes:

[0018] The H5 page responds to the playback state change instruction received on the H5 page, determines a second playback parameter based on the playback state change instruction, generates a second protocol according to the second playback parameter, and sends the second protocol to the client;

[0019] The client parses the second protocol, obtains the second playback parameter in the second protocol, and changes the current playback state according to the second playback parameter.

[0020] In an optional manner, the first playback parameter and the second playback parameter both include a playback task identifier, and after the client parses the second protocol and obtains the second playback parameter in the second protocol, the method further includes:

[0021] The client verifies whether the protocol name of the second protocol is a predetermined protocol name, verifies whether the second playback parameter complies with a preset parameter rule, and verifies whether the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter;

[0022] If the name of the second protocol is a predetermined protocol name, and the second playback parameter conforms to the preset parameter rule, and the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter, then execute the step of changing the current playback state according to the second playback parameter.

[0023] In an optional manner, the client converts the text to be played in voice format into voice data, and plays the voice data according to the first playing parameter, including:

[0024] Calling a text-to-speech engine built into the client, and using the text-to-speech engine to convert the text to be played as voice data;

[0025] The built-in player of the client is called, and the voice data is played in the player according to the first playing parameter.

[0026] According to another aspect of an embodiment of the present invention, a text-to-speech playback device is provided, the device comprising an H5 page module and a client, the H5 page module comprising a determination module and a generation module, the client comprising a parsing module and a playback module:

[0027] The determination module is used to respond to a play instruction received on an H5 page and determine the text to be voice played on the H5 page based on the play instruction, wherein the H5 page is the page currently displayed by the client;

[0028] The generating module is used to obtain a first playing parameter of the text to be played by voice, generate a first protocol according to the first playing parameter and the text to be played by voice, and send the first protocol to the client;

[0029] The parsing module is used to parse the first protocol to obtain the first playback parameter and the text to be voice played in the first protocol;

[0030] The playing module is used to convert the text to be played voice data, and play the voice data according to the first playing parameter.

[0031] According to another aspect of an embodiment of the present invention, there is provided a device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus;

[0032] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the operation of the above-mentioned text-to-speech playback method.

[0033] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, characterized in that at least one executable instruction is stored in the storage medium, and when the executable instruction is executed on a device, the device performs operations such as the above-mentioned text-to-speech playback method.

[0034] The embodiment of the present invention establishes a mutually recognizable communication mechanism between the H5 page and the client, transmits the text of the H5 page to the client through the first protocol, and utilizes the local speech synthesis capability of the client to realize local offline speech synthesis, converts the text into speech and plays it. The mechanism is independent of the network request and is directly executed on the local client, eliminating the dependence on the network request, reducing the load and resource consumption of the background server, thereby expanding the capabilities of the H5 page and enabling it to have the text-to-speech playback function; by directly calling the first protocol and using the speech synthesis capability of the client, compared with the prior art of integrating additional modules in the H5 page or relying on external third-party services, the complexity of development can be greatly reduced, the steps of function integration are simplified, and the entire implementation process is simple and efficient.

[0035] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:

[0037] Figure 1 A schematic diagram showing a flow chart of a text-to-speech playback method provided by an embodiment of the present invention;

[0038] Figure 2 A timing diagram of a text-to-speech playback method provided by an embodiment of the present invention is shown;

[0039] Figure 3 A schematic diagram showing the structure of a text-to-speech playback device provided by an embodiment of the present invention is shown;

[0040] Figure 4 A schematic diagram of the structure of a device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0041] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0042] Figure 1 A flowchart of a text-to-speech playback method provided by an embodiment of the present invention is shown. Figure 2 The timing diagram of the text-to-speech playback method provided by the embodiment of the present invention is shown. The text-to-speech playback method is applied to a terminal, which can be a smart phone, a tablet computer or other smart terminal. Figure 1 and Figure 2 As shown, the method comprises the following steps:

[0043] Step 101: the H5 page responds to the play instruction received on the H5 page, and determines the text to be played on the H5 page based on the play instruction, the H5 page being the page currently displayed by the client;

[0044] Among them, the H5 page is the page currently displayed by the client or application APP, and the client or application APP can embed the H5 page through the WebView component. WebView is a native component that can load the H5 page in the client or APP and support interaction with the H5 page. When the text in the H5 page is selected by the user, for example, the user selects a piece of text in the H5 page and clicks the play button of the text-to-speech, the text-to-speech play instruction is triggered. After the play instruction is triggered, the JavaScript of the H5 page obtains the text selected by the user in the H5 page, and the text selected by the user will be converted into speech and played. Optionally, when the user selects the text on the H5 page, a menu that can be directly operated after the selected text pops up on the H5 page. The menu includes at least a text-to-speech play control, and the user can directly click the text-to-speech play control to trigger the play instruction.

[0045] Optionally, first, a click playback event listener can be added through the JavaScript of the H5 page to listen to the click event on the H5 page. When the user selects the text on the H5 page and clicks the corresponding text-to-speech playback element, the text-to-speech playback instruction is triggered, and then the content of the click event is obtained through the event object event, so that the text selected by the user can be accurately obtained.

[0046] Furthermore, in order to detect whether the selected text is empty, when the text-to-speech playback instruction is triggered on the H5 page, the JavaScript of the H5 page will determine whether the text selected by the user is empty, for example, calling the text check function to check the content selected by the user, and then removing the spaces that may exist in the content selected by the user. If the value after removing the spaces is an empty string, the text selected by the user is determined to be empty. Otherwise, the text selected by the user is determined to be not empty, and the string can be obtained as the text to be played by voice.

[0047] Step 102: the H5 page obtains a first playback parameter of the text to be played in voice, generates a first protocol according to the first playback parameter and the text to be played in voice, and sends the first protocol to the client;

[0048] Among them, the first playback parameter includes one or more, which may include a playback action type and a playback task identifier. The playback action type includes starting playback, pausing playback, continuing playback, stopping playback, and modifying speech speed, etc. It may also include selecting language and sound, adjusting volume, adjusting pitch, etc. The playback task identifier is used to identify the current playback task to distinguish it from other playback tasks. The first playback parameter is obtained according to the triggered instruction. For example, if the text-to-speech playback instruction is triggered for the first time, the corresponding playback action type is start playback, and a playback task identifier is assigned.

[0049] In an embodiment of the present invention, a first protocol is generated according to the first playback parameter and the text to be played by voice. The first protocol is a customized communication mechanism that can be recognized between the H5 page and the client. The first protocol is used to communicate between the H5 page and the client to realize the transmission of the first playback parameter and the text to be played by voice. It can be understood that other suitable protocols or communication methods similar to the first protocol can also be used to send the first playback parameter and the text to be played by voice on the H5 page to the client.

[0050] Alternatively, if Figure 2 As shown, the first protocol is the URL protocol. The JavaScript of the H5 page generates the URL protocol according to the first playback parameter and the text to be played by voice. The URL protocol is basically as follows:

[0051] Protocol name: / / TTSSpeaker / params={text, first playback parameter}.

[0052] For example, the first URL protocol is as follows: myapp: / / TTSSpeaker / params={"txt":"sample text","action":"0","id":"123"}&callback=ttsState;

[0053] Among them, myapp is the URL protocol name, TTSSpeaker is text-to-speech playback, txt is the text content to be played, in the first playback parameter, the parameter name and value are separated by ":", and action is the specified action type, for example, 0 means start playing, 1 means pause, 2 means continue, 3 means stop, and 4 means change the playback speed; id is used to identify the playback task; callback is the callback function provided by the H5 page, which is used to receive the client's playback status update.

[0054] In an embodiment of the present invention, when the H5 page does not embed a speech synthesis module and does not use the speech synthesis function provided by a third-party service, it does not have speech synthesis capabilities. The embodiment of the present invention sends the first playback parameter and the text to be voice played to the client in the form of a first protocol to utilize the client's local speech synthesis capabilities. The interaction between the two is simple and convenient, and does not require consuming too many resources.

[0055] Step 103: the client parses the first protocol to obtain the first playback parameter and the text to be voice played in the first protocol;

[0056] After receiving the first protocol, the client parses the first protocol locally to obtain the first playback parameter and the text to be played by voice. In order to ensure that the first playback parameter and the text to be played by voice in the first protocol are accurately obtained, in an optional embodiment, after the client parses the first protocol, it also includes: the client verifies whether the protocol name of the first protocol is a predetermined protocol name, and verifies whether the first playback parameter meets the preset parameter rules; if the name of the first protocol is a predetermined protocol name, and the first playback parameter meets the preset parameter rules, then executes the step of converting the text to be played by voice into voice data.

[0057] Among them, the client first verifies whether the protocol name is a predetermined protocol name, that is, the protocol name agreed upon by the H5 page and the client. If it is not the predetermined protocol name, no processing will be performed on the first protocol, and the first playback parameter and the text to be played by voice cannot be obtained; if it is the predetermined protocol name, it is further verified whether the first playback parameter meets the preset parameter rules, for example, whether the format of the parameter is the predetermined format, and whether the length of the parameter is the predetermined length, etc. If one of them does not meet the preset parameter rules, no processing will be performed on the first protocol, and the first playback parameter and the text to be played by voice cannot be obtained. On the contrary, if the first playback parameter meets the preset parameter rules, accurate first playback parameters and text are obtained.

[0058] Step 104: The client converts the text to be played as voice into voice data, and plays the voice data according to the first playing parameters.

[0059] In an embodiment of the present invention, the text to be played by voice is converted into voice data locally on the client to play the voice data. In order to utilize the local text-to-speech capability of the client and to play the voice data conveniently and quickly, in an optional embodiment, the client converts the text to be played by voice into voice data, and plays the voice data according to the first playback parameter, including: the client calls the text-to-speech engine built into the client, and uses the text-to-speech engine to convert the text to be played by voice into voice data; calls the player built into the client, and plays the voice data in the player according to the first playback parameter.

[0060] Among them, the client first calls the built-in text-to-speech engine to convert text into voice data, and then calls its built-in player to play the voice data, realizing the client's local text-to-speech and local voice playback. This method is convenient and efficient. In other optional embodiments, since the H5 page has a voice playback function, the client can also call the built-in text-to-speech engine to convert text into voice data, and then send the voice data to the H5 page for playback, thereby improving the flexibility of voice playback.

[0061] In an optional embodiment, in order to achieve a better audio-visual effect and enhance the user's audio-visual experience, a first playback parameter of the text to be played by voice is obtained on the H5 page, and a first protocol is generated according to the first playback parameter and the text to be played by voice, including: obtaining the first playback parameter and a callback function of the text to be played by voice, and generating the first protocol according to the first playback parameter, the callback function and the text to be played by voice;

[0062] The client converts the text to be played into voice data, and after playing the voice data according to the first playback parameter, it also includes: the client monitors the current playback status, and sends the monitored playback status information to the H5 page based on the callback function, so that the H5 page can update the currently displayed playback status.

[0063] In the embodiment of the present invention, if the first protocol carries a callback function, the client can feed back the playback status to the H5 page in real time through the callback function. Optionally, the client can call the monitoring function to monitor the playback of the voice data in real time. Once the voice data starts to be played, the playback status information monitored in real time by the client is the start of playback, and the start of playback information is sent to the H5 page through the callback function, and the H5 page updates the currently displayed playback status to start of playback.

[0064] In an optional embodiment, after the play instruction is triggered, the H5 page displays the play control corresponding to the text to be played by voice, for example, a triangle is displayed in the play control, and the triangle represents the state of not playing, pausing or stopping the play. After the H5 page receives the callback function sent by the client, it updates the currently displayed play status according to the play status information in the callback function, including: the H5 page updates the play control, for example, the play control updates the triangle to a double vertical bar, and the double vertical bar represents playing. The client uses the callback function to feedback the play status, and the H5 page promptly updates the currently displayed play control to represent different play states, so that the client starts playing the H5 page and promptly updates the play control, achieving a natural and smooth effect in audio and video, and improving the user experience.

[0065] In an optional embodiment, the client converts the text to be played voice data, and after playing the voice data according to the first playback parameter, it also includes: the H5 page responds to the playback status change instruction received on the H5 page, determines the second playback parameter based on the playback status change instruction, generates a second protocol according to the second playback parameter, and sends the second protocol to the client; the client parses the second protocol, obtains the second playback parameter in the second protocol, and changes the current playback status according to the second playback parameter.

[0066] In an embodiment of the present invention, the user actively changes the playback state and clicks a corresponding playback control on the H5 page to trigger a playback state change instruction, for example, changing from the playback state to the paused playback state, or modifying the playback speech speed, etc. The H5 page determines the changed second playback parameter and generates a second protocol. The method for generating the second protocol is basically the same as the method for generating the first protocol. The second protocol is used to communicate between the H5 page and the client to realize the transmission of the changed second playback parameter.

[0067] Optionally, the second protocol is also a URL protocol. The JavaScript of the H5 page generates a URL protocol according to the changed second playback parameter. The URL protocol is basically as follows:

[0068] Protocol name: / / TTSSpeaker / params={second playback parameter}.

[0069] For example, the second URL protocol is as follows: myapp: / / TTSSpeaker / params={"action":"3","id":"123"};

[0070] Wherein, action is a specified action type, for example, 3 represents stop; id=123 is used to identify the play task.

[0071] After receiving the second protocol, the client parses the second protocol to obtain the second playback parameters, and promptly changes the current playback state, for example, from the playback state to the paused playback state, or changes the playback speed, etc., so that the front-end triggers the change and the client changes in time. In terms of audio-visual effects, the playback is smooth and natural without any delay.

[0072] Optionally, both the first playback parameter and the second playback parameter include a playback task identifier. To improve reliability, after the client parses the second protocol, a verification step is also included: the client verifies whether the protocol name of the second protocol is a predetermined protocol name, verifies whether the second playback parameter complies with preset parameter rules, and verifies whether the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter; if the name of the second protocol is a predetermined protocol name, and the second playback parameter complies with preset parameter rules, and the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter, then a step of changing the current playback status according to the second playback parameter is executed.

[0073] The process of verifying the protocol name and the second playback parameter in the embodiment of the present invention is basically the same as the verification process in the above embodiment, and will not be repeated here. As for the verification of the playback task identifier, it is to identify whether it is the same playback task. If it is a different playback task, the client will not execute the change of the playback state. On the contrary, if it is the same playback task, the client will execute the change of the playback state. It can be understood that the above-mentioned protocol name verification, second playback parameter verification and playback task identifier verification are not in a particular order.

[0074] In an embodiment of the present invention, the H5 page responds to the play instruction received on the H5 page, determines the text to be voice played on the H5 page based on the play instruction, and the H5 page is the page currently displayed by the client; the H5 page obtains the first play parameter of the text to be voice played, generates a first protocol according to the first play parameter and the text to be voice played, and sends the first protocol to the client; the client parses the first protocol, obtains the first play parameter in the first protocol and the text to be voice played; the client converts the text to be voice played into voice data, and plays the voice data according to the first play parameter. The embodiment of the present invention establishes a mutually recognizable communication mechanism between the H5 page and the client, transmits the text of the H5 page to the client through the first protocol, and utilizes the local speech synthesis capability of the client to realize local offline speech synthesis, converts the text into speech and plays it. The mechanism is independent of the network request and is directly executed on the local client, eliminating the dependence on the network request, reducing the load and resource consumption of the background server, thereby expanding the capabilities of the H5 page and enabling it to have the text-to-speech playback function; by directly calling the first protocol and using the speech synthesis capability of the client, compared with the prior art of integrating additional modules in the H5 page or relying on external third-party services, the complexity of development can be greatly reduced, the steps of function integration are simplified, and the entire implementation process is simple and efficient.

[0075] Figure 3 FIG. 2 shows a schematic diagram of the structure of an embodiment of the present invention. Figure 3 As shown, the device includes an H5 page module and a client, the H5 page module includes a determination module 301 and a first generation module 302, and the client includes a first analysis module 303 and a playback module 304:

[0076] The determination module 301 is used to respond to the playback instruction received on the H5 page and determine the text to be voice played on the H5 page based on the playback instruction, and the H5 page is the page currently displayed by the client;

[0077] The first generating module 302 is used to obtain a first playing parameter of the text to be played by voice, generate a first protocol according to the first playing parameter and the text to be played by voice, and send the first protocol to the client;

[0078] The first parsing module 303 is used to parse the first protocol to obtain the first playing parameter and the text to be voice played in the first protocol;

[0079] The playing module 304 is used to convert the text to be played voice into voice data, and play the voice data according to the first playing parameters.

[0080] In an optional manner, the first generating module 302 is specifically used to obtain a first playback parameter and a callback function of the text to be voice played, and generate a first protocol according to the first playback parameter, the callback function and the text to be voice played;

[0081] The client also includes a callback module for monitoring the current playback status and sending the monitored playback status information to the H5 page based on the callback function, so that the H5 page can update the currently displayed playback status.

[0082] In an optional manner, the H5 page displays the playback controls corresponding to the text to be voice played, and the H5 page updates the currently displayed playback status, including: the H5 page updates the playback controls.

[0083] In an optional manner, the client also includes a first verification module, which is used to verify whether the protocol name of the first protocol is a predetermined protocol name, and to verify whether the first playback parameter complies with preset parameter rules; if the name of the first protocol is a predetermined protocol name, and the first playback parameter complies with preset parameter rules, the playback module is triggered.

[0084] In an optional manner, the H5 page module also includes a second generation module, and the client also includes a second parsing module, the second generation module is used to respond to a playback status change instruction received on the H5 page, determine a second playback parameter based on the playback status change instruction, generate a second protocol according to the second playback parameter, and send the second protocol to the client; the second parsing module is used to parse the second protocol, obtain the second playback parameter in the second protocol, and change the current playback status according to the second playback parameter.

[0085] In an optional manner, the client also includes a second verification module, which is used to verify whether the protocol name of the second protocol is a predetermined protocol name, verify whether the second playback parameter complies with the preset parameter rules, and verify whether the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter; if the name of the second protocol is a predetermined protocol name, and the second playback parameter complies with the preset parameter rules, and the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter, the second parsing module is triggered.

[0086] Figure 4 The schematic diagram of the structure of the device embodiment of the present invention is shown, and the specific embodiment of the present invention does not limit the specific implementation of the device.

[0087] like Figure 4As shown, the device may include: a processor (processor) 402 , a communication interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .

[0088] The processor 402, the communication interface 404, and the memory 406 communicate with each other via the communication bus 408. The communication interface 404 is used to communicate with other devices such as a client or other server network elements. The processor 402 is used to execute the program 410, which can specifically execute the relevant steps in the above method embodiment.

[0089] Specifically, the program 410 may include program code including computer executable instructions.

[0090] The processor 402 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0091] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0092] The program 410 may be specifically called by the processor 402 to enable the device to perform the following operations:

[0093] The H5 page responds to the play instruction received on the H5 page, and determines the text to be voice played on the H5 page based on the play instruction, and the H5 page is the page currently displayed by the client;

[0094] The H5 page obtains a first playback parameter of the text to be played by voice, generates a first protocol according to the first playback parameter and the text to be played by voice, and sends the first protocol to the client;

[0095] The client parses the first protocol to obtain the first playback parameter and the text to be voice played in the first protocol;

[0096] The client converts the text to be voice played into voice data, and plays the voice data according to the first playing parameter.

[0097] In an optional manner, the H5 page obtains a first playback parameter of the text to be played in voice, and generates a first protocol according to the first playback parameter and the text to be played in voice, including:

[0098] Acquire a first playback parameter and a callback function of the text to be played in voice, and generate a first protocol according to the first playback parameter, the callback function and the text to be played in voice;

[0099] After the client converts the text to be played as voice data and plays the voice data according to the first playing parameter, the method further includes:

[0100] The client monitors the current playback status, and sends the monitored playback status information to the H5 page based on the callback function, so that the H5 page updates the currently displayed playback status.

[0101] In an optional manner, the H5 page displays the playback controls corresponding to the text to be voice played, and the H5 page updates the currently displayed playback status, including: the H5 page updates the playback controls.

[0102] In an optional manner, after the client parses the first protocol and obtains the first playback parameter and the text to be voice played in the first protocol, the method further includes:

[0103] The client verifies whether the protocol name of the first protocol is a predetermined protocol name, and verifies whether the first playback parameter complies with a preset parameter rule;

[0104] If the name of the first protocol is a predetermined protocol name and the first playback parameter meets a preset parameter rule, a step of converting the text to be voice played into voice data is performed.

[0105] In an optional manner, after the client converts the text to be voice played into voice data and plays the voice data according to the first playing parameter, the method further includes:

[0106] The H5 page responds to the playback state change instruction received on the H5 page, determines a second playback parameter based on the playback state change instruction, generates a second protocol according to the second playback parameter, and sends the second protocol to the client;

[0107] The client parses the second protocol, obtains the second playback parameter in the second protocol, and changes the current playback state according to the second playback parameter.

[0108] In an optional manner, the first playback parameter and the second playback parameter both include a playback task identifier, and after the client parses the second protocol and obtains the second playback parameter in the second protocol, the method further includes:

[0109] The client verifies whether the protocol name of the second protocol is a predetermined protocol name, verifies whether the second playback parameter complies with a preset parameter rule, and verifies whether the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter;

[0110] If the name of the second protocol is a predetermined protocol name, and the second playback parameter conforms to the preset parameter rule, and the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter, then execute the step of changing the current playback state according to the second playback parameter.

[0111] In an optional manner, the client converts the text to be played in voice format into voice data, and plays the voice data according to the first playing parameter, including:

[0112] Calling a text-to-speech engine built into the client, and using the text-to-speech engine to convert the text to be played as voice data;

[0113] The built-in player of the client is called, and the voice data is played in the player according to the first playing parameter.

[0114] The embodiment of the present invention establishes a mutually recognizable communication mechanism between the H5 page and the client, transmits the text of the H5 page to the client through the first protocol, and utilizes the local speech synthesis capability of the client to realize local offline speech synthesis, converts the text into speech and plays it. The mechanism is independent of the network request and is directly executed on the local client, eliminating the dependence on the network request, reducing the load and resource consumption of the background server, thereby expanding the capabilities of the H5 page and enabling it to have the text-to-speech playback function; by directly calling the first protocol and using the speech synthesis capability of the client, compared with the prior art of integrating additional modules in the H5 page or relying on external third-party services, the complexity of development can be greatly reduced, the steps of function integration are simplified, and the entire implementation process is simple and efficient.

[0115] An embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores at least one executable instruction. When the executable instruction is executed on a device, the device executes a method in any of the above method embodiments.

[0116] An embodiment of the present invention provides a computer program, which can be called by a processor to enable a device to execute a method in any of the above method embodiments.

[0117] An embodiment of the present invention provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed on a computer, the computer executes a method in any of the above method embodiments.

[0118] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other equipment. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language yet. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the description made to specific languages ​​above is for disclosing the best mode of the present invention.

[0119] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0120] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than those expressly recited in each claim.

[0121] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0122] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A text-to-speech playback method, applied to a terminal, characterized in that: The method comprises: The H5 page responds to the play instruction received on the H5 page, and determines the text to be voice played on the H5 page based on the play instruction, the H5 page being the page currently displayed by the client; The H5 page obtains a first playback parameter of the text to be played by voice, generates a first protocol according to the first playback parameter and the text to be played by voice, and sends the first protocol to the client; The client parses the first protocol to obtain the first playback parameter and the text to be voice played in the first protocol; The client converts the text to be voice played into voice data, and plays the voice data according to the first playing parameter.

2. The method according to claim 1, characterized in that The H5 page obtains a first playback parameter of the text to be played in voice, and generates a first protocol according to the first playback parameter and the text to be played in voice, including: Acquire a first playback parameter and a callback function of the text to be played in voice, and generate a first protocol according to the first playback parameter, the callback function and the text to be played in voice; After the client converts the text to be played as voice data and plays the voice data according to the first playing parameter, the method further includes: The client monitors the current playback status, and sends the monitored playback status information to the H5 page based on the callback function, so that the H5 page updates the currently displayed playback status.

3. The method according to claim 2, characterized in that The H5 page displays the playback control corresponding to the text to be voice played, and the H5 page updates the currently displayed playback status, including: the H5 page updates the playback control.

4. The method according to claim 1, characterized in that: After the client parses the first protocol and obtains the first playback parameter and the text to be voice played in the first protocol, the method further includes: The client verifies whether the protocol name of the first protocol is a predetermined protocol name, and verifies whether the first playback parameter complies with a preset parameter rule; If the name of the first protocol is a predetermined protocol name and the first playback parameter meets a preset parameter rule, a step of converting the text to be voice played into voice data is performed.

5. The method according to claim 1, characterized in that After the client converts the text to be played as voice data and plays the voice data according to the first playing parameter, the method further includes: The H5 page responds to the playback state change instruction received on the H5 page, determines a second playback parameter based on the playback state change instruction, generates a second protocol according to the second playback parameter, and sends the second protocol to the client; The client parses the second protocol, obtains the second playback parameter in the second protocol, and changes the current playback state according to the second playback parameter.

6. The method according to claim 5, characterized in that The first playback parameter and the second playback parameter both include a playback task identifier, and after the client parses the second protocol and obtains the second playback parameter in the second protocol, the following further includes: The client verifies whether the protocol name of the second protocol is a predetermined protocol name, verifies whether the second playback parameter complies with a preset parameter rule, and verifies whether the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter; If the name of the second protocol is a predetermined protocol name, and the second playback parameter conforms to the preset parameter rule, and the playback task identifier in the second playback parameter is the same as the playback task identifier in the first playback parameter, then execute the step of changing the current playback state according to the second playback parameter.

7. The method according to any one of claims 1 to 6, characterized in that: The client converts the text to be played as voice data, and plays the voice data according to the first playing parameter, including: Calling a text-to-speech engine built into the client, and using the text-to-speech engine to convert the text to be played as voice data; The built-in player of the client is called, and the voice data is played in the player according to the first playing parameter.

8. A text-to-speech playback device, characterized in that: The device includes an H5 page module and a client, the H5 page module includes a determination module and a generation module, and the client includes a parsing module and a playback module: The determination module is used to respond to a play instruction received on an H5 page and determine the text to be voice played on the H5 page based on the play instruction, wherein the H5 page is the page currently displayed by the client; The generating module is used to obtain a first playing parameter of the text to be played by voice, generate a first protocol according to the first playing parameter and the text to be played by voice, and send the first protocol to the client; The parsing module is used to parse the first protocol to obtain the first playback parameter and the text to be voice played in the first protocol; The playing module is used to convert the text to be played voice data, and play the voice data according to the first playing parameter.

9. A device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the operation of the text-to-speech playback method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one executable instruction, and when the executable instruction is executed on the device, the device executes the operation of the text-to-speech playback method according to any one of claims 1 to 7.