Documentation

TextAudio

The TextAudio module allows users to play sounds with subtitles in their presentations. This module works on all common browsers.

Note: It's recommended to use files with bitrate 64 kb/s or higher. The files with lower quality could experience some difficulties in reproduction. It's also important that audio files have constant bitrate because Mozilla Firefox may experience problems while seeking in files that have variable bitrate mode.

Properties

The list starts with the common properties, learn more about them by visiting the Modules description section. The other available properties are described below.

Property name Description
Controls In this property, you can choose one of the three options. The "None" option does not display any controls, the "Browser" option displays the default controls for the currently used web-browser. The "Custom" option displays the controls defined by a user in css styles. This option displays the controls independently from a web-browser.
Display time If this property is checked and defaultControls are unchecked, then the Timer will be shown.
Enable loop If this property is checked, the audio will be played repeatedly.
Slides In this property you define slides with the audio narration.
Text and times can be provided from SRT type file. If file is provided - text and times fields are ignored. Using srt file also enables to provide the Crop time field that simply crop the times within this file. Important: crop times works only for SRT file! Ignoring the srt file property, user can always provide narration by hand - described as below.
Each slide has property Text – which is the content of the slide and property Times, in which you define durations of each slide.
The content of the slide can be divided into fragments that will be highlighted in different periods of time. The seperator is double pipe "||". The number of pieces of text should be the same as the number of time periods in the Times property.
In the Times property you define time ranges for each piece of text. The time should be in the following format: mm:ss.d, where mm is minute, ss is second and d is the tenth of a second. Time range for each text should be in the seperate line. The tenth of a second parameter is not obligatory.
In the Position and dimensions property you define the position of a slide. This should be in the following format: X;Y;W;H, where X is the position from left, Y is the position from top, W is width and H is height.
For example:
  • Text:
    Lorem ||ipsum ||dolor
  • Times:
    00:00-00:02
    00:02-00:03.5
    00:03.5-00:05
  • Position and dimensions:
    10;10;150;200
  • File SRT - properly formatted SRT file for audio narration
  • Crop times - value that crop("cut") the times in File Srt
  • Proper format: 00:00:00,000 where HH:MM:SS,MS
mp3 This property serves for uploading an audio file in mp3 format into the module.

This property allows online resources. Find out more »

ogg This property serves for uploading an audio file in ogg format into the module.

This property allows online resources. Find out more »

On Text Click Behavior Defines the action that is expected to happen when a word is clicked by a user. This property replaces the following old properties: "Individual fragment playback" and "Vocabulary audio files playback".
Note: This property is not taken into account when the module has old properties: "Individual fragment playback" or "Vocabulary audio files playback". To use this property, you should remove the old module from the page and add a new one.
Vocabulary mp3 This property serves for uploading an audio file in mp3 format into the module. Setting up this property is only needed when On Text Click Behavior is set to "Play the interval from vocabulary file".

This property allows online resources. Find out more »

Vocabulary ogg This property serves for uploading a vocabulary audio file in ogg format into the module. Setting up this property is only needed when On Text Click Behavior is set to "Play the interval from vocabulary file".

This property allows online resources. Find out more »

Vocabulary intervals In this property you define time intervals for vocabulary audio files. The time periods should be in the same format as in Slides -> Times property. Number of parts in Vocabulary intervals have to be equal to the sum of times periods defined in Slides property. Setting up this property is only needed when On Text Click Behavior is set to "Play the interval from vocabulary file".
On end Event to be executed when (and only then) audio ends and loop is not enabled.
Is Click Disabled With this option selected, a user can interact with the addon only via commands (mouse actions are disabled).
Show slides In this property, you can choose one of the two options. The "Show current slide" option displays the currently playing slide, the "Show all slides" option displays all added slides.
Is disabled Allows disabling the module so that the user is not able to interact with it. Sets the style class for the entire addon to .disabled
Enable audio speed controller This property activates option to change speed of playing audio.
Lang attribute This property allows to define the language for this addon (different than the language of the lesson).
Speech texts This texts will be read by Text to Speech addon after a user performs an action. List of speech texts: Play button, Pause button, Stop button, Audio speed controller.
Individual fragment playback
deprecated
If this property is checked, only the selected fragment will be played.
Vocabulary audio files playback
deprecated
Defines whether the addon is allowed to use files defined in "Vocabulary audio files" property.
Vocabulary audio files
deprecated
List of files for individual playback.
defaultControls
deprecated
If this property is checked, the default browser controls will be displayed. In order to make custom controls, just add the event button and call play() or pause() function in the audio addon.
Note: It's important to put 2 different file formats if you want your audio to work on all common browsers. If you don't have a file in ogg format, you can use this mp3 to ogg converter. In Safari browser the file size is limited ( ~4mb ).
Note: Due to the policy of Android and iOS systems, using "onEnd" property to play another media element will not work on mobile devices as it requires user interaction.

Supported commands

Command name Params Description
play --- plays the sound if not playing already
pause --- pauses the sound
stop --- stops the sound
show --- shows the module
hide --- hides the module and stops the sound
enable --- enables the addon and removes the .disabled style class for the entire addon
disable --- disables the addons, interrupts the playback and adds the .disabled style class for the entire addon

Advanced Connector integration

Each command supported by the TextAudio addon can be used in the Advanced Connector addon scripts. The below examples show how to play sound when the True/False addon sends an event for the correct answer and how to stop it when the event indicates the incorrect answer.

    EVENTSTART
    Source:TrueFalse1
    Score:1
    SCRIPTSTART
        var audio = presenter.playerController.getModule('TextAudio1');
        audio.play();
    SCRIPTEND
    EVENTEND

    EVENTSTART
    Source:TrueFalse1
    Score:0
    SCRIPTSTART
        var audio = presenter.playerController.getModule('TextAudio1');
        audio.stop();
    SCRIPTEND
    EVENTEND

Events

The TextAudio addon sends ValueChanged type events to Event Bus when playback time changes.

Field name Description
Item N/A
Value Current time (in MM.SS format)
Score N/A

When audio playback is finished, TextAudio addon sends OnEnd event to Event Bus.

Field name Description
Item end
Value N/A
Score N/A

CSS Classes

Class name Description
.wrapper-addon-textaudio An addon's wrapper.
.textaudio-text A wrapper of slide text.
.wrapper-addon-textaudio span Each text fragment is in <span> element.
.wrapper-addon-textaudio span.active The currently highligted <span> element has class .active
.wrapper-addon-textaudio span.textelement[num] Where [num] is the element number counted from 0 on every slide. It is possible that there is more than one element with the same class number but they are always resposible for the same audio part.
.textaudio-play-pause-btn Shared styles used for the play button and pause button.
.textaudio-play-btn Styles for the play button.
.textaudio-pause-btn Styles for the pause button.
.textaudio-stop-btn Styles for the stop button.
.textaudio-playback-rate Styles for the audio speed controller.

Demo presentation

Demo presentation contains examples of how to use the TextAudio addon.