{#<!DOCTYPE html>#}
{#<html lang="en" dir="ltr">#}
{#  <head>#}
{#    <meta charset="utf-8">#}
{#    <title>video.js</title>#}
{#    <link href="https://unpkg.com/video.js@6.11.0/dist/video-js.min.css" rel="stylesheet">#}
{#    <script src="https://unpkg.com/video.js@6.11.0/dist/video.min.js"></script>#}
{#    <script src="https://unpkg.com/videojs-flash/dist/videojs-flash.js"></script>#}
{#    <script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>#}
{#  </head>#}
{#  <body>#}
{#    <video id="my-player" class="video-js" controls>#}
{#        <source src="rtmp://127.0.0.1:1935/abcs/home" type="rtmp/flv">#}
{#        <p class="vjs-no-js">#}
{#          not support#}
{#        </p>#}
{#    </video>#}
{#    <script type="text/javascript">#}
{#      var player = videojs('my-player',{#}
{#        width:400,#}
{#        heigh:200#}
{#      });#}
{#    </script>#}
{#  </body>#}
{#</html>#}
<!DOCTYPE html>
<html>

<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>flv.js demo</title>
    <style>
        .mainContainer {
            display: block;
            width: 1024px;
            margin-left: auto;
            margin-right: auto;
        }

        .urlInput {
            display: block;
            width: 100%;
            margin-left: auto;
            margin-right: auto;
            margin-top: 8px;
            margin-bottom: 8px;
        }

        .centeredVideo {
            display: block;
            width: 100%;
            height: 576px;
            margin-left: auto;
            margin-right: auto;
            margin-bottom: auto;
        }

        .controls {
            display: block;
            width: 100%;
            text-align: left;
            margin-left: auto;
            margin-right: auto;
        }
    </style>
</head>
<body>
    <div class="mainContainer">
        <video id="videoElement" class="centeredVideo" controls autoplay width="1024" height="576">Your browser is too old which doesn't support HTML5 video.</video>
    </div>
    <br>
    <div class="controls">
        <!--<button onclick="flv_load()">加载</button>-->
        <button onclick="flv_start()">开始</button>
        <button onclick="flv_pause()">暂停</button>
        <button onclick="flv_destroy()">停止</button>
        <input style="width:100px" type="text" name="seekpoint" />
        <button onclick="flv_seekto()">跳转</button>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/flv.js/1.5.0/flv.min.js"></script>
    <script>
        var player = document.getElementById('videoElement');
        if (flvjs.isSupported()) {
            var flvPlayer = flvjs.createPlayer({
                type: 'flv',
                "isLive": true,//<====加个这个
                url: 'http://127.0.0.1:8080/live?port=9000&app=myapp&stream=home',//<==自行修改

            });
            flvPlayer.attachMediaElement(videoElement);
            flvPlayer.load(); //加载
            flv_start();
        }

        function flv_start() {
            player.play();
        }

        function flv_pause() {
            player.pause();
        }

        function flv_destroy() {
            player.pause();
            player.unload();
            player.detachMediaElement();
            player.destroy();
            player = null;
        }

        function flv_seekto() {
            player.currentTime = parseFloat(document.getElementsByName('seekpoint')[0].value);
        }
    </script>
</body>

</html>
