Skip to content

Commit

Permalink
WEBUI: Change Watch TV video player - allow to select profile instead…
Browse files Browse the repository at this point in the history
… resolution
  • Loading branch information
perexg committed Oct 16, 2014
1 parent 4b7a674 commit 7eefd44
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
8 changes: 4 additions & 4 deletions src/api/api_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};

Expand Down
39 changes: 17 additions & 22 deletions src/webui/static/app/tvheadend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -277,7 +272,7 @@ tvheadend.VideoPlayer = function(url) {
}
},
'-',
selectResolution,
selectProfile,
'-',
{
iconCls: 'control_volume',
Expand Down
19 changes: 11 additions & 8 deletions src/webui/static/tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -403,7 +407,6 @@ tv.ui.ChannelList = Ext.extend(Ext.DataView, {
}
});


tv.app = function() {
return {
init: function() {
Expand Down

2 comments on commit 7eefd44

@bagong
Copy link

@bagong bagong commented on 7eefd44 Oct 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if the profile-select dropdown would only list "enabled" profiles.

@bagong
Copy link

@bagong bagong commented on 7eefd44 Oct 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even hipper would be an option to enable profiles explicitly for the WebGUI viewer. In my case (DVBS live tv via IP) there are several profiles that are useful to clients like VLC, but do not work in the Webviewer (I guess because the codec is not supported by the browser). So I would not want to disable them globally, but prefer if they didn't show up in the WebViewer.
Thanks for your consideration!

Please sign in to comment.