From 114ac7c3fd96a7d50ef358a5687391d96dc7b40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Thu, 6 Jan 2011 02:18:33 +0800 Subject: [PATCH] Provide a link to the http stream when the browser is missing a vlc-compatible plugin. --- src/webui/static/app/tvheadend.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js index ccb8feb6..a2047b09 100644 --- a/src/webui/static/app/tvheadend.js +++ b/src/webui/static/app/tvheadend.js @@ -45,6 +45,10 @@ tvheadend.VLC = function(url) { vlc.style.display = 'none'; } + var missingPlugin = document.createElement('div'); + missingPlugin.style.display = 'none'; + missingPlugin.style.padding = '5px'; + var selectChannel = new Ext.form.ComboBox({ loadingText: 'Loading...', width: 200, @@ -59,8 +63,20 @@ tvheadend.VLC = function(url) { selectChannel.on('select', function(c, r) { var url = 'stream/channelid/' + r.data.chid; var chName = r.data.name; + if (!chName.length) { + chName = 'the channel'; + } + + if(!vlc.playlist || vlc.playlist == 'undefined') { + var chUrl = '' + chName + ''; + missingPlugin.innerHTML = '

You are missing a plugin for your browser.

'; + missingPlugin.innerHTML += '

You can still watch ' + chUrl + ' using an external player.

'; + missingPlugin.style.display = 'block'; + return; + } + vlc.style.display = 'block'; - + if(vlc.playlist && vlc.playlist.isPlaying) { vlc.playlist.stop(); } @@ -150,7 +166,7 @@ tvheadend.VLC = function(url) { disabled: true }, ], - items: [vlc] + items: [vlc, missingPlugin] }); win.on('render', function() {