From: Andreas Ă–man Date: Tue, 10 May 2011 18:04:26 +0000 (+0200) Subject: Improve VLC player window X-Git-Tag: 2.99~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33441bfc684896adc91fa7bcbb7e2a7ec56c240;p=thirdparty%2Ftvheadend.git Improve VLC player window * Enable resize for player-window (inner vlc-plugin autoscales to 100%, allows movie-resize during playback) * Fixes channel-switching (didn't work before here, it played always the same channel) * Enables multiple vlc-playback-windows for parallel playback of more than 1 stream * Adds a message to fullscreen-button click, that fullscreen mode is broken in VLC 1.1.x if VLC plugin 1.1.x is detected (see http://forum.videolan.org/viewtopic.php?f=4&t=82721&p=274383, last known version to work: 1.0.5 <- that one has no DXVA for example :( ) * Now shows M3U and DirectStream URL if plugin is missing in BOTH cases (there were 2 in code) Patch by cyberjunk --- diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js index b0a786471..25d9be986 100644 --- a/src/webui/static/app/tvheadend.js +++ b/src/webui/static/app/tvheadend.js @@ -31,24 +31,30 @@ tvheadend.help = function(title, pagename) { * 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();