好玩的语音

<style>#ra-player {margin-bottom: 1em;} .ra-button {padding: .3em .9em; border-radius: .25em; background: linear-gradient(#fff, #efefef); box-shadow: 0 1px .2em gray; display: inline-flex; align-items: center; cursor: pointer;} .ra-button img {height: 1em; margin: 0 .5em 0 0;border: none !important;}</style>
<div id="ra-player" data-skin="https://assets.sitespeaker.link/embed/skins/default">
<div class="ra-button" onclick="readAloud(document.getElementById('ra-audio'), document.getElementById('ra-player'))">
<img src="https://assets.sitespeaker.link/embed/skins/default/play-icon.png"/> 朗读这篇文章</div></div>
<audio id="ra-audio" data-lang="cmn-CN" data-voice="Google cmn-CN-Standard-D" data-key="demo"></audio>
<script>
    function readAloud(au,pl){
        var bs="https://assets.sitespeaker.link/embed/";
        /iPad|iPhone|iPod/.test(navigator.userAgent)&&(au.src=bs+"sound/silence.mp3",au.play());
        var xhr=new XMLHttpRequest;
        xhr.open("GET",bs+"js/readaloud.min.js?ajax=1",!0),xhr.onreadystatechange=function(){4==xhr.readyState&&200==xhr.status&&(eval(xhr.responseText),readAloudInit(au,pl))},xhr.send(null)}
</script>
标签:

相关文章

发表评论