 CopperCraftr Guest |
Quote
|
2024-11-23 19:01:51 |
|
Hi, im trying to play a audio wich is located on a webserver. But for me it doesnt work. I tried using the "ccbDoHTTPRequest" and then acces the audio to play it, it didnt work. If there is a anwser to this Problem, it would be helpfull ????
|
 okeoke Registered User |
Quote
|
2024-11-23 19:48:14 |
|
I believe, it only allows to get text using ccbDoHTTPRequest.
As a workaround you can use "system" command to run curl to get and save file:system('curl -o file_to_play.ogg http://PATH_TO_YOUR_FILE.ogg', true); And then play it using ccbPlaySoundccbPlaySound('file_to_play.ogg');
Note!: file download is asynchronous, i.e. CopperCube will not wait until file is downloaded, so you can't play it right away. You need to write your code the way that either file is predownloaded, or CopperCube waits to play the file.
Second option could be done easily by registering on frame even? which checks if file your downloaded file already exists in the file system. As soon as it is presented, you play the file and unregister the on frame event.
|
 CopperCraftr Guest |
Quote
|
2024-11-23 21:38:06 |
|
Alright, Thanks for the response!
|