Experiment to rebuild Diffuse using web applets.
1{
2 "name": "diffuse/engine/audio",
3 "title": "Diffuse Audio",
4 "entrypoint": "index.html",
5 "actions": {
6 "pause": {
7 "title": "Pause",
8 "description": "Pause audio",
9 "params_schema": {
10 "type": "object",
11 "properties": {
12 "audioId": {
13 "type": "string"
14 }
15 },
16 "required": ["audioId"]
17 }
18 },
19 "play": {
20 "title": "Play",
21 "description": "Play audio",
22 "params_schema": {
23 "type": "object",
24 "properties": {
25 "audioId": {
26 "type": "string"
27 },
28 "volume": {
29 "type": "number",
30 "default": 0.5
31 }
32 },
33 "required": ["audioId"]
34 }
35 },
36 "render": {
37 "title": "Render",
38 "description": "Determine the active set of audio elements.",
39 "params_schema": {
40 "type": "object",
41 "properties": {
42 "audio": {
43 "type": "array",
44 "description": "The audio items we want to render. These represent the audio elements that are in the DOM.",
45 "items": {
46 "type": "object",
47 "properties": {
48 "id": { "type": "string" },
49 "isPreload": { "type": "boolean" },
50 "mimeType": { "type": "string" },
51 "progress": { "type": "number" },
52 "url": { "type": "string" }
53 },
54 "required": ["id", "url"]
55 }
56 },
57 "play": {
58 "type": "object",
59 "description": "Pass in this object to immediately start playing one of the rendered audio items.",
60 "properties": {
61 "audioId": {
62 "type": "string",
63 "description": "The id of the rendered audio item we want to play."
64 },
65 "volume": {
66 "type": "number",
67 "default": 0.5,
68 "description": "A number equal to, or between, 0 and 1, that determines how loud the audio should play."
69 }
70 },
71 "required": ["audioId"]
72 }
73 },
74 "required": ["audio"]
75 }
76 },
77 "reload": {
78 "title": "Reload",
79 "description": "Make sure the audio with the given id is loading properly. This should be used when for example, the internet connection comes back and the loading of the audio depended on said internet connection.",
80 "params_schema": {
81 "type": "object",
82 "properties": {
83 "audioId": {
84 "type": "string"
85 },
86 "play": {
87 "type": "boolean"
88 },
89 "progress": {
90 "type": "number"
91 }
92 },
93 "required": ["audioId", "percentage"]
94 }
95 },
96 "seek": {
97 "title": "Seek",
98 "description": "Seek audio to a given position",
99 "params_schema": {
100 "type": "object",
101 "properties": {
102 "audioId": {
103 "type": "string"
104 },
105 "percentage": {
106 "type": "number",
107 "description": "A number between 0 and 1 that determines the new current position in the audio"
108 }
109 },
110 "required": ["audioId", "percentage"]
111 }
112 },
113 "volume": {
114 "title": "Volume",
115 "description": "Set the volume of all audio and the default value, or a specific audio node.",
116 "params_schema": {
117 "type": "object",
118 "properties": {
119 "audioId": {
120 "type": "string"
121 },
122 "volume": {
123 "type": "number",
124 "description": "A number between 0 and 1 that determines the new volume of all audio elements"
125 }
126 },
127 "required": ["volume"]
128 }
129 }
130 }
131}