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 a track",
9 "params_schema": {
10 "type": "object",
11 "properties": {
12 "trackId": {
13 "type": "string"
14 }
15 },
16 "required": ["trackId"]
17 }
18 },
19 "play": {
20 "title": "Play",
21 "description": "Play a track",
22 "params_schema": {
23 "type": "object",
24 "properties": {
25 "trackId": {
26 "type": "string"
27 },
28 "volume": {
29 "type": "number",
30 "default": 0.5
31 }
32 },
33 "required": ["trackId"]
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 "play": {
43 "type": "object",
44 "description": "Pass in this object to immediately start playing one of the rendered tracks.",
45 "properties": {
46 "trackId": {
47 "type": "string",
48 "description": "The id of the rendered track we want to play."
49 },
50 "volume": {
51 "type": "number",
52 "default": 0.5,
53 "description": "A number equal to, or between, 0 and 1, that determines how loud the track should play."
54 }
55 },
56 "required": ["trackId"]
57 },
58 "tracks": {
59 "type": "array",
60 "description": "The tracks we want to render.",
61 "items": {
62 "type": "object",
63 "properties": {
64 "id": { "type": "string" },
65 "isPreload": { "type": "boolean" },
66 "mimeType": { "type": "string" },
67 "progress": { "type": "number" },
68 "url": { "type": "string" }
69 },
70 "required": ["id", "url"]
71 }
72 }
73 },
74 "required": ["tracks"]
75 }
76 },
77 "reload": {
78 "title": "Reload",
79 "description": "Make sure the audio node with the given track id is loading properly. This should be used when for example, the internet connection comes back and the loading of the track depended on said internet connection.",
80 "params_schema": {
81 "type": "object",
82 "properties": {
83 "play": {
84 "type": "boolean"
85 },
86 "progress": {
87 "type": "number"
88 },
89 "trackId": {
90 "type": "string"
91 }
92 },
93 "required": ["percentage", "trackId"]
94 }
95 },
96 "seek": {
97 "title": "Seek",
98 "description": "Seek a track to a given position",
99 "params_schema": {
100 "type": "object",
101 "properties": {
102 "percentage": {
103 "type": "number",
104 "description": "A number between 0 and 1 that determines the new current position in the audio"
105 },
106 "trackId": {
107 "type": "string"
108 }
109 },
110 "required": ["percentage", "trackId"]
111 }
112 },
113 "volume": {
114 "title": "Volume",
115 "description": "Set the volume of all tracks, or a specific track.",
116 "params_schema": {
117 "type": "object",
118 "properties": {
119 "trackId": {
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}