summaryrefslogtreecommitdiff
path: root/pages/vlc.ecpp
blob: 865b6bdbf50d07db8c47bcc400c1f2c1f6edc2df (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
<%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;
</%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");

	pageTitle = tr("VLC: live video stream");

	bool asyncReq = !async.empty() && (lexical_cast<int>(async) != 0);

	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?") );
	}
</%cpp>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ pageTitle $></title>
<%cpp>
	if (!asyncReq) {
</%cpp>
		<& pageelems.stylesheets &>
		<& pageelems.ajax_js &>
<%cpp>
	}
</%cpp>
	</head>
	<body>
<%cpp>
	if (!asyncReq) {
</%cpp>
		<& pageelems.logo &>
		<& menu active="vlc" &>
<%cpp>
	}
</%cpp>
		<div class="inhalt">
<%cpp>
		if ( Channel != 0 ) {
			int streamdevPort = LiveSetup().GetStreamdevPort();
			string videourl = string("http://") + request.getServerIp() + ":" + lexical_cast<string,int>(streamdevPort) + "/" + *Channel->GetChannelID().ToString();
</%cpp>
			<embed type="application/x-vlc-plugin" name="video1" autoplay="no" loop="yes" width="400" height="300" target="<$ videourl $>" />
	   		<& vlc.channel_selection &>
<%cpp>
		}
</%cpp>
		</div>
	</body>
</html>
<%include>page_exit.eh</%include>

<%def channel_selection>
<div>
<input type="button" value="Play" onclick="document.video1.play();" />
<input type="button" value="Pause" onclick="document.video1.pause();" />
<input type="button" value="Stop" onclick="document.video1.stop();" />
<input type="button" value="Mute" onclick="document.video1.mute();" />
<input type="button" value="Fullscreen"  onclick="document.video1.fullscreen();" />
</div>
</%def>