您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

如何配置大声朗读How to configure Read Aloud

本文演示了如何在沉浸式阅读器中配置各种选项来朗读。This article demonstrates how to configure the various options for Read Aloud in the Immersive Reader.

自动开始朗读Automatically start Read Aloud

options参数包含可用于配置大声朗读的所有标志。The options parameter contains all of the flags that can be used to configure Read Aloud. 设置 autoplaytrue 可在启动沉浸式阅读器后自动开始朗读。Set autoplay to true to enable automatically starting Read Aloud after launching the Immersive Reader.

const options = {
    readAloudOptions: {
        autoplay: true
    }
};

ImmersiveReader.launchAsync(YOUR_TOKEN, YOUR_SUBDOMAIN, YOUR_DATA, options);

备注

由于浏览器限制,不支持在 Safari 中播放自动播放。Due to browser limitations, automatic playback is not supported in Safari.

配置语音Configure the voice

设置 voicemalefemaleSet voice to either male or female. 并非所有语言都支持这两种语音。Not all languages support both voices. 有关详细信息,请参阅 语言支持 页。For more information, see the Language Support page.

const options = {
    readAloudOptions: {
        voice: 'female'
    }
};

配置播放速度Configure playback speed

设置 speed 为介于 0.5 (50% ) 和 2.5 (250% ) (含)之间的数字。Set speed to a number between 0.5 (50%) and 2.5 (250%) inclusive. 此范围外的值将限制为0.5 或2.5。Values outside this range will get clamped to either 0.5 or 2.5.

const options = {
    readAloudOptions: {
        speed: 1.5
    }
};

后续步骤Next steps