]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Added a media player that uses the VLC plugin API
authorsb1066 <sb1066@gmail.com>
Sun, 11 Jul 2010 17:33:04 +0000 (17:33 +0000)
committersb1066 <sb1066@gmail.com>
Sun, 11 Jul 2010 17:33:04 +0000 (17:33 +0000)
src/webui/static/app/tvheadend.js
src/webui/static/icons/arrow_out.png [new file with mode: 0644]
src/webui/static/icons/control_pause.png [new file with mode: 0644]
src/webui/static/icons/control_play.png [new file with mode: 0644]
src/webui/static/icons/control_stop.png [new file with mode: 0644]
src/webui/static/icons/eye.png [new file with mode: 0644]
src/webui/static/icons/sound.png [new file with mode: 0644]

index bb2ed2993bf2386bcbad8a962fcbfd308115e48a..132b7484fd77988a86d68143de2425a16e85f381 100644 (file)
@@ -27,6 +27,138 @@ tvheadend.help = function(title, pagename) {
        }});
 }
 
+/**
+ * Displays a mediaplayer using VLC plugin
+ */
+tvheadend.VLC = function(url) {
+  var vlc = document.createElement('embed');
+  vlc.setAttribute('type', 'application/x-vlc-plugin');
+  vlc.setAttribute('pluginspage', 'http://www.videolan.org');
+  vlc.setAttribute('version', 'version="VideoLAN.VLCPlugin.2');
+  vlc.setAttribute('width', '507');
+  vlc.setAttribute('height', '384');
+  vlc.setAttribute('autoplay', 'yes');
+  vlc.setAttribute('id', 'vlc');
+  if(url) {
+    vlc.setAttribute('src', url);
+  }
+
+  var selectChannel = new Ext.form.ComboBox({
+    loadingText: 'Loading...',
+    width: 200,
+    displayField:'name',
+    store: tvheadend.channels,
+    mode: 'local',
+    editable: false,
+    triggerAction: 'all',
+    emptyText: 'Select channel...'
+  });
+  
+  selectChannel.on('select', function(c, r) {
+      var url = makeStreamPrefix() + r.data.chid;
+      var chName = r.data.name;
+           
+           if(vlc.playlist.isPlaying) {
+             vlc.playlist.stop();
+           }
+           if(vlc.playlist.items.count) {
+        vlc.playlist.items.clear();
+      }
+      
+      vlc.playlist.add(url, chName, "");
+      vlc.playlist.play();
+      vlc.audio.volume = slider.getValue();
+    }
+  );
+  
+  var slider = new Ext.Slider({
+    width: 135,
+    height: 20,
+    value: 90,
+    increment: 1,
+    minValue: 0,
+    maxValue: 100,
+  });
+  
+  var sliderLabel = new Ext.form.Label();
+  sliderLabel.setText("90%");
+  slider.addListener('change', function() {
+    if(vlc.playlist.isPlaying) {
+      vlc.audio.volume = slider.getValue();
+      sliderLabel.setText(vlc.audio.volume + '%');
+    } else {
+      sliderLabel.setText(slider.getValue() + '%');
+    }
+  });
+  
+  var win = new Ext.Window({
+    title: 'VLC Player',
+    layout:'fit',
+    width: 507 + 14,
+    height: 384 + 56,
+    constrainHeader: true,
+    iconCls: 'eye',
+    resizable: false,
+    tbar: [
+      selectChannel,
+      '-',
+      {
+        iconCls: 'control_play',
+        tooltip: 'Play',
+        handler: function() {
+          if(vlc.playlist.items.count && !vlc.playlist.isPlaying) {
+            vlc.playlist.play();
+          }
+        }
+      },
+      {
+        iconCls: 'control_pause',
+        tooltip: 'Pause',
+        handler: function() {
+          if(vlc.playlist.items.count) {
+            vlc.playlist.togglePause();
+          }
+        }
+      },
+      {
+        iconCls: 'control_stop',
+        tooltip: 'Stop',
+        handler: function() {
+          if(vlc.playlist.items.count) {
+            vlc.playlist.stop();
+          }
+        }
+      },
+      '-',
+      {
+        iconCls: 'control_fullscreen',
+        tooltip: 'Fullscreen',
+        handler: function() {
+          if(vlc.playlist.isPlaying) {
+            vlc.video.toggleFullscreen();
+          }
+        }
+      },
+      '-',
+      {
+        iconCls: 'control_volume',
+        tooltip: 'Volume',
+        disabled: true
+      },
+    ],
+    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.show();
+};
 
 /**
  * This function creates top level tabs based on access so users without 
diff --git a/src/webui/static/icons/arrow_out.png b/src/webui/static/icons/arrow_out.png
new file mode 100644 (file)
index 0000000..2e9bc42
Binary files /dev/null and b/src/webui/static/icons/arrow_out.png differ
diff --git a/src/webui/static/icons/control_pause.png b/src/webui/static/icons/control_pause.png
new file mode 100644 (file)
index 0000000..2d9ce9c
Binary files /dev/null and b/src/webui/static/icons/control_pause.png differ
diff --git a/src/webui/static/icons/control_play.png b/src/webui/static/icons/control_play.png
new file mode 100644 (file)
index 0000000..0846555
Binary files /dev/null and b/src/webui/static/icons/control_play.png differ
diff --git a/src/webui/static/icons/control_stop.png b/src/webui/static/icons/control_stop.png
new file mode 100644 (file)
index 0000000..893bb60
Binary files /dev/null and b/src/webui/static/icons/control_stop.png differ
diff --git a/src/webui/static/icons/eye.png b/src/webui/static/icons/eye.png
new file mode 100644 (file)
index 0000000..564a1a9
Binary files /dev/null and b/src/webui/static/icons/eye.png differ
diff --git a/src/webui/static/icons/sound.png b/src/webui/static/icons/sound.png
new file mode 100644 (file)
index 0000000..6056d23
Binary files /dev/null and b/src/webui/static/icons/sound.png differ