Reputation: 235
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?
Solved with the help of Nitin Suri: here's the complete code http://pastebin.com/YS2cGdG7
Upvotes: 0
Views: 1325
Reputation: 1010
@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>
Upvotes: 1