如何在视频播放器旁边放置视频播放器? [英] How to put video playlist next to the video player?

查看:192
本文介绍了如何在视频播放器旁边放置视频播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为mp4和mkv视频制作了一个网络播放器,但它的工作原理,但问题是,我仍然无法保持播放列表旁边的视频播放器,现在的播放列表是在视频播放器的底部,这是脚本:

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 of the video player, this is the script:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#playlist {
    display:table;
}
#playlist li{
    cursor:pointer;
    //padding:8px;
}

#playlist li:hover{
    color:blue;                        
}
#videoarea {
    align:center;
    //float:left;
    width:630px;
    height:350px;
}
video {
    display: block;
    margin: 0 auto;
}
.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-left: auto ;
    margin-right: auto ;
    padding:10px;
    display: inline-block
}
</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>

我的目标是保持视频播放器居中,播放器旁边的播放器的视频播放器),我应该怎么办?

My goal is to keep the video player centered and the playlist next to the video player (on the right of the video player), how should I do that?

在Nitin Suri的帮助下解决:这是完整的代码 http://pastebin.com/YS2cGdG7

Solved with the help of Nitin Suri: here's the complete code http://pastebin.com/YS2cGdG7

推荐答案

@Don在这里,您可以使用已更新的CSS,以便播放列表显示在视频播放器旁边。

@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>

这篇关于如何在视频播放器旁边放置视频播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆