<html>
<head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"></script>
    <script type="text/javascript" src="https://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.min.js"></script>
    <script type="text/javascript">
        var player = new CTWebPlayer();
        $(function () {
            player.playerUrl = "https://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.unity3d";            
            player.init($("#unityPlayer"), function () {
                player.loadActor("https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode5/Scripts.uctmodel", {
                    idleMotionUrl: "https://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode5/Affirmative.uctidle"
            });
        });


        function Say() {
            var str = $('input[name=speed]:checked').val();
            player.loadScriptFromText( $("#text").val(), {
                ttsVoice: $('input[name=voice]:checked').val(),
                ttsSpeed: $('input[name=speed]:checked').val().split(",")[0],
                ttsPitch: $('input[name=speed]:checked').val().split(",")[1],
                automotion: $('input[name=automotion]:checked').val(),
                playAfter: 0,
                loaded: function( status, dat, info ) {
                    console.log( "out:" + info.message );
                }
            });
        }

    </script>
</head>

<body>
    <table style="text-align:left;margin-left:auto; margin-right:auto;">
        <tr>
            <th colspan=4>
                <div id="unityPlayer" style="width: 640px; height: 480px;">
                </div>
            </th>
        </tr>
        <tr>
            <th colspan=4>
                <textarea id="text" style="width: 640px; height: 120px; resize: none;">Please type text here, and press Say button to playback the conversion result.</textarea>
            </th>           
        </tr>       
        <tr>
            <td>Voice:</td>
            <td><div>Voice Speed & Pitch:</div></td>
            <td>Auto Motion Style:</td>
            <td><input type="button" value="Say" onclick="Say()" class="button" /></td>

        </tr>
        <tr>
            <td><input type="radio" name="voice" value="usenglishfemale" checked/><label for="voice1">usenglishfemale</label></td>
            <td><input type="radio" name="speed" value="0,0" checked/>Speed(defalut) Pitch(default)</td>
            <td><input type="radio" name="automotion" value="Broadcast_F" checked/>Female Broadcast</td>            
        </tr>
        <tr>
            <td><input  type="radio" name="voice" value="ukenglishfemale" />ukenglishfemale</td>
            <td><input  type="radio" name="speed" value="2,30" />Speed(faster) Pitch(higher)</td>
            <td><input  type="radio" name="automotion" value="Service_F" />Female Service</td>
        </tr>
        <tr>
            <td></td>
            <td><input  type="radio" name="speed" value="-2,-30" />Speed(slower) Pitch(lower)</td>      
            <td><input  type="radio" name="automotion" value="Explain_F" />Female Explain</td>
        </tr>
    </table>
</body>

</html>