We thought it would be fun, and in some cases, pretty useful, if you could integrate sounds and music into your Ceros experience. Not only does this plugin let you do that, it also allows you to control the audio clips with play/pause buttons, toggles, loops, resets, mute and several different event triggers. You can also use this plugin to integrate a live stream right into your Ceros experience. Upload the demo experience to your studio to explore a finished audio piece, or follow the steps below to set up audio controls on your own.
The first thing we did was to devise a naming convention for SDK Tags that would allow us to expose as much functionality from the Howler.js Web Audio library as possible. We then used the Ceros SDK to track integrations with objects whose tags followed the naming convention and to trigger the appropriate audio effects.
In the Settings panel, paste the script below in the Custom HTML field:
We recommend using MP3 files for the best balance of small file size and high quality, however, you can use any of the following:
In order for a sound file to be played, it must be hosted on an external server. It is not possible to add audio files directly to Ceros.
In you have your own server that can host files (e.g. s3 or FTP), make sure that it has Cross Origin Requests (CORS) enabled and is publicly accessible, i.e., not behind a login – anyone should be able to access the file.
If your company has a website, that means there is a web server where your audio file could be hosted. You may need to reach out to your IT team to get this done if you are not able to upload to the server yourself.
To add a sound file experience, you must attach the audio URL to the payload section of an icon, image, or text box in the Ceros Studio.
playsound. This will be added in the 3rd field within the SDK panel.
name:unique-nameand substitute “unique-name” with a name of your choosing.
Sound events are the drivers of the extension, and are what give users control over the sounds in an experience. In order for users to interact with your sounds, events must be added to a triggering object.
sound-clicktag. This tells the experience to listen for click events on this object.
event:play. We’ve listed all of the possible events below.
target:unique-nametag created in a previous step.
|Plays the sound(s) and sets it to loop indefinitely.|
|Toggles the volume on a sound(s).|
|Plays the sound(s).|
|Pauses the sound(s).|
|Resets and plays the sound(s).|
|Plays the sound(s). Subsequent clicks will pause/play the sound(s).|
|Fast forwards the sound by 1 second, whether it’s playing or paused. Does not play/unpause sounds.|
|Rewinds the sound by 1 second, whether it’s playing or paused. Does not play/unpause sounds.|
|Fades the volume from 0 to the set volume (default: 2 second).|
|Fades the volume from the set volume to 0 (default: 1 second).|
Global events: all events can be applied globally to every sound in the experience. In order to do so, change the
event in the event tag to
stream:trueto the tags of the object.
event:toggleis recommended for streams.
If you would like to really fine tune your sound and/or event settings, much can be done using tags alone. This section will tell you which settings you can change through tags and what those changes do.
WARNING: changing these may cause unexpected behavior.
Settings can be changed using the format:
|Default = 0. To change the start time of your sound you may enter “start:your-start-time”, i.e. “start:2000”. The second part must be a number, and in milliseconds NOT seconds.|
|Default = 1000|
|Default = 1000|
|Default = 100|
|Pauses the sound(s)|
|Default = 100|