Media - UNC-Project-Open-AAC/OS-DPI GitHub Wiki
To enable the playback of audio files, one must first upload the desired audio clips to be implemented in the "Content" tab of the editor. Currently, only ".mp3" and ".wav" formats are supported.
Switch over to the "Layout" tab, select the "Page" item, select the dropdown labeled "Add," and select the item on the dropdown menu labeled "audio." A new entry should appear in the tree, labeled "Audio."
Now you need to modify your Content spreadsheet and Actions to enable playback for certain grid elements.
Let's start with the rules:
We can add the ability for the audio playback to occur by adding a new Action that sets the $Audio
variable. In the above example, we change the $Audio
variable only when, in the Content spreadsheet, a given entry has an associated #audio
field. $Audio
is merely the default name for the state variable associated with the audio player, and can be changed at any time in the layout tab. Additionally, any field can be used--I just happened to choose #audio
as the field to compare it to.
It's important to note that, in the example that is being shown so far, the audio playback action must be higher up than the action that adds a word to the display. Otherwise, the audio will never play, as the latter action will always take effect over the former.
Now, with the rule set, we need to make it explicit which audio clip plays when the associated Action goes off. With the rule set above, the following is an example that causes the file named "look.mp3" that I uploaded earlier to play whenever the button labeled "Play Audio" is pressed:
Essentially, what we did was create a column in my spreadsheet labeled "audio" which aligns with the field name we used when creating the Action in the previous subsection. Again, using the field name "audio" is not required--you can use any field name you want. Then, we set the name of the filename that I uploaded to the database in the first step ("look.mp3") on the same row as the button I wanted to audio clip associated with. This should allow playback now.
There is currently a demo file in the examples directory labeled "audio_demo.osdpi" that shows this basic usage of audio playback.