blob: 050f716ef14140d436e723d0b7e9fcf5a74c26bd (
plain)
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
|
<%pre>
#include <vdr/channels.h>
#include <vdr/i18n.h>
#include <vdr/keys.h>
#include "setup.h"
#include "tools.h"
using namespace std;
using namespace vdrlive;
</%pre>
<%args>
tChannelID channel;
string async;
string recid;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%request scope="page">
cChannel* Channel;
</%request>
<%include>page_init.eh</%include>
<%cpp>
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
bool asyncReq = !async.empty() && (lexical_cast<int>(async) != 0);
// the availabilty of Channel signals that we will do live tv streaming.
Channel = 0;
if (recid.empty()) {
pageTitle = tr("VLC: live video stream");
ReadLock channelsLock(Channels);
if (!channelsLock) {
throw HtmlError(tr("Couldn't aquire access to channels, please try again later."));
}
Channel = Channels.GetByChannelID(channel);
if (Channel == 0) {
throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") );
}
}
else {
pageTitle = tr("VLC: play recording");
}
</%cpp>
<& pageelems.doc_type &>
<html>
<head>
<title>VDR-Live - <$ pageTitle $></title>
<& pageelems.stylesheets &>
<%cpp>
if (!asyncReq) {
</%cpp>
<& pageelems.ajax_js &>
<%cpp>
}
else {
</%cpp>
<script type="text/javascript" src="js/mootools/mootools.v1.11.js"></script>
<%cpp>
}
</%cpp>
<script type="text/javascript" src="js/live/vlc.js"></script>
<script type="text/javascript"><!--
var vlcControl = new VLC("video1", {
<? !asyncReq ? "autoresize: false," ?>
<? !Channel ? "playRecording: true," ?>
offset: 5
});
vlcControl.addEvent('toggle', function(id, state){
var text = null;
switch (id) {
case "TogglePlay":
text = state ? "<$ tr("Stop") $>" : "<$ tr("Play") $>";
break;
case "ToggleMute":
text = state ? "<$ tr("Sound on") $>" : "<$ tr("Sound off") $>";
break;
}
if (text)
$(id).setHTML(text);
});
--></script>
</head>
<body>
<%cpp>
if (!asyncReq) {
</%cpp>
<& pageelems.logo &>
<& menu active="vlc" &>
<div class="inhalt">
<%cpp>
}
</%cpp>
<%cpp>
#if TNTVERSION >= 1606
string server = request.getHost();
if (Channel != 0) {
server = server.substr(0, server.rfind(':'));
}
#else
string server = request.getServerIp();
#endif
string videourl;
if (Channel != 0) {
int streamdevPort = LiveSetup().GetStreamdevPort();
videourl = string("http://") + server + ":" + lexical_cast<string,int>(streamdevPort) + "/" + LiveSetup().GetStreamdevType() + "/" + *Channel->GetChannelID().ToString();
}
else {
#if TNTVERSION >= 1606
# define SERVER_AND_PORT server
#else
# define SERVER_AND_PORT server + ":" + lexical_cast<string,int>(LiveSetup().GetServerPort());
#endif
videourl = string("http://") + SERVER_AND_PORT + "/recstream.html?recid=" + recid;
}
</%cpp>
<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org/" version="VideoLAN.VLCPlugin.2" id="video1" name="video1" autoplay="yes" loop="no" width="720" height="576" target="<$ videourl $>" />
<& vlc.controls videourl=(videourl) asyncReq=(asyncReq) &>
<%cpp>
if (!asyncReq) {
</%cpp>
</div>
<%cpp>
}
</%cpp>
</body>
</html>
<%include>page_exit.eh</%include>
<%def controls>
<%args>
string videourl;
bool asyncReq;
</%args>
<div id="vlcControls">
<button id="TogglePlay" type="button" class="green"><$ tr("Stop") $></button>
<button id="ToggleMute" type="button" class="red"><$ tr("Sound off") $></button>
<button id="FullScreen" type="button" class="blue"><$ tr("Fullscreen") $></button>
<%cpp>
if (asyncReq) {
</%cpp>
<button id="Close" type="button" class="yellow"><$ tr("Close") $></button>
<%cpp>
}
</%cpp>
<!-- --><p><$ tr("VLC media URL") $>: <span class="bold"><a href="<$ videourl $>"><$ videourl $></a></span></p><!-- -->
</div>
</%def>
|