WEBUI: Change Watch TV video player - allow to select profile instead resolution

This commit is contained in:
Jaroslav Kysela 2014-10-16 11:35:35 +02:00
parent 4b7a674e7f
commit 7eefd4459f
3 changed files with 32 additions and 34 deletions

View file

@ -99,10 +99,10 @@ void
api_profile_init ( void )
{
static api_hook_t ah[] = {
{ "profile/list", ACCESS_ADMIN, api_profile_list, NULL },
{ "profile/class", ACCESS_ADMIN, api_idnode_class, (void*)&profile_class },
{ "profile/builders", ACCESS_ADMIN, api_profile_builders, NULL },
{ "profile/create", ACCESS_ADMIN, api_profile_create, NULL },
{ "profile/list", ACCESS_ANONYMOUS, api_profile_list, NULL },
{ "profile/class", ACCESS_ADMIN, api_idnode_class, (void*)&profile_class },
{ "profile/builders", ACCESS_ADMIN, api_profile_builders, NULL },
{ "profile/create", ACCESS_ADMIN, api_profile_create, NULL },
{ NULL },
};

View file

@ -156,9 +156,7 @@ Ext.Ajax.request({
tvheadend.VideoPlayer = function(url) {
var videoPlayer = new tv.ui.VideoPlayer({
params: {
resolution: 384
}
params: { }
});
var selectChannel = new Ext.form.ComboBox({
@ -186,35 +184,32 @@ tvheadend.VideoPlayer = function(url) {
});
var sliderLabel = new Ext.form.Label();
sliderLabel.setText("90%");
sliderLabel.setText('90%');
slider.addListener('change', function() {
videoPlayer.setVolume(slider.getValue());
sliderLabel.setText(videoPlayer.getVolume() + '%');
});
var selectResolution = new Ext.form.ComboBox({
if (!tvheadend.profiles) {
tvheadend.profiles = tvheadend.idnode_get_enum({
url: 'api/profile/list',
event: 'profile',
});
}
var selectProfile = new Ext.form.ComboBox({
loadingText: 'Loading...',
width: 150,
displayField: 'name',
valueField: 'res',
value: 384,
displayField: 'val',
mode: 'local',
editable: false,
triggerAction: 'all',
emptyText: 'Select resolution...',
store: new Ext.data.SimpleStore({
fields: ['res', 'name'],
id: 0,
data: [
['288', '288p'],
['384', '384p'],
['480', '480p'],
['576', '576p']
]
})
emptyText: 'Select profile...',
store: tvheadend.profiles,
});
selectResolution.on('select', function(c, r) {
videoPlayer.setResolution(r.data.res);
selectProfile.on('select', function(c, r) {
videoPlayer.setProfile(r.data.val);
if (videoPlayer.isIdle())
return;
@ -277,7 +272,7 @@ tvheadend.VideoPlayer = function(url) {
}
},
'-',
selectResolution,
selectProfile,
'-',
{
iconCls: 'control_volume',

View file

@ -52,6 +52,11 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
profile: 'pass',
mimetype: 'video/MP2T'
},
webm: {
profile: 'webtv-vp8-vorbis-webm',
playlist: false,
mimetype: 'video/webm; codecs="vp8.0, vorbis"'
},
hls: {
profile: 'webtv-h264-aac-mpegts',
playlist: true,
@ -72,10 +77,6 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
playlist: false,
mimetype: 'video/x-matroska; codecs="avc1.42E01E, mp4a.40.2"'
},
webm: {
profile: 'webtv-vp8-vorbis-webm',
mimetype: 'video/webm; codecs="vp8.0, vorbis"'
}
};
return {
@ -236,8 +237,8 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
this.video.setSize(width, height);
},
setResolution: function(res) {
this.params.resolution = res;
setProfile: function(pro) {
this.params.profile = pro;
},
isIdle: function() {
@ -271,7 +272,10 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
var config = config || {}
var params = {}
Ext.apply(params, this._getProfile(), this.params);
if (!this.params.profile)
Ext.apply(params, this._getProfile(), this.params);
else
Ext.apply(params, this.params);
Ext.apply(params, config);
this.video.hide();
@ -403,7 +407,6 @@ tv.ui.ChannelList = Ext.extend(Ext.DataView, {
}
});
tv.app = function() {
return {
init: function() {