-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplaylist.php
More file actions
291 lines (229 loc) · 9.49 KB
/
playlist.php
File metadata and controls
291 lines (229 loc) · 9.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<?php
include("db/db.php");
$category_id=$_GET["list"];
$get_videos=mysql_query("select distinct videos.* from videos,categories,vid_cat where videos.video_id IN (select video_id from vid_cat where cat_id=$category_id)");
$playlist="";
$videos_list = array();
$i=1;
while(($array=mysql_fetch_array($get_videos))!=null)
{
$video_name="";
if(empty($array['title']))
$video_name=$array["name"];
else
$video_name=$array["title"];
$video_thumb=$array['thumnail'];
$video_url=$array['s3_url'];
$video_desc=$array['description'];
$videos_list[$i]=$video_url;
$i++;
$playlist=$playlist."{file:\"".$video_url."\",image:\"".$video_thumb."\",title:\"".$video_name."\",description:\"".$video_desc."\"},";
}
$first_video=$videos_list[1];
$query_cat_name=mysql_query("select category_name from categories where category_id=$category_id");
$row_cat_name=mysql_fetch_row($query_cat_name);
$category_name=$row_cat_name[0];
$i=$i-1;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Video Management System</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- Load player theme -->
<link rel="stylesheet" href="player/themes/maccaco/projekktor.style.css" type="text/css" media="screen" />
<!-- Load jquery -->
<script type="text/javascript" src="player/jquery-1.9.1.min.js"></script>
<!-- load projekktor -->
<script type="text/javascript" src="player/projekktor-1.3.09.min.js"></script>
<?php
?>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="index.php" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>V</b>CMS</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>Video</b>CMS</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<li class="active treeview">
<a href="index.php">
<i class="fa fa-dashboard"></i> <span>Videos</span>
</a>
</li>
<li class="treeview">
<a href="#" data-toggle="modal" data-target="#myModal">
<i class="fa fa-files-o"></i>
<span>Upload</span>
</a>
</li>
<li>
<a href="manage.php">
<i class="fa fa-th"></i> <span>Manage</span>
</a>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="box-title"><?=$category_name?> Playlist</h3>
</div><!-- /.box-header -->
<!--new code for video player-->
<video width="400px" height="400px" id="myVideo" data="5" autoplay>
<source src= "<?php echo $first_video ?>" type="video/mp4">
your browser does not support the video tag.
</video>
</div>
</div>
</div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.3.0
</div>
<strong>Copyright © 2015-2016 <a href="http://nethram.com">Nethram</a>.</strong> All rights reserved.
</footer>
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Upload Video</h4>
</div>
<div class="modal-body">
<form role="form" id="uploadform" enctype="multipart/form-data">
<div class="info-box">
<div class="form-group">
<label>Select Video File</label>
<input type="file" class="form-control" name="video" id="video"/>
</div>
<div class="form-group">
<label>Select Thumbnail Image</label>
<input type="file" class="form-control" name="thumbnail" id="video"/>
</div>
<input type="submit" value="Upload" class="btn btn-primary" id="upload"/>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
<div class="modal-footer">
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<script src="bootstrap/bootbox.min.js"></script>
<script>
var player=document.getElementById('myVideo');
player.addEventListener('ended',myHandler,false);
var video_array = <? echo json_encode($videos_list); ?>;
var limit =<? echo($i)?>;
var k=2;
function myHandler(e) {
if(!e)
{
e = window.event;
}
if(k<=limit)
{
player.src=video_array[k];
k++;
}
else
{
location.href="index.php";
}
}
$(document).ready(function(){
$("#uploadform").on('submit',(function(e){
e.preventDefault();
var data=new FormData(this);
$.ajax({
type:"POST",
url:"uploader.php",
data:data,
contentType: false,
cache: false,
processData:false,
success:function(response)
{
if(response=="Invalid")
{
bootbox.alert("Invalid File Formats");
}
else if(!isNaN(response))
{
bootbox.alert("Uploaded Successfully");
location.href="watch.php?video="+response;
}
else
{
bootbox.alert("Uploading Failed");
}
},
error:function()
{
alert("Error During Ajax Call..!!!");
}
});
}))
});
</script>
</body>
</html>