ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Announcements and Showcase
forum topic indicator Play sound via a web server
person icon
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 ????

person icon
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 ccbPlaySound
ccbPlaySound('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.

person icon
CopperCraftr
Guest
Quote
2024-11-23 21:38:06

Alright, Thanks for the response!


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |