summaryrefslogtreecommitdiffstats
path: root/src/js/app.js
diff options
context:
space:
mode:
authorRoger Zanoni <rzanoni@igalia.com>2022-11-11 16:53:15 +0100
committerRoger Zanoni <rzanoni@igalia.com>2022-11-11 16:54:34 +0100
commit38587cf96c096a204cd742fff9fea4f8e465393a (patch)
tree18b18d18bba8c93140186cc7db5b462408ea9f2c /src/js/app.js
parentc189320ab6810d4c916fa8f697a9452f3a8976a4 (diff)
Adapt the mixer demo to use kuksa.val service
Bug-AGL: SPEC-4599 Signed-off-by: Roger Zanoni <rzanoni@igalia.com> Change-Id: If8308d3402c11ac3acc7dc11c11ed042f014b87e
Diffstat (limited to 'src/js/app.js')
-rw-r--r--src/js/app.js30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/js/app.js b/src/js/app.js
index bfebf1c..9ad4ea1 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -1,14 +1,17 @@
import Mustache from 'mustache';
-import * as audiomixer from './agl_stubs_audiomixer';
-import { setValue } from './sliders';
var template;
+var controls = [
+ { id: 'MAIN', name: 'Main', volume: 50 },
+];
+
function render_sliders(sliders) {
var sliderContainer = document.getElementById('SliderContainer');
for( var i=0; i<sliders.length; i++) {
var node = Mustache.render(template, sliders[i]);
sliderContainer.innerHTML += node;
+ console.log(sliderContainer.innerHTML)
}
}
@@ -16,24 +19,5 @@ export function init() {
template = document.getElementById('slider-template').innerHTML;
Mustache.parse(template);
- audiomixer.list_controls().then(function(result) {
- var sliders = [];
- for( var i=0; i<result.length; i++) {
- sliders.push({
- id: result[i].control,
- name: result[i].control,
- value: Math.floor(result[i].volume*100)
- });
- }
-
- render_sliders(sliders);
- }).catch(function(error) {
- console.error('ERROR loading sliders', error);
- });
-
- audiomixer.on_volume_changed(function(data){
- setValue(document.getElementById("slider-"+data.control), Math.ceil(data.value*100), true);
- }).then(function(result) {
- console.log("SUBSCRIBED TO VOLUME CHANGED");
- });
-} \ No newline at end of file
+ render_sliders(controls);
+}