var detailsfcn = function(grid, rec, act, row) {
new tvheadend.epgDetails(grid.getStore().getAt(row).data);
};
+ var watchfcn = function(grid, rec, act, row) {
+ var item = grid.getStore().getAt(row);
+ new tvheadend.VideoPlayer(item.data.channelUuid);
+ };
var actions = new Ext.ux.grid.RowActions({
id: 'details',
header: _('Details'),
tooltip: _('Details'),
- width: 45,
+ width: 67,
dataIndex: 'actions',
callbacks: {
'recording': detailsfcn,
qtip: _('Broadcast details'),
cb: detailsfcn
},
+ {
+ iconCls: 'watchTv',
+ qtip: _('Watch TV'),
+ cb: watchfcn
+ },
{
iconIndex: 'dvrState'
}
/* do not restore sorting and filters */
state.sort = {};
state.filters = {};
+ /* Otherwise this non-resizable column will not expand to newly set width */
+ if (state.columns)
+ state.columns[0].width = actions.width;
}
}
}
/**
* Displays a mediaplayer using the html5 video element
*/
-tvheadend.VideoPlayer = function(url) {
+tvheadend.VideoPlayer = function(channelId) {
var videoPlayer = new tv.ui.VideoPlayer({
params: { }
});
+
+ var initialChannelName;
+ if (channelId) {
+ var record = tvheadend.channels.getById(channelId);
+ initialChannelName = record.data.val;
+ }
var selectChannel = new Ext.form.ComboBox({
loadingText: _('Loading...'),
mode: 'local',
editable: true,
triggerAction: 'all',
- emptyText: _('Select channel...')
+ emptyText: _('Select channel...'),
+ value: initialChannelName
});
selectChannel.on('select', function(c, r) {
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
win.getTopToolbar().add(new Ext.Toolbar.Spacer());
win.getTopToolbar().add(sliderLabel);
- });
+ // Zap to initial channel when the player is ready
+ if (channelId) {
+ videoPlayer.zapTo(channelId);
+ }
+ });
+
win.on('close', function() {
videoPlayer.stop();
});