From 04e270362b2ae251cefa263d2f71409d239b7c30 Mon Sep 17 00:00:00 2001 From: sb1066 Date: Sat, 30 Oct 2010 08:16:11 +0000 Subject: [PATCH] Don't hide the embedded vlc plugin when a url is passed as an argument to the constructor. Also some cleaning --- src/webui/static/app/tvheadend.js | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js index aabd67d4..ccb8feb6 100644 --- a/src/webui/static/app/tvheadend.js +++ b/src/webui/static/app/tvheadend.js @@ -41,10 +41,10 @@ tvheadend.VLC = function(url) { vlc.setAttribute('id', 'vlc'); if(url) { vlc.setAttribute('src', url); + } else { + vlc.style.display = 'none'; } - vlc.style.display = 'none'; - var selectChannel = new Ext.form.ComboBox({ loadingText: 'Loading...', width: 200, @@ -60,11 +60,11 @@ tvheadend.VLC = function(url) { var url = 'stream/channelid/' + r.data.chid; var chName = r.data.name; vlc.style.display = 'block'; - - if(vlc.playlist.isPlaying) { + + if(vlc.playlist && vlc.playlist.isPlaying) { vlc.playlist.stop(); } - if(vlc.playlist.items.count) { + if(vlc.playlist && vlc.playlist.items.count) { vlc.playlist.items.clear(); } @@ -86,7 +86,7 @@ tvheadend.VLC = function(url) { var sliderLabel = new Ext.form.Label(); sliderLabel.setText("90%"); slider.addListener('change', function() { - if(vlc.playlist.isPlaying) { + if(vlc.playlist && vlc.playlist.isPlaying) { vlc.audio.volume = slider.getValue(); sliderLabel.setText(vlc.audio.volume + '%'); } else { @@ -109,7 +109,7 @@ tvheadend.VLC = function(url) { iconCls: 'control_play', tooltip: 'Play', handler: function() { - if(vlc.playlist.items.count && !vlc.playlist.isPlaying) { + if(vlc.playlist && vlc.playlist.items.count && !vlc.playlist.isPlaying) { vlc.playlist.play(); } } @@ -118,7 +118,7 @@ tvheadend.VLC = function(url) { iconCls: 'control_pause', tooltip: 'Pause', handler: function() { - if(vlc.playlist.items.count) { + if(vlc.playlist && vlc.playlist.items.count) { vlc.playlist.togglePause(); } } @@ -127,7 +127,7 @@ tvheadend.VLC = function(url) { iconCls: 'control_stop', tooltip: 'Stop', handler: function() { - if(vlc.playlist.items.count) { + if(vlc.playlist && vlc.playlist.items.count) { vlc.playlist.stop(); vlc.style.display = 'none'; } @@ -138,7 +138,7 @@ tvheadend.VLC = function(url) { iconCls: 'control_fullscreen', tooltip: 'Fullscreen', handler: function() { - if(vlc.playlist.isPlaying) { + if(vlc.playlist && vlc.playlist.isPlaying) { vlc.video.toggleFullscreen(); } } @@ -151,14 +151,14 @@ tvheadend.VLC = function(url) { }, ], items: [vlc] - }); + }); - win.on('render', function() { - win.getTopToolbar().add(slider); - win.getTopToolbar().add(new Ext.Toolbar.Spacer()); - win.getTopToolbar().add(new Ext.Toolbar.Spacer()); - win.getTopToolbar().add(new Ext.Toolbar.Spacer()); - win.getTopToolbar().add(sliderLabel); + win.on('render', function() { + win.getTopToolbar().add(slider); + win.getTopToolbar().add(new Ext.Toolbar.Spacer()); + win.getTopToolbar().add(new Ext.Toolbar.Spacer()); + win.getTopToolbar().add(new Ext.Toolbar.Spacer()); + win.getTopToolbar().add(sliderLabel); }); win.show();