Added a media player that uses the VLC plugin API
This commit is contained in:
parent
aa677995b8
commit
60f43b5842
7 changed files with 132 additions and 0 deletions
|
@ -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
|
||||
|
|
BIN
src/webui/static/icons/arrow_out.png
Normal file
BIN
src/webui/static/icons/arrow_out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 594 B |
BIN
src/webui/static/icons/control_pause.png
Normal file
BIN
src/webui/static/icons/control_pause.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 598 B |
BIN
src/webui/static/icons/control_play.png
Normal file
BIN
src/webui/static/icons/control_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 592 B |
BIN
src/webui/static/icons/control_stop.png
Normal file
BIN
src/webui/static/icons/control_stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 403 B |
BIN
src/webui/static/icons/eye.png
Normal file
BIN
src/webui/static/icons/eye.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 750 B |
BIN
src/webui/static/icons/sound.png
Normal file
BIN
src/webui/static/icons/sound.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 610 B |
Loading…
Add table
Reference in a new issue