forked from doletsky/slavmir
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
142 lines (134 loc) · 4.89 KB
/
Copy pathtest.php
File metadata and controls
142 lines (134 loc) · 4.89 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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="/bitrix/templates/slavmir/js/jquery-2.2.3.min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.js"></script>
<!-- <script type="text/javascript" charset="utf-8" src="j/main.js"></script>-->
<!-- <script type="text/javascript" charset="utf-8" src="j/editor/ace.js"></script>-->
<!-- <link rel="stylesheet" href="stylesheets/bootstrap.min.css" type="text/css" media="screen" charset="utf-8">-->
<!-- <link rel="stylesheet" href="stylesheets/bootstrap-theme.min.css" type="text/css" media="screen" charset="utf-8">-->
<!-- <link rel="stylesheet" href="stylesheets/style.css" type="text/css" media="screen" charset="utf-8">-->
<!-- <link rel="shortcut icon" type="image/png" href="i/favico.png">-->
<script>
window.clappr = window.clappr || {}
window.clappr.externals = []
function addExternal() {
var url = document.getElementById('js-link')
window.clappr.externals.push(url.value)
addTag(url.value)
url.value = ''
}
function addTag(url) {
var colors = ["aliceblue", "antiquewhite", "azure", "black", "blue", "brown", "yellow", "teal"]
var color = colors[Math.floor(Math.random() * colors.length)]
var span = document.createElement('span')
span.style.backgroundColor = color
span.className = "external-js"
span.innerText = url.split(/\//).pop().split(/\./)[0]
document.getElementById('external-js-panel').appendChild(span)
}
</script>
</head>
<body>
<header class="header"></header>
<section class="container">
<div class="main">
<div id="output">
<div id="player-wrapper" class="player"></div>
</div>
</div>
<div class="sidebar">
<div id="console"> </div>
</div>
</section>
<footer class="footer"></footer>
<?php
$t=time();
$str=str_replace(PHP_EOL,',', file_get_contents('http://83.217.203.202:1935/live/slavmir/playlist.m3u8'));
$tRq=time()-$t;
?>
<script>
$.post("/ajax/log-player.php", {
name: <?=$t?>,
m3u8_data: '<?=$str?>',
m3u8_req: <?=$tRq?>,
client: navigator.userAgent,
step: 1
});
// var urlParams;
// (function() {
// window.onpopstate = function () {
// var match,
// pl = /\+/g, // Regex for replacing addition symbol with a space
// search = /([^&=]+)=?([^&]*)/g,
// decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
// query = window.location.search.substring(1);
//
// urlParams = {};
// while (match = search.exec(query))
// urlParams[decode(match[1])] = decode(match[2]);
// }
// window.onpopstate();
// })();
var playerElement = document.getElementById("player-wrapper");
var err;
var player = new Clappr.Player({
source: 'http://83.217.203.202:1935/live/slavmir/playlist.m3u8',
// poster: 'http://clappr.io/poster.png',
mute: true,
height: 360,
width: 640,
events: {
onError: function (e) {
err=e;
}
}
});
player.attachTo(playerElement);
player.play();
$.post('/ajax/log-player.php', {
name: <?=$t?>,
m3u8_start: '<?=time()-$t?>',
m3u8_error: <?=$tRq?>,
error: err,
step: 2
});
//editor
// window.onload = function() {
// var editor = ace.edit("editor");
// var session = editor.getSession();
//
// editor.setTheme("ace/theme/katzenmilch");
// session.setMode("ace/mode/javascript");
// session.setTabSize(2);
// session.setUseSoftTabs(true);
//
// var parser = new Parser($('#output'));
// var load = function(fn) {
// if (window.clappr.externals.length > 0) {
// var lastScript = window.clappr.externals.length
// window.clappr.externals.forEach(function(url, index) {
// var script = document.createElement('script')
//
// script.setAttribute("type", "text/javascript")
// script.setAttribute("src", url)
// if (index === (lastScript - 1)) {
// script.onload = fn
// }
// script.onerror = function(e){alert('we cant load ' + url + ': e' + e)}
//
// document.body.appendChild(script)
// })
// } else {
// fn()
// }
// }
//
// $('.run').click(function() {
// var code = ace.edit('editor').getSession().getValue();
// load(function(){parser.parse(code)})
// });
// }
</script>
</body>
</html>