]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: Change Watch TV video player - allow to select profile instead resolution
authorJaroslav Kysela <perex@perex.cz>
Thu, 16 Oct 2014 09:35:35 +0000 (11:35 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 16 Oct 2014 09:51:59 +0000 (11:51 +0200)
src/api/api_profile.c
src/webui/static/app/tvheadend.js
src/webui/static/tv.js

index 7d9ed66365c2901694d272a194e1e2b6f33a71c8..ef2dc46f01260e4bbd41b61b9cde5dc6dda77e16 100644 (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 },
   };
 
index 0be16ed7faba159a75ed23d4abf66201fa711ecb..7779d906dd97336f441ff1c1449a67cf46b5f85f 100644 (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',
index 3857f87c46c517671aaf2fd7bc23cb239dbf4167..12ff881a9780d9b11fede864a1f07cbdde9c9a76 100644 (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() {