-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathscripts.js
More file actions
112 lines (97 loc) · 3.28 KB
/
scripts.js
File metadata and controls
112 lines (97 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* @fileoverview
* @TODO file description
*
* @author Tadeusz Kozak
* @date 26-06-2012 10:37
*/
/**
* Document ready callback - starts the Cloudeo platform initialization.
*/
CDOT.onDomReady = function () {
log.debug('DOM loaded');
CDOT.initDevicesSelects();
CDOT.initUI();
CDOT.initCloudeoLogging();
CDOT.initializeCloudeoQuick(CDOT.onPlatformReady);
};
CDOT.initUI = function () {
$('#volumeCtrlSlider').slider({
min:0,
max:255,
animate:true,
value:127,
slide:CDOT.onVolumeSlide
});
$('#micGainCtrlSlider').slider({
min:0,
max:255,
animate:true,
value:127,
slide:CDOT.onMicGainSlide
});
$('#micActivityBar').progressbar({value:50});
$('#playTestSoundBtn').click(CDOT.onPlayTestSoundBtnClicked);
$('#micActivityEnabledChckbx').change(CDOT.onMicActivityEnabledChckbxChange);
};
CDOT.onPlatformReady = function () {
CDOT.initializeListener();
CDOT.populateDevicesQuick();
CDOT.populateVolume();
CDOT.populateMicGain();
$('#playTestSoundBtn').
click(CDOT.onPlayTestSoundBtnClicked).
removeClass('disabled');
};
CDOT.initializeListener = function () {
var listener = new CDO.CloudeoServiceListener();
listener.onDeviceListChanged = function (e) {
log.debug("Got devices list changed");
if(e.audioInChanged) {
log.debug("Got new microphone plugged in");
CDOT.populateDevicesOfType('#micSelect', 'AudioCapture');
}
if(e.audioOutChanged) {
log.debug("Got new speakers plugged in");
CDOT.populateDevicesOfType('#spkSelect', 'AudioOutput');
}
if(e.videoInChanged) {
log.debug("Got new camera plugged in");
CDOT.populateDevicesOfType('#camSelect', 'VideoCapture');
}
};
listener.onMicActivity = function (e) {
log.debug("Got mic activity: " + e.activity);
$('#micActivityBar').progressbar('value', e.activity / 255 * 100);
};
CDO.getService().addServiceListener(CDO.createResponder(), listener);
};
CDOT.populateVolume = function () {
var resultHandler = function (volume) {
$('#volumeCtrlSlider').slider('value', volume);
};
CDO.getService().getSpeakersVolume(CDO.createResponder(resultHandler));
};
CDOT.populateMicGain = function () {
var resultHandler = function (volume) {
$('#micGainCtrlSlider').slider('value', volume);
};
CDO.getService().getMicrophoneVolume(CDO.createResponder(resultHandler));
};
CDOT.onVolumeSlide = function (e, ui) {
CDO.getService().setSpeakersVolume(CDO.createResponder(), ui.value);
};
CDOT.onMicGainSlide = function (e, ui) {
CDO.getService().setMicrophoneVolume(CDO.createResponder(), ui.value);
};
CDOT.onPlayTestSoundBtnClicked = function () {
CDO.getService().startPlayingTestSound(CDO.createResponder());
};
CDOT.onMicActivityEnabledChckbxChange = function () {
var enabled = $(this).is(':checked');
CDO.getService().monitorMicActivity(CDO.createResponder(), enabled);
};
/**
* Register the document ready handler.
*/
$(CDOT.onDomReady);