-
Notifications
You must be signed in to change notification settings - Fork 7
/
ispikit.js
88 lines (74 loc) · 2.75 KB
/
ispikit.js
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
/*global cordova*/
cordova.define("cordova/plugin/ispikit",
function (require, exports, module) {
var serviceName = (device.platform == "Android") ? "IspikitWrapper" : "IspikitCordovaPlugin";
var noAudioPlayer = (device.platform == "Android");
var exec = cordova.require('cordova/exec');
function init(win, fail) {
exec(win, fail, serviceName, "init", []);
}
function setResultCallback(win, fail) {
console.log("In function setResultcallback");
exec(win, fail, serviceName, "setResultCallback", []);
}
function setNewWordsCallback(win, fail) {
exec(win, fail, serviceName, "setNewWordsCallback", []);
}
function setCompletionCallback(win, fail) {
exec(win, fail, serviceName, "setCompletionCallback", []);
}
function setPitchCallback(win, fail) {
exec(win, fail, serviceName, "setPitchCallback", []);
}
function setWaveformCallback(win, fail) {
exec(win, fail, serviceName, "setWaveformCallback", []);
}
function setVolumeCallback(win, fail) {
exec(win, fail, serviceName, "setVolumeCallback", []);
}
function setWaveFileCallback(win, fail) {
exec(win, fail, serviceName, "setWaveFileCallback", []);
}
function start(sentences, win, fail) {
exec(win, fail, serviceName, "start", [sentences]);
}
function stop(win, fail) {
exec(win, fail, serviceName, "stop", []);
}
function startPlayback(win, fail) {
exec(win, fail, serviceName, "startPlayback", []);
}
function stopPlayback(win, fail) {
exec(win, fail, serviceName, "stopPlayback", []);
}
function startLoadURL(id, url, win, fail) {
if (noAudioPlayer) return false;
exec(win, fail, serviceName, "startLoadURL", [id, url]);
}
function startPlay(id, win, fail) {
if (noAudioPlayer) return false;
exec(win, fail, serviceName, "startPlay", [id]);
}
function stopPlay(id, win, fail) {
if (noAudioPlayer) return false;
exec(win, fail, serviceName, "stopPlay", [id]);
}
module.exports = {
init: init,
start: start,
stop: stop,
setPitchCallback: setPitchCallback,
setWaveformCallback: setWaveformCallback,
setVolumeCallback: setVolumeCallback,
setWaveFileCallback: setWaveFileCallback,
setResultCallback: setResultCallback,
setNewWordsCallback: setNewWordsCallback,
setCompletionCallback: setCompletionCallback,
startPlayback: startPlayback,
stopPlayback: stopPlayback,
startLoadURL: startLoadURL,
startPlay: startPlay,
stopPlay: stopPlay
}
}
);