You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go.set(self.component, "sound", hash) -- override the resource data on the component
57
-
sound.play(self.component) -- start the playing
62
+
-- send "play_sound" to the component
63
+
play_sound(self, hash)
58
64
end
59
65
end
60
66
@@ -69,10 +75,36 @@ end
69
75
70
76
## Resource providers
71
77
72
-
You can of course use other means to load the initial chunk of the sound file. The important thing to remember is that the rest of the chunks are loaded from the resource system and it's resource providers.
78
+
You can use other means to load the initial chunk of the sound file. The important thing to remember is that the rest of the chunks are loaded from the resource system and its resource providers. In this example, we add a new (http) file provider by adding a live update mount, by calling using [liveupdate.add_mount()](/ref/liveupdate/#liveupdate.add_mount).
79
+
80
+
You can find a working example in [https://github.com/defold/example-sound-streaming](https://github.com/defold/example-sound-streaming).
In this example, we have added a new file provider by adding a live update mount, by calling using [liveupdate.add_mount()](/ref/liveupdate/#liveupdate.add_mount).
98
+
liveupdate.add_mount("webmount", self.base_url, 100, function ()
99
+
-- once the mount is ready, we can start our request for downloading the first chunk
100
+
load_web_sound(self.base_url, self.filename)
101
+
end)
102
+
end
75
103
104
+
functionfinal(self)
105
+
liveupdate.remove_mount("webmount")
106
+
end
107
+
```
76
108
77
109
## Sound chunk cache
78
110
@@ -84,4 +116,4 @@ You can also control the size of each sound chunk by changing the [`sound.stream
84
116
85
117
::: important
86
118
The total size of the sound chunk cache should be larger than the number of loaded sound files times the stream chunk size. Otherwise, you risk evicting new chunks each frame and sounds won't play properly
0 commit comments