Important: this documentation is not applicable to your currently selected format stories!
amp-google-read-aloud-player
Description
Embeds the Google Read Aloud Player.
Required Scripts
<script async custom-element="amp-google-read-aloud-player" src="https://cdn.ampproject.org/v0/amp-google-read-aloud-player-0.1.js"></script>
Supported Layouts
Behavior
Embeds the Google Read Aloud player. This player reads the content of your page out loud.
Attributes
data-api-key (required) | API key identifies the publisher, and must be provided in order to use the player.
Each API Key is correlated to a closed list of domains that represent the publisher domains. Only URLs that belong to one of these domains are able to be played by the web player. During the piloting phase, the API Key will be provided to the publisher by Google. Other API Keys that were generated using the Google Cloud Console won’t work. |
data-tracking-ids (required) | The list of the
Google Analytics tracking IDs to send the player metrics to (comma separated).
You are required to have a Google Analytics tracking ID in order to use this player during the pilot period. The tracking ID will be provided to you by Google. If you want to send the player metrics also to your Google Analytics account, add your tracking ID (or IDs) to this list. |
data-voice (required) | The voice to use for generating the Text-to-Speech audio. Publishers should use only a single voice and only from the supported voices list (TBD). |
data-url | The canonical URL of the web page to read aloud. The URL must be publicly accessible and
free of any PII. The URL must be on a domain that was configured by Google and correlated with the
specific API key.
When the parameter isn’t provided, the player uses the Canonical URL link tag of the current page. This is useful for reading aloud the content of the current page and only a single Read Aloud player is embedded in the page (no infinite scroll). This value overrides it, and publishers are required to set it only in these cases:
|
data-speakable | Controls the contents to read aloud.
When present, uses text only from elements annotated with speakable markup, otherwise, Google analyzes the document automatically to choose the suitable text parts. |
data-call-to-action-label | The call to action label that is shown before the user pressed on play for the first time. Publishers can use it as a teaser to invite users to press the play button. If not present, "Listen to article" (localized) is shown. The string can be in any language. |
data-intro | The URL of the MP3 audio file which will be played before the player starts reading from the beginning. The intro can be used by publishers to create a unique opening for each playback. The intro is played whenever a listener starts playback from the beginning. |
data-outro | The URL of the MP3 audio file which will be played after the player ends reading. The outro can be used by publishers to create a unique ending for each playback. |
data-ad-tag-url | A complete VAST ad tag URL with parameters for playing pre-roll audio ads. When present, audio ads will be played before reading aloud page contents, after the user clicks on the play button for the first time. If not present, only page content will be played. The ad tag URL must include the following parameters:
|
Usage
Include an amp-google-read-aloud-player
on your AMP document:
<amp-google-read-aloud-player height="65" data-api-key="<YOUR_API_KEY>" data-tracking-ids="<YOUR_TRACKING_IDS>" data-voice="<YOUR_VOICE>" ></amp-google-read-aloud-player>
Validation
See amp-google-read-aloud-player rules in the AMP validator specification.
لقد قرأت هذا المستند عشرات المرات ولكن ألم يُجِب عن جميع أسئلتك؟ ربما حصل ذات الأمر مع أشخاص آخرين: تواصل معهم على Stack Overflow.
الذهاب إلى Stack Overflow هل وجدت خطأ أو تفتقد لميزة؟يشجع مشروع AMP مشاركتك ومساهمتك بشدة! ونأمل أن تكون مشاركًا دائمًا في مجتمعنا مفتوح المصدر، ولكننا نشجع أيضًا المساهمات التي تحدث لمرة واحدة في الأمور التي تتحمس لها.
الانتقال إلى GitHub