forked from 4poc/php-live-transcode
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplayer.php
105 lines (96 loc) · 3.44 KB
/
player.php
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
<?php
require_once("includes/checklogin.inc.php");
require_once("includes/init.inc.php");
$transcode_args = array();
foreach($_POST as $key=>$value){
if(!empty($value) && $key != 'preset' && $key != 'bitrate'){
$transcode_args[] = $key.':'.$value;
}
}
//BASE_URL is required otherwise it won't work!
$transcode_url = BASE_URL . "stream.php/".implode(';', $transcode_args);
$transcode_url .= '/'.basename($mediafile);
$transcode_url .= "?media=" . urlencode($_GET['media']);
if($_POST['container'] == 'ogg' && $mediatype == 'video')
$transcode_url .= '.ogv';
else
$transcode_url .= '.'.$_POST['container'];
if(!empty($_POST['size'])){
$size = explode('x', $_POST['size']);
}
else {
$size[0] = $mediainfo->width;
$size[1] = $mediainfo->height;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="./css/style.css">
<link rel="shortcut icon" href="favicon.ico" >
<title>php-live-transcode</title>
<?php
if ($_POST['player'] == 'flash') { //flowplayer (flash version)
echo "<script src='flowplayer/flowplayer-3.2.13.min.js'></script>";
echo "<style type='text/css' media='screen'>";
echo "#flowplayer {";
echo "display: block;";
echo "width: " . $size[0] . "px;";
echo "height: " . $size[1] . "px;";
echo "}";
echo "</style>\n";
}
else if ($_POST['player'] == 'flowplayer-html5') { //flowplayer (HTML5 version)
//JQuery is required
echo "<script type='text/javascript' src='./javascript/jquery-1.11.3.min.js'></script>\n";
//player skin
echo "<link rel='stylesheet' type='text/css' href='./flowplayerhtml5/skin/minimalist.css' />\n";
echo "<script src='./flowplayerhtml5/flowplayer.min.js'></script>\n";
//http://flowplayer.org/docs/#video-size
echo "<style type='text/css' media='screen'>";
echo ".flowplayer {";
echo "width: " . $size[0] . "px;";
echo "height: " . $size[1] . "px;";
echo "}";
echo "</style>\n";
}
?>
</head>
<body>
<h1>Video Stream</h1>
<?php displayLoginInformation(); ?>
<div id="header-nav">
<p><a href="index.php">Select Video</a> -> <a href="create.php?media=<?php echo urlencode($_GET['media']); ?>">Pick Decoding Settings</a> -> <u>Watch Video</u></p>
</div>
<?php
//http://diveintohtml5.info/video.html
if ($_POST['player'] == 'html5') {
if ($mediatype == "video") {
echo "<video src='".$transcode_url."' width=".$size[0]." height=".$size[1]." preload controls> your browser must support html5/video tag</video>\n";
}
else {
echo "<audio src='".$transcode_url."' preload controls> your browser must support html5/audio tag</audio>\n";
}
}
else if ($_POST['player'] == 'flash') { //flowplayer (flash version)
echo "<div id='flowplayer'></div>\n";
echo "<script>\n";
echo "flowplayer('flowplayer', '".BASE_URL."flowplayer/flowplayer-3.2.18.swf', {clip: {url: '".$transcode_url."'}});";
echo "</script>\n";
}
else if ($_POST['player'] == 'flowplayer-html5') { //flowplayer (HTML5 version)
//http://flowplayer.org/docs/
//This will default to HTML5 but fallback to Flash if necessary
echo "<div class='flowplayer'>\n";
echo "<video>\n";
echo "<source src='".$transcode_url."'/>\n";
echo "</video>\n";
echo "</div>\n";
}
?>
<br><hr>
<center><a href="https://github.com/firefly2442/php-live-transcode/">php-live-transcode</a>
<br>Version: <?php echo VERSION;?></center>
</body>
</html>