Creates an audio object that can be referred to as a target object for any action related to audio playback. It can be displayed on the page with HTML5 controls if Playback Controls property is enabled, otherwise it will be invisible to the end user but still playable through actions.
wavaudio formats, we strongly advise to use MP3 audio assets for the best compatibility with all the various browsers / readers.
Audio object supports most of the Generic Object Properties, plus the ones listed below. To edit properties of an audio object, select it and use the selection inspector at the right of your project window.
|Sound||The audio asset to be played|
|Playback Controls||Enable to display the HTML5 audio player controls or disable to make the audio invisible to the end user (but still playable through actions). Please note that the playback controls displayed will vary basing on the browser / reader displaying the publication|
|Loop||If enabled, the playback will be repeated once played for the first time|
Audio object triggers only some of the Generic Events, namely Accelerometer, Load, Shake and Show. To edit event handlers for an audio object, select it and use the Interactivity Panel on the right side of the project window.
Audio object can be used as target of most Generic Actions, plus some specific action to control playback:
Plays an audio object. If playback was previously stopped, it will restart where it left off, unless Play From Beginning property is enabled.
|Target||Audio object to play|
|Play From Beginning||If enabled, the audio object will be always played from the beginning, even if playback was previously stopped|
|Wait for Completion||If enabled, PubCoder will wait for the audio to complete playback before executing the next action in the same action list, otherwise it will execute the next action immediately Tip: Pausing the audio externally, e.g. by using a Stop Audio action or playback controls, will mark the action as completed anyway|
Play Audio ➜ selfin the
Loadevent of the audio object to make it play automatically when the page loads
Plays a paused audio object, resuming from where the playback was stopped, or pauses playback if that object is already playing.
|Target||Audio object to play/pause|
Moves the playback time to a certain time. Especially useful for long audio, for example you can make various Buttons to seek to the various chapters in an audio track.
|Target||Audio object to seek|
|Time||Define the position, in seconds, to seek the audio to|
Set Audio Volume
Changes the playback volume of an audio object
|Target||Audio object to set volume to|
|Volume||Decimal number from 0 (mute) to 1 (maximum volume) indicating the audio volume relative to the global device volume|
Stops playback of a playing audio object
|Target||Audio object to be stopped|
Here’s an example of how an audio objects with playback controls is exported on the html page:
<audio id="obj4" class="SCPageObject SCSound" src="../audio/Ball.mp3" controls="controls"> <p class="SCAudioFallback">Your Player does not support HTML audio</p> </audio>
The text “Your Player does not support HTML audio” will be displayed only if the browser / reader does not actually support HTML5 audio.