‘liusuyi’
2023-08-28 418a8806dba90a2463f194da759ed6338018d7d2
ard-work/src/main/resources/templates/test.html
@@ -13,20 +13,6 @@
            margin-top: 10px;
        }
    </style>
    <!-- 导入 ECMAScript 模块 -->
    <script th:type="module" th:src="@{/js/WHEPClient.js}"></script>
    <!-- 内联脚本块,可以使用模块中的内容 -->
    <script th:inline="javascript">
        /*<![CDATA[*/
        // 在这里使用 WHEPClient 模块中的内容
        $("#play").click(function webrtcClient(){
            const  url = "http://127.0.0.1:8889/165"; // add the webRTC URL from your live input here
            console.log(url)
            const  videoElement = document.getElementById("remote-video");
            const  client = new WHEPClient(url, videoElement);
        })
        /*]]>*/
    </script>
<body>
<div class="container">
    <div class="row ">
@@ -141,14 +127,11 @@
            <div class="row top-buffer">
                <video id="video" muted autoplay loop controls style="width: 800px; height: 100%; object-fit: fill;"/>
            </div>
            <div class="row top-buffer">
                <button id="play" type="button" class="btn btn-default" >播放</button>
            <video id="remote-video" controls autoplay muted></video>
            </div>
        </div>
    </div>
</div>
<script th:inline="javascript">
<script th:inline="javascript" th:type="module">
    var cameraId, opt,optOpen,optClose, token;
    window.onload = function () {
        $.ajax({
@@ -179,7 +162,6 @@
                }
            }
        })
        opt = {"username": "admin", "password": "admin123"};
        $.ajax({
            headers: {
@@ -846,6 +828,5 @@
        webRtcServer.disconnect();
    }
</script>
</body>
</html>