<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>FLV Video Player</title>

    <!-- 引入flv.js库 -->
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.5.0/flv.min.js"></script>
</head>
<body>


<video id="videoPlayer" th:style="'width:500px; height:500px;'" controls></video>

<script th:inline="javascript">
    (function () {
        var videoPath = /*[[${videoPath}]]*/ '';

        if (flvjs.isSupported()) {
            var videoElement = document.getElementById('videoPlayer');
            var flvPlayer = flvjs.createPlayer({
                type: 'flv',
                url: 'http://localhost:8000' + videoPath
            });

            flvPlayer.attachMediaElement(videoElement);
            flvPlayer.load();

            // 播放视频
            videoElement.play();
        } else {
            console.error('FLV not supported');
        }
    })();
</script>
</body>
</html>
