summaryrefslogtreecommitdiff
path: root/stream.php
diff options
context:
space:
mode:
authorroot2014-09-13 22:26:58 +0200
committerroot2014-09-13 22:26:58 +0200
commitc5639ee890215e4e8e0f544821ea8d285ca58eb8 (patch)
tree29f685943c61c4d7ec0e376e485686e985b97065 /stream.php
parentf8c60cae423fc78ed21d17a9217716ccc1e6dab1 (diff)
downloadvideo-dl-c5639ee890215e4e8e0f544821ea8d285ca58eb8.tar.gz
init
Diffstat (limited to 'stream.php')
-rw-r--r--stream.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/stream.php b/stream.php
new file mode 100644
index 0000000..30b703d
--- /dev/null
+++ b/stream.php
@@ -0,0 +1,88 @@
+<?php
+require_once("config.php");
+require_once("func.php");
+if(empty($_GET["vid"])){
+ failure("No video found.", true);
+}
+
+require_once("class/redis.php");
+$db = new database($REDIS_DBNAME, $REDIS_CONNECT);
+$db->open();
+if(!$db->listExists($_GET["vid"]))
+ failure("No video found.", true);
+$title = $db->getItem($_GET["vid"], 1);
+$db->close();
+unset($db);
+?>
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title><?php echo $title; ?> :: streaming</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <link rel="stylesheet" href="/css/style.css">
+ <link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
+ <link href="//vjs.zencdn.net/4.8/video-js.css" rel="stylesheet">
+ <?php /*
+ <link rel="stylesheet" href="/static/style.css">
+ <link rel="stylesheet" href="/static/player.css">
+ <link rel="stylesheet" href="/static/content.css">
+ */ ?>
+ <!--script type='text/javascript' src='/boring.js'></script-->
+ <script type='text/javascript'>
+
+ window.onload = function () {
+ doVideo("stream");
+ // new countdown(9, 'counter');
+ };
+ document.createElement('video');document.createElement('audio');document.createElement('track');
+
+ function doVideo(task){
+ r = new XMLHttpRequest();
+ r.onreadystatechange=function(){
+ if(r.readyState == 4){
+ if(r.status == 404){
+ document.getElementById('middle').innerHTML=r.responseText;
+ } else if(r.status == 200){
+ if(r.responseText == "cached"){
+ doVideo("player");
+ }
+ else if(task == "player"){
+ document.getElementById('middle').innerHTML=r.responseText;
+ } else {
+ doVideo("player");
+ }
+ } else if(r.status == 504){
+ document.getElementById('middle').innerHTML="<h1>The connection timed out</h1><br>Please refresh the page.";
+ window.reload;
+ }
+ }
+ }
+ r.open('GET', '/dl.php?vid=<?php echo htmlentities($_GET["vid"]); ?>&ajax=1&task='+task, true);
+ r.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+ r.send();
+ }
+ </script>
+ <?php require_once("static/noscript.html"); ?>
+</head>
+
+<body >
+ <?php require_once("static/header.php"); ?>
+ <div class="container">
+ <div class="text-center">
+ <div id='middle'>
+ <div class="row">
+ <h1>This may take <span id='counter'>some</span> time.</h1>
+ </div>
+ <div class="row">
+ <p>( meanwhile we are proving P = NP ...&#160; &#160;)</p>
+ <br>
+ <br>
+ <img src='/static/ajax-loader.gif' alt='ajax-loader'>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php require_once("static/foot.php"); ?>