--- tvheadend-git/src/webui/static/app/tvheadend.js 2011-04-13 09:01:13.751138001 +0200 +++ tvheadend/src/webui/static/app/tvheadend.js 2011-04-14 01:28:40.000000000 +0200 @@ -31,24 +31,30 @@ tvheadend.help = function(title, pagenam * Displays a mediaplayer using VLC plugin */ tvheadend.VLC = function(url) { + + function randomString() { + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; + var string_length = 8; + var randomstring = ''; + for (var i=0; iM3U Playlist

'; - innerHTML += '

Direct URL

'; - - missingPlugin.innerHTML = innerHTML; - vlc.style.display = 'none'; - missingPlugin.style.display = 'block'; - return; + missingPlugin.innerHTML = '

Embedded player could not be started.
You are probably missing VLC Mozilla plugin for your browser.

'; + missingPlugin.innerHTML += '

M3U Playlist

'; + missingPlugin.innerHTML += '

Direct URL

'; } - - if(vlc.playlist && vlc.playlist.isPlaying) { + else { vlc.playlist.stop(); - } - if(vlc.playlist && vlc.playlist.items.count) { - vlc.playlist.items.clear(); - } - - vlc.playlist.add(url, chName, ""); - vlc.playlist.play(); - vlc.audio.volume = slider.getValue(); + vlc.playlist.items.clear(); + vlc.playlist.add(streamurl); + vlc.playlist.playItem(0); + vlc.audio.volume = slider.getValue(); + } } ); @@ -125,7 +116,7 @@ tvheadend.VLC = function(url) { height: 384 + 56, constrainHeader: true, iconCls: 'eye', - resizable: false, + resizable: true, tbar: [ selectChannel, '-', @@ -151,9 +142,8 @@ tvheadend.VLC = function(url) { iconCls: 'control_stop', tooltip: 'Stop', handler: function() { - if(vlc.playlist && vlc.playlist.items.count) { + if(vlc.playlist) { vlc.playlist.stop(); - vlc.style.display = 'none'; } } }, @@ -162,9 +152,12 @@ tvheadend.VLC = function(url) { iconCls: 'control_fullscreen', tooltip: 'Fullscreen', handler: function() { - if(vlc.playlist && vlc.playlist.isPlaying) { + if(vlc.playlist && vlc.playlist.isPlaying && (vlc.VersionInfo.substr(0,3) != '1.1')) { vlc.video.toggleFullscreen(); } + else if (vlc.VersionInfo.substr(0,3) == '1.1') { + alert('Fullscreen mode is broken in VLC 1.1.x'); + } } }, '-', @@ -177,21 +170,37 @@ tvheadend.VLC = function(url) { items: [vlc, missingPlugin] }); - win.on('render', function() { + win.on('beforeShow', 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); - if(url && (!vlc.playlist || vlc.playlist == 'undefined')) { + // check if vlc plugin wasn't initialised correctly + if(!vlc.playlist || (vlc.playlist == 'undefined')) { vlc.style.display = 'none'; + + missingPlugin.innerHTML = '

Embedded player could not be started.
You are probably missing VLC Mozilla plugin for your browser.

'; + + if (url) { + var channelid = url.substr(url.lastIndexOf('/')); + var streamurl = 'stream/channelid/' + channelid; + var playlisturl = 'playlist/channelid/' + channelid; + missingPlugin.innerHTML += '

M3U Playlist

'; + missingPlugin.innerHTML += '

Direct URL

'; + } - var chUrl = 'the stream'; - 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'; } + else { + // check if the window was opened with an url-parameter + if (url) { + vlc.playlist.items.clear(); + vlc.playlist.add(url); + vlc.playlist.playItem(0); + } + } }); win.show();