<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="http://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.min.js"></script>
    <script type="text/javascript">
        var player = new CTWebPlayer();
        $(function () {
            player.playerUrl = "http://www.reallusion.com/crazytalk/Unity/samplecode/CTWebPlayer.unity3d";

            player.init($("#unityPlayer"), function () {
                player.loadActor("http://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode5/Scripts.uctmodel", {
                    idleMotionUrl: "http://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode5/Affirmative.uctidle"
                });
            });
        });


        function Script1() {
            player.loadScript("http://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode5/Scripts.uctscript", {
                playAfter: 0,
                loaded: function (status) {
                    console.log("Script1 loaded!");
                }
            });
        }


        function Script2() {
            player.loadScript("http://www.reallusion.com/crazytalk/Unity/samplecode/SampleCode5/Script2.uctscript", {
                playAfter: -1,
                loaded: function (status) {
                    console.log("Script2 loaded!");
                }
            });
        }
    </script>
</head>

<body>
    <table style="text-align:center;margin-left:auto; margin-right:auto;">
        <tr>
            <td>
                <div id="unityPlayer" style="width: 640px; height: 480px;">
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" value="Script1" onclick="Script1()" class="button" />
                <input type="button" value="Script2" onclick="Script2()" class="button" />
            </td>
        </tr>
</table>
</body>

</html>