How to put video playlist next to the video player?

前端 未结 1 2021
一整个雨季
一整个雨季 2021-01-28 21:33

I made a web player for mp4 and mkv videos, it works but the problem is that I still can\'t keep the playlist next to the video player, right now the playlist is at the bottom o

相关标签:
1条回答
  • 2021-01-28 22:12

    @Don here you go with the updated CSS for the play list to display next to the video player.

    <!DOCTYPE html>
    <html>
    <head>
    <style type="text/css">
    .MenuBox {
        -moz-border-radius:30px;
        -webkit-border-radius:30px;
        border-radius:30px;
        border: #solid 10px #000;
        background-color: rgba(255,255,255,0.5);
        width:auto;
        height:auto;
        margin: 0 auto;
        padding:10px;
    }
    .MenuBox:before,
    .MenuBox:after {
      content: "";
      display: table;
    }
    .MenuBox:after {
      clear: both;
    }
    #videoarea {
      float: left;
        width:630px;
        height:350px;
    }
    #playlist {
      float: left;
    }
    #playlist li{
        cursor:pointer;
    }
    #playlist li:hover{
        color:blue;                        
    }
    </style>
       <script type="text/javascript" src="jquery-1.11.2.min.js"></script>
       <script type="text/javascript">
    $(function() {
        $("#playlist li").on("click", function() {
            $("#videoarea").attr({
                "src": $(this).attr("movieurl"),
                "poster": "",
                "autoplay": "autoplay"
            })
        })
        $("#videoarea").attr({
            "src": $("#playlist li").eq(0).attr("movieurl"),
            "poster": $("#playlist li").eq(0).attr("moviesposter")
        })
    })
    </script>
    </head>
    <body>
    <div class="MenuBox">
    <video id="videoarea" controls="controls" poster="" src=""></video>
    <ul id="playlist">
        <li movieurl="/mnt/usb/snk.mkv">SnK</li>
        <li movieurl="/mnt/usb/titanic.mp4">Titanic Titanic Titanic Titanic Titanic Titanic </li>
        <li movieurl="/mnt/usb/shutter.mkv">Shutter</li>
        <li movieurl="/mnt/usb/ab1.mp4">AB1</li>
        <li movieurl="/mnt/usb/ab2.mp4">AB2</li>
        <li movieurl="/mnt/usb/d1.mp4">D</li>
    </ul>
    </div>
    </body>
    </html>
    
    0 讨论(0)
提交回复
热议问题