1 |
|
|
2 |
|
/**
|
3 |
|
* Displays a help popup window
|
4 |
|
*/
|
5 |
|
tvheadend.help = function(title, pagename) {
|
6 |
|
Ext.Ajax.request({
|
7 |
|
url: 'docs/' + pagename,
|
8 |
|
success: function(result, request) {
|
9 |
|
|
10 |
|
var content = new Ext.Panel({
|
11 |
|
autoScroll:true,
|
12 |
|
border: false,
|
13 |
|
layout:'fit',
|
14 |
|
html: result.responseText
|
15 |
|
});
|
16 |
|
|
17 |
|
var win = new Ext.Window({
|
18 |
|
title: 'Help for ' + title,
|
19 |
|
layout: 'fit',
|
20 |
|
width: 900,
|
21 |
|
height: 400,
|
22 |
|
constrainHeader: true,
|
23 |
|
items: [content]
|
24 |
|
});
|
25 |
|
win.show();
|
26 |
|
|
27 |
|
}});
|
28 |
|
}
|
29 |
|
|
30 |
|
/**
|
31 |
|
* Displays a mediaplayer using VLC plugin
|
32 |
|
*/
|
33 |
|
tvheadend.VLC = function(url) {
|
34 |
|
|
35 |
|
function randomString() {
|
36 |
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
|
37 |
|
var string_length = 8;
|
38 |
|
var randomstring = '';
|
39 |
|
for (var i=0; i<string_length; i++) {
|
40 |
|
var rnum = Math.floor(Math.random() * chars.length);
|
41 |
|
randomstring += chars.substring(rnum,rnum+1);
|
42 |
|
}
|
43 |
|
return randomstring;
|
44 |
|
}
|
45 |
|
var vlc = document.createElement('embed');
|
46 |
|
vlc.setAttribute('type', 'application/x-vlc-plugin');
|
47 |
|
vlc.setAttribute('pluginspage', 'http://www.videolan.org');
|
48 |
|
vlc.setAttribute('version', 'VideoLAN.VLCPlugin.2');
|
49 |
|
vlc.setAttribute('width', '100%');
|
50 |
|
vlc.setAttribute('height', '100%');
|
51 |
|
vlc.setAttribute('autoplay', 'no');
|
52 |
|
vlc.setAttribute('id', randomString());
|
53 |
|
|
54 |
|
var missingPlugin = document.createElement('div');
|
55 |
|
missingPlugin.style.display = 'none';
|
56 |
|
missingPlugin.style.padding = '5px';
|
57 |
|
|
58 |
|
var selectChannel = new Ext.form.ComboBox({
|
59 |
|
loadingText: 'Loading...',
|
60 |
|
width: 200,
|
61 |
|
displayField:'name',
|
62 |
|
store: tvheadend.channels,
|
63 |
|
mode: 'local',
|
64 |
|
editable: false,
|
65 |
|
triggerAction: 'all',
|
66 |
|
emptyText: 'Select channel...'
|
67 |
|
});
|
68 |
|
|
69 |
|
selectChannel.on('select', function(c, r) {
|
70 |
|
var streamurl = 'stream/channelid/' + r.data.chid;
|
71 |
|
var playlisturl = 'playlist/channelid/' + r.data.chid;
|
72 |
|
|
73 |
|
// if the player was initialised, but not yet shown, make it visible
|
74 |
|
if (vlc.playlist && (vlc.style.display == 'none'))
|
75 |
|
vlc.style.display = 'block';
|
76 |
|
|
77 |
|
if(!vlc.playlist || vlc.playlist == 'undefined') {
|
78 |
|
missingPlugin.innerHTML = '<p>Embedded player could not be started. <br> You are probably missing VLC Mozilla plugin for your browser.</p>';
|
79 |
|
missingPlugin.innerHTML += '<p><a href="' + playlisturl + '">M3U Playlist</a></p>';
|
80 |
|
missingPlugin.innerHTML += '<p><a href="' + streamurl + '">Direct URL</a></p>';
|
81 |
|
}
|
82 |
|
else {
|
83 |
|
vlc.playlist.stop();
|
84 |
|
vlc.playlist.items.clear();
|
85 |
|
vlc.playlist.add(streamurl);
|
86 |
|
vlc.playlist.playItem(0);
|
87 |
|
vlc.audio.volume = slider.getValue();
|
88 |
|
}
|
89 |
|
}
|
90 |
|
);
|
91 |
|
|
92 |
|
var slider = new Ext.Slider({
|
93 |
|
width: 135,
|
94 |
|
height: 20,
|
95 |
|
value: 90,
|
96 |
|
increment: 1,
|
97 |
|
minValue: 0,
|
98 |
|
maxValue: 100
|
99 |
|
});
|
100 |
|
|
101 |
|
var sliderLabel = new Ext.form.Label();
|
102 |
|
sliderLabel.setText("90%");
|
103 |
|
slider.addListener('change', function() {
|
104 |
|
if(vlc.playlist && vlc.playlist.isPlaying) {
|
105 |
|
vlc.audio.volume = slider.getValue();
|
106 |
|
sliderLabel.setText(vlc.audio.volume + '%');
|
107 |
|
} else {
|
108 |
|
sliderLabel.setText(slider.getValue() + '%');
|
109 |
|
}
|
110 |
|
});
|
111 |
|
|
112 |
|
var win = new Ext.Window({
|
113 |
|
title: 'VLC Player',
|
114 |
|
layout:'fit',
|
115 |
|
width: 507 + 14,
|
116 |
|
height: 384 + 56,
|
117 |
|
constrainHeader: true,
|
118 |
|
iconCls: 'eye',
|
119 |
|
resizable: true,
|
120 |
|
tbar: [
|
121 |
|
selectChannel,
|
122 |
|
'-',
|
123 |
|
{
|
124 |
|
iconCls: 'control_play',
|
125 |
|
tooltip: 'Play',
|
126 |
|
handler: function() {
|
127 |
|
if(vlc.playlist && vlc.playlist.items.count && !vlc.playlist.isPlaying) {
|
128 |
|
vlc.playlist.play();
|
129 |
|
}
|
130 |
|
}
|
131 |
|
},
|
132 |
|
{
|
133 |
|
iconCls: 'control_pause',
|
134 |
|
tooltip: 'Pause',
|
135 |
|
handler: function() {
|
136 |
|
if(vlc.playlist && vlc.playlist.items.count) {
|
137 |
|
vlc.playlist.togglePause();
|
138 |
|
}
|
139 |
|
}
|
140 |
|
},
|
141 |
|
{
|
142 |
|
iconCls: 'control_stop',
|
143 |
|
tooltip: 'Stop',
|
144 |
|
handler: function() {
|
145 |
|
if(vlc.playlist) {
|
146 |
|
vlc.playlist.stop();
|
147 |
|
}
|
148 |
|
}
|
149 |
|
},
|
150 |
|
'-',
|
151 |
|
{
|
152 |
|
iconCls: 'control_fullscreen',
|
153 |
|
tooltip: 'Fullscreen',
|
154 |
|
handler: function() {
|
155 |
|
if(vlc.playlist && vlc.playlist.isPlaying && (vlc.VersionInfo.substr(0,3) != '1.1')) {
|
156 |
|
vlc.video.toggleFullscreen();
|
157 |
|
}
|
158 |
|
else if (vlc.VersionInfo.substr(0,3) == '1.1') {
|
159 |
|
alert('Fullscreen mode is broken in VLC 1.1.x');
|
160 |
|
}
|
161 |
|
}
|
162 |
|
},
|
163 |
|
'-',
|
164 |
|
{
|
165 |
|
iconCls: 'control_volume',
|
166 |
|
tooltip: 'Volume',
|
167 |
|
disabled: true
|
168 |
|
},
|
169 |
|
],
|
170 |
|
items: [vlc, missingPlugin]
|
171 |
|
});
|
172 |
|
|
173 |
|
win.on('beforeShow', function() {
|
174 |
|
win.getTopToolbar().add(slider);
|
175 |
|
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
|
176 |
|
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
|
177 |
|
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
|
178 |
|
win.getTopToolbar().add(sliderLabel);
|
179 |
|
|
180 |
|
// check if vlc plugin wasn't initialised correctly
|
181 |
|
if(!vlc.playlist || (vlc.playlist == 'undefined')) {
|
182 |
|
vlc.style.display = 'none';
|
183 |
|
|
184 |
|
missingPlugin.innerHTML = '<p>Embedded player could not be started. <br> You are probably missing VLC Mozilla plugin for your browser.</p>';
|
185 |
|
|
186 |
|
if (url) {
|
187 |
|
var channelid = url.substr(url.lastIndexOf('/'));
|
188 |
|
var streamurl = 'stream/channelid/' + channelid;
|
189 |
|
var playlisturl = 'playlist/channelid/' + channelid;
|
190 |
|
missingPlugin.innerHTML += '<p><a href="' + playlisturl + '">M3U Playlist</a></p>';
|
191 |
|
missingPlugin.innerHTML += '<p><a href="' + streamurl + '">Direct URL</a></p>';
|
192 |
|
}
|
193 |
|
|
194 |
|
missingPlugin.style.display = 'block';
|
195 |
|
}
|
196 |
|
else {
|
197 |
|
// check if the window was opened with an url-parameter
|
198 |
|
if (url) {
|
199 |
|
vlc.playlist.items.clear();
|
200 |
|
vlc.playlist.add(url);
|
201 |
|
vlc.playlist.playItem(0);
|
202 |
|
|
203 |
|
//enable yadif2x deinterlacer for vlc > 1.1
|
204 |
|
var point1 = vlc.VersionInfo.indexOf('.');
|
205 |
|
var point2 = vlc.VersionInfo.indexOf('.', point1+1);
|
206 |
|
var majVersion = vlc.VersionInfo.substring(0,point1);
|
207 |
|
var minVersion = vlc.VersionInfo.substring(point1+1,point2);
|
208 |
|
if ((majVersion >= 1) && (minVersion >= 1))
|
209 |
|
vlc.video.deinterlace.enable("yadif2x");
|
210 |
|
}
|
211 |
|
}
|
212 |
|
});
|
213 |
|
|
214 |
|
win.show();
|
215 |
|
};
|
216 |
|
|
217 |
|
/**
|
218 |
|
* This function creates top level tabs based on access so users without
|
219 |
|
* access to subsystems won't see them.
|
220 |
|
*
|
221 |
|
* Obviosuly, access is verified in the server too.
|
222 |
|
*/
|
223 |
|
function accessUpdate(o) {
|
224 |
|
|
225 |
|
if(o.dvr == true && tvheadend.dvrpanel == null) {
|
226 |
|
tvheadend.dvrpanel = new tvheadend.dvr;
|
227 |
|
tvheadend.rootTabPanel.add(tvheadend.dvrpanel);
|
228 |
|
}
|
229 |
|
|
230 |
|
if(o.admin == true && tvheadend.confpanel == null) {
|
231 |
|
tvheadend.confpanel = new Ext.TabPanel({
|
232 |
|
activeTab:0,
|
233 |
|
autoScroll:true,
|
234 |
|
title: 'Configuration',
|
235 |
|
iconCls: 'wrench',
|
236 |
|
items: [new tvheadend.chconf,
|
237 |
|
new tvheadend.xmltv,
|
238 |
|
new tvheadend.cteditor,
|
239 |
|
new tvheadend.dvrsettings,
|
240 |
|
new tvheadend.tvadapters,
|
241 |
|
new tvheadend.iptv,
|
242 |
|
new tvheadend.acleditor,
|
243 |
|
new tvheadend.cwceditor,
|
244 |
|
new tvheadend.capmteditor]
|
245 |
|
});
|
246 |
|
tvheadend.rootTabPanel.add(tvheadend.confpanel);
|
247 |
|
}
|
248 |
|
|
249 |
|
if(tvheadend.aboutPanel == null) {
|
250 |
|
tvheadend.aboutPanel = new Ext.Panel({
|
251 |
|
border: false,
|
252 |
|
layout:'fit',
|
253 |
|
title:'About',
|
254 |
|
iconCls:'info',
|
255 |
|
autoLoad: 'about.html'
|
256 |
|
});
|
257 |
|
tvheadend.rootTabPanel.add(tvheadend.aboutPanel);
|
258 |
|
}
|
259 |
|
|
260 |
|
tvheadend.rootTabPanel.doLayout();
|
261 |
|
}
|
262 |
|
|
263 |
|
|
264 |
|
/**
|
265 |
|
*
|
266 |
|
*/
|
267 |
|
function setServerIpPort(o) {
|
268 |
|
tvheadend.serverIp = o.ip;
|
269 |
|
tvheadend.serverPort = o.port;
|
270 |
|
}
|
271 |
|
|
272 |
|
function makeRTSPprefix() {
|
273 |
|
return 'rtsp://' + tvheadend.serverIp + ':' + tvheadend.serverPort + '/';
|
274 |
|
}
|
275 |
|
|
276 |
|
/**
|
277 |
|
*
|
278 |
|
*/
|
279 |
|
tvheadend.log = function(msg, style) {
|
280 |
|
s = style ? '<div style="' + style + '">' : '<div>'
|
281 |
|
|
282 |
|
sl = Ext.get('systemlog');
|
283 |
|
e = Ext.DomHelper.append(sl, s + '<pre>' + msg + '</pre></div>');
|
284 |
|
e.scrollIntoView('systemlog');
|
285 |
|
}
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
/**
|
290 |
|
*
|
291 |
|
*/
|
292 |
|
// create application
|
293 |
|
tvheadend.app = function() {
|
294 |
|
|
295 |
|
// public space
|
296 |
|
return {
|
297 |
|
|
298 |
|
// public methods
|
299 |
|
init: function() {
|
300 |
|
|
301 |
|
tvheadend.rootTabPanel = new Ext.TabPanel({
|
302 |
|
region:'center',
|
303 |
|
activeTab:0,
|
304 |
|
items:[new tvheadend.epg]
|
305 |
|
});
|
306 |
|
|
307 |
|
var viewport = new Ext.Viewport({
|
308 |
|
layout:'border',
|
309 |
|
items:[
|
310 |
|
{
|
311 |
|
region:'south',
|
312 |
|
contentEl: 'systemlog',
|
313 |
|
split:true,
|
314 |
|
autoScroll:true,
|
315 |
|
height: 150,
|
316 |
|
minSize: 100,
|
317 |
|
maxSize: 400,
|
318 |
|
collapsible: true,
|
319 |
|
title:'System log',
|
320 |
|
margins:'0 0 0 0',
|
321 |
|
tools:[{
|
322 |
|
id:'gear',
|
323 |
|
qtip: 'Enable debug output',
|
324 |
|
handler: function(event, toolEl, panel){
|
325 |
|
Ext.Ajax.request({
|
326 |
|
url: 'comet/debug',
|
327 |
|
params : {
|
328 |
|
boxid: tvheadend.boxid
|
329 |
|
}
|
330 |
|
});
|
331 |
|
}
|
332 |
|
}]
|
333 |
|
},tvheadend.rootTabPanel
|
334 |
|
]
|
335 |
|
});
|
336 |
|
|
337 |
|
tvheadend.comet.on('accessUpdate', accessUpdate);
|
338 |
|
|
339 |
|
tvheadend.comet.on('setServerIpPort', setServerIpPort);
|
340 |
|
|
341 |
|
tvheadend.comet.on('logmessage', function(m) {
|
342 |
|
tvheadend.log(m.logtxt);
|
343 |
|
});
|
344 |
|
|
345 |
|
new tvheadend.cometPoller;
|
346 |
|
|
347 |
|
Ext.QuickTips.init();
|
348 |
|
}
|
349 |
|
|
350 |
|
};
|
351 |
|
}(); // end of app
|
352 |
|
|
|
1 |
|
|
2 |
/**
|
|
3 |
* Displays a help popup window
|
|
4 |
*/
|
|
5 |
tvheadend.help = function(title, pagename) {
|
|
6 |
Ext.Ajax.request({
|
|
7 |
url: 'docs/' + pagename,
|
|
8 |
success: function(result, request) {
|
|
9 |
|
|
10 |
var content = new Ext.Panel({
|
|
11 |
autoScroll:true,
|
|
12 |
border: false,
|
|
13 |
layout:'fit',
|
|
14 |
html: result.responseText
|
|
15 |
});
|
|
16 |
|
|
17 |
var win = new Ext.Window({
|
|
18 |
title: 'Help for ' + title,
|
|
19 |
layout: 'fit',
|
|
20 |
width: 900,
|
|
21 |
height: 400,
|
|
22 |
constrainHeader: true,
|
|
23 |
items: [content]
|
|
24 |
});
|
|
25 |
win.show();
|
|
26 |
|
|
27 |
}});
|
|
28 |
}
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Displays a mediaplayer using VLC plugin
|
|
32 |
*/
|
|
33 |
tvheadend.VLC = function(url) {
|
|
34 |
|
|
35 |
function randomString() {
|
|
36 |
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
|
|
37 |
var string_length = 8;
|
|
38 |
var randomstring = '';
|
|
39 |
for (var i=0; i<string_length; i++) {
|
|
40 |
var rnum = Math.floor(Math.random() * chars.length);
|
|
41 |
randomstring += chars.substring(rnum,rnum+1);
|
|
42 |
}
|
|
43 |
return randomstring;
|
|
44 |
}
|
|
45 |
var vlc = document.createElement('embed');
|
|
46 |
vlc.setAttribute('type', 'application/x-vlc-plugin');
|
|
47 |
vlc.setAttribute('pluginspage', 'http://www.videolan.org');
|
|
48 |
vlc.setAttribute('version', 'VideoLAN.VLCPlugin.2');
|
|
49 |
vlc.setAttribute('width', '100%');
|
|
50 |
vlc.setAttribute('height', '100%');
|
|
51 |
vlc.setAttribute('autoplay', 'no');
|
|
52 |
vlc.setAttribute('id', randomString());
|
|
53 |
|
|
54 |
var missingPlugin = document.createElement('div');
|
|
55 |
missingPlugin.style.display = 'none';
|
|
56 |
missingPlugin.style.padding = '5px';
|
|
57 |
|
|
58 |
var selectChannel = new Ext.form.ComboBox({
|
|
59 |
loadingText: 'Loading...',
|
|
60 |
width: 200,
|
|
61 |
displayField:'name',
|
|
62 |
store: tvheadend.channels,
|
|
63 |
mode: 'local',
|
|
64 |
editable: false,
|
|
65 |
triggerAction: 'all',
|
|
66 |
emptyText: 'Select channel...'
|
|
67 |
});
|
|
68 |
|
|
69 |
selectChannel.on('select', function(c, r) {
|
|
70 |
var streamurl = 'stream/channelid/' + r.data.chid;
|
|
71 |
var playlisturl = 'playlist/channelid/' + r.data.chid;
|
|
72 |
|
|
73 |
// if the player was initialised, but not yet shown, make it visible
|
|
74 |
if (vlc.playlist && (vlc.style.display == 'none'))
|
|
75 |
vlc.style.display = 'block';
|
|
76 |
|
|
77 |
if(!vlc.playlist || vlc.playlist == 'undefined') {
|
|
78 |
missingPlugin.innerHTML = '<p>Embedded player could not be started. <br> You are probably missing VLC Mozilla plugin for your browser.</p>';
|
|
79 |
missingPlugin.innerHTML += '<p><a href="' + playlisturl + '">M3U Playlist</a></p>';
|
|
80 |
missingPlugin.innerHTML += '<p><a href="' + streamurl + '">Direct URL</a></p>';
|
|
81 |
}
|
|
82 |
else {
|
|
83 |
vlc.playlist.stop();
|
|
84 |
vlc.playlist.items.clear();
|
|
85 |
vlc.playlist.add(streamurl);
|
|
86 |
vlc.playlist.playItem(0);
|
|
87 |
vlc.audio.volume = slider.getValue();
|
|
88 |
}
|
|
89 |
}
|
|
90 |
);
|
|
91 |
|
|
92 |
var slider = new Ext.Slider({
|
|
93 |
width: 135,
|
|
94 |
height: 20,
|
|
95 |
value: 90,
|
|
96 |
increment: 1,
|
|
97 |
minValue: 0,
|
|
98 |
maxValue: 100
|
|
99 |
});
|
|
100 |
|
|
101 |
var sliderLabel = new Ext.form.Label();
|
|
102 |
sliderLabel.setText("90%");
|
|
103 |
slider.addListener('change', function() {
|
|
104 |
if(vlc.playlist && vlc.playlist.isPlaying) {
|
|
105 |
vlc.audio.volume = slider.getValue();
|
|
106 |
sliderLabel.setText(vlc.audio.volume + '%');
|
|
107 |
} else {
|
|
108 |
sliderLabel.setText(slider.getValue() + '%');
|
|
109 |
}
|
|
110 |
});
|
|
111 |
|
|
112 |
var subtitles = 0;
|
|
113 |
|
|
114 |
var win = new Ext.Window({
|
|
115 |
title: 'VLC Player',
|
|
116 |
layout:'fit',
|
|
117 |
width: 507 + 14,
|
|
118 |
height: 384 + 56,
|
|
119 |
constrainHeader: true,
|
|
120 |
iconCls: 'eye',
|
|
121 |
resizable: true,
|
|
122 |
tbar: [
|
|
123 |
selectChannel,
|
|
124 |
'-',
|
|
125 |
{
|
|
126 |
iconCls: 'control_play',
|
|
127 |
tooltip: 'Play',
|
|
128 |
handler: function() {
|
|
129 |
if(vlc.playlist && vlc.playlist.items.count && !vlc.playlist.isPlaying) {
|
|
130 |
vlc.playlist.play();
|
|
131 |
}
|
|
132 |
}
|
|
133 |
},
|
|
134 |
{
|
|
135 |
iconCls: 'control_pause',
|
|
136 |
tooltip: 'Pause',
|
|
137 |
handler: function() {
|
|
138 |
if(vlc.playlist && vlc.playlist.items.count) {
|
|
139 |
vlc.playlist.togglePause();
|
|
140 |
}
|
|
141 |
}
|
|
142 |
},
|
|
143 |
{
|
|
144 |
iconCls: 'control_stop',
|
|
145 |
tooltip: 'Stop',
|
|
146 |
handler: function() {
|
|
147 |
if(vlc.playlist) {
|
|
148 |
vlc.playlist.stop();
|
|
149 |
}
|
|
150 |
}
|
|
151 |
},
|
|
152 |
'-',
|
|
153 |
{
|
|
154 |
iconCls: 'control_fullscreen',
|
|
155 |
tooltip: 'Fullscreen',
|
|
156 |
handler: function() {
|
|
157 |
if(vlc.playlist && vlc.playlist.isPlaying && (vlc.VersionInfo.substr(0,3) != '1.1')) {
|
|
158 |
vlc.video.toggleFullscreen();
|
|
159 |
}
|
|
160 |
else if (vlc.VersionInfo.substr(0,3) == '1.1') {
|
|
161 |
alert('Fullscreen mode is broken in VLC 1.1.x');
|
|
162 |
}
|
|
163 |
}
|
|
164 |
},
|
|
165 |
'-',
|
|
166 |
{
|
|
167 |
iconCls: 'control_subtitles',
|
|
168 |
tooltip: 'Subtitles',
|
|
169 |
handler: function() {
|
|
170 |
subtitles++; // Cycle subtitles.
|
|
171 |
setSubtitles(vlc, subtitles);
|
|
172 |
}
|
|
173 |
},
|
|
174 |
'-',
|
|
175 |
{
|
|
176 |
iconCls: 'control_volume',
|
|
177 |
tooltip: 'Volume',
|
|
178 |
disabled: true
|
|
179 |
},
|
|
180 |
],
|
|
181 |
items: [vlc, missingPlugin]
|
|
182 |
});
|
|
183 |
|
|
184 |
win.on('beforeShow', function() {
|
|
185 |
win.getTopToolbar().add(slider);
|
|
186 |
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
|
|
187 |
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
|
|
188 |
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
|
|
189 |
win.getTopToolbar().add(sliderLabel);
|
|
190 |
|
|
191 |
// check if vlc plugin wasn't initialised correctly
|
|
192 |
if(!vlc.playlist || (vlc.playlist == 'undefined')) {
|
|
193 |
vlc.style.display = 'none';
|
|
194 |
|
|
195 |
missingPlugin.innerHTML = '<p>Embedded player could not be started. <br> You are probably missing VLC Mozilla plugin for your browser.</p>';
|
|
196 |
|
|
197 |
if (url) {
|
|
198 |
var channelid = url.substr(url.lastIndexOf('/'));
|
|
199 |
var streamurl = 'stream/channelid/' + channelid;
|
|
200 |
var playlisturl = 'playlist/channelid/' + channelid;
|
|
201 |
missingPlugin.innerHTML += '<p><a href="' + playlisturl + '">M3U Playlist</a></p>';
|
|
202 |
missingPlugin.innerHTML += '<p><a href="' + streamurl + '">Direct URL</a></p>';
|
|
203 |
}
|
|
204 |
|
|
205 |
missingPlugin.style.display = 'block';
|
|
206 |
}
|
|
207 |
else {
|
|
208 |
// check if the window was opened with an url-parameter
|
|
209 |
if (url) {
|
|
210 |
vlc.playlist.items.clear();
|
|
211 |
vlc.playlist.add(url);
|
|
212 |
vlc.playlist.playItem(0);
|
|
213 |
|
|
214 |
//enable yadif2x deinterlacer for vlc > 1.1
|
|
215 |
var point1 = vlc.VersionInfo.indexOf('.');
|
|
216 |
var point2 = vlc.VersionInfo.indexOf('.', point1+1);
|
|
217 |
var majVersion = vlc.VersionInfo.substring(0,point1);
|
|
218 |
var minVersion = vlc.VersionInfo.substring(point1+1,point2);
|
|
219 |
if ((majVersion >= 1) && (minVersion >= 1))
|
|
220 |
vlc.video.deinterlace.enable("yadif2x");
|
|
221 |
}
|
|
222 |
}
|
|
223 |
});
|
|
224 |
|
|
225 |
win.show();
|
|
226 |
setTimeout(function() {setSubtitles(vlc, 0)}, 3000); // Turn off subtitles by default.
|
|
227 |
};
|
|
228 |
|
|
229 |
/**
|
|
230 |
* This function tries to enable subtitles.
|
|
231 |
*/
|
|
232 |
function setSubtitles(vlc, lang) {
|
|
233 |
if(vlc.input.state==3) {
|
|
234 |
if(vlc.subtitle.count > 0) {
|
|
235 |
var currentLang = lang % vlc.subtitle.count;
|
|
236 |
vlc.subtitle.track=currentLang;
|
|
237 |
vlc.video.marquee.text="";
|
|
238 |
vlc.video.marquee.disable();
|
|
239 |
vlc.video.marquee.enable();
|
|
240 |
vlc.video.marquee.text="Subtitles: " + vlc.subtitle.description(currentLang);
|
|
241 |
vlc.video.marquee.timeout=2000;
|
|
242 |
}
|
|
243 |
}
|
|
244 |
}
|
|
245 |
|
|
246 |
|
|
247 |
/**
|
|
248 |
* This function creates top level tabs based on access so users without
|
|
249 |
* access to subsystems won't see them.
|
|
250 |
*
|
|
251 |
* Obviosuly, access is verified in the server too.
|
|
252 |
*/
|
|
253 |
function accessUpdate(o) {
|
|
254 |
|
|
255 |
if(o.dvr == true && tvheadend.dvrpanel == null) {
|
|
256 |
tvheadend.dvrpanel = new tvheadend.dvr;
|
|
257 |
tvheadend.rootTabPanel.add(tvheadend.dvrpanel);
|
|
258 |
}
|
|
259 |
|
|
260 |
if(o.admin == true && tvheadend.confpanel == null) {
|
|
261 |
tvheadend.confpanel = new Ext.TabPanel({
|
|
262 |
activeTab:0,
|
|
263 |
autoScroll:true,
|
|
264 |
title: 'Configuration',
|
|
265 |
iconCls: 'wrench',
|
|
266 |
items: [new tvheadend.chconf,
|
|
267 |
new tvheadend.xmltv,
|
|
268 |
new tvheadend.cteditor,
|
|
269 |
new tvheadend.dvrsettings,
|
|
270 |
new tvheadend.tvadapters,
|
|
271 |
new tvheadend.iptv,
|
|
272 |
new tvheadend.acleditor,
|
|
273 |
new tvheadend.cwceditor,
|
|
274 |
new tvheadend.capmteditor]
|
|
275 |
});
|
|
276 |
tvheadend.rootTabPanel.add(tvheadend.confpanel);
|
|
277 |
}
|
|
278 |
|
|
279 |
if(tvheadend.aboutPanel == null) {
|
|
280 |
tvheadend.aboutPanel = new Ext.Panel({
|
|
281 |
border: false,
|
|
282 |
layout:'fit',
|
|
283 |
title:'About',
|
|
284 |
iconCls:'info',
|
|
285 |
autoLoad: 'about.html'
|
|
286 |
});
|
|
287 |
tvheadend.rootTabPanel.add(tvheadend.aboutPanel);
|
|
288 |
}
|
|
289 |
|
|
290 |
tvheadend.rootTabPanel.doLayout();
|
|
291 |
}
|
|
292 |
|
|
293 |
|
|
294 |
/**
|
|
295 |
*
|
|
296 |
*/
|
|
297 |
function setServerIpPort(o) {
|
|
298 |
tvheadend.serverIp = o.ip;
|
|
299 |
tvheadend.serverPort = o.port;
|
|
300 |
}
|
|
301 |
|
|
302 |
function makeRTSPprefix() {
|
|
303 |
return 'rtsp://' + tvheadend.serverIp + ':' + tvheadend.serverPort + '/';
|
|
304 |
}
|
|
305 |
|
|
306 |
/**
|
|
307 |
*
|
|
308 |
*/
|
|
309 |
tvheadend.log = function(msg, style) {
|
|
310 |
s = style ? '<div style="' + style + '">' : '<div>'
|
|
311 |
|
|
312 |
sl = Ext.get('systemlog');
|
|
313 |
e = Ext.DomHelper.append(sl, s + '<pre>' + msg + '</pre></div>');
|
|
314 |
e.scrollIntoView('systemlog');
|
|
315 |
}
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
/**
|
|
320 |
*
|
|
321 |
*/
|
|
322 |
// create application
|
|
323 |
tvheadend.app = function() {
|
|
324 |
|
|
325 |
// public space
|
|
326 |
return {
|
|
327 |
|
|
328 |
// public methods
|
|
329 |
init: function() {
|
|
330 |
|
|
331 |
tvheadend.rootTabPanel = new Ext.TabPanel({
|
|
332 |
region:'center',
|
|
333 |
activeTab:0,
|
|
334 |
items:[new tvheadend.epg]
|
|
335 |
});
|
|
336 |
|
|
337 |
var viewport = new Ext.Viewport({
|
|
338 |
layout:'border',
|
|
339 |
items:[
|
|
340 |
{
|
|
341 |
region:'south',
|
|
342 |
contentEl: 'systemlog',
|
|
343 |
split:true,
|
|
344 |
autoScroll:true,
|
|
345 |
height: 150,
|
|
346 |
minSize: 100,
|
|
347 |
maxSize: 400,
|
|
348 |
collapsible: true,
|
|
349 |
title:'System log',
|
|
350 |
margins:'0 0 0 0',
|
|
351 |
tools:[{
|
|
352 |
id:'gear',
|
|
353 |
qtip: 'Enable debug output',
|
|
354 |
handler: function(event, toolEl, panel){
|
|
355 |
Ext.Ajax.request({
|
|
356 |
url: 'comet/debug',
|
|
357 |
params : {
|
|
358 |
boxid: tvheadend.boxid
|
|
359 |
}
|
|
360 |
});
|
|
361 |
}
|
|
362 |
}]
|
|
363 |
},tvheadend.rootTabPanel
|
|
364 |
]
|
|
365 |
});
|
|
366 |
|
|
367 |
tvheadend.comet.on('accessUpdate', accessUpdate);
|
|
368 |
|
|
369 |
tvheadend.comet.on('setServerIpPort', setServerIpPort);
|
|
370 |
|
|
371 |
tvheadend.comet.on('logmessage', function(m) {
|
|
372 |
tvheadend.log(m.logtxt);
|
|
373 |
});
|
|
374 |
|
|
375 |
new tvheadend.cometPoller;
|
|
376 |
|
|
377 |
Ext.QuickTips.init();
|
|
378 |
}
|
|
379 |
|
|
380 |
};
|
|
381 |
}(); // end of app
|
|
382 |
|