So I am doing a class project and would like to add audios to the text boxes. But these boxes are made in groups and it is not possible to put audio in them.
My question is if I can add some kind of javascript on the page along with those already there so that it is possible to play the audios that are on the slide, one at a time respecting their sequence when switching the box.
Or if I could play all the audios on the master slide and on each slide pull the audio with their respective name.
You just need to call animate(AP.EffectType.MEDIA_PLAY) on the audio object instead of the text box.
// remove or comment out these lines:
// play attached audio
//nextObject.animate(AP.EffectType.MEDIA_PLAY);
// replace them by these lines
// play next audio
prez.object('ReTr_02a_1_' + nextIndex).animate(AP.EffectType.MEDIA_PLAY);
Hi
Worked perfectly. But if I click on the next box, the audios will mix, how do I pause the audio when the box is āhideā?
Iām not very good at Javascript xD
Sorry, I didnāt notice the line that stops the audio (this.animate(AP.EffectType.MEDIA_STOP);) in your code. You should call it on the current audio object.
The entire script will be:
//Variavel caixa normal
var namePrefix = 'caixa_';
var audioPrefix = 'ReTr_02a_1_';
//Variavel caixa Indica
var nameCaixaIndica = 'caixaIndica_1';
//FunĆ§Ć£o
var clickHandler = function() {
this.hide();
//Variavel do contador
var nextIndex = parseInt(this.name().substring(namePrefix.length)) + 1;
// Stop current audio
prez.object(audioPrefix + (nextIndex - 1)).animate(AP.EffectType.MEDIA_STOP);
//Variavel proxima caixa
var nextObject = prez.object(namePrefix + nextIndex);
//Variavel proxima caixa Indica
var caixaIndica = prez.object(nameCaixaIndica);
//Se caixa hide = show e inicia audio
if (nextObject) {
nextObject.show();
// play next audio
prez.object(audioPrefix + nextIndex).animate(AP.EffectType.MEDIA_PLAY);
}
//Se caixaIndica = hide = show
else if (caixaIndica){
caixaIndica.show();
//Se terminou proximo slide
} else {
prez.nextSlide();
}
};
Hi,
How do I add to a variable without having to set it? something like this:
var audioAula = prez.variable(āapMudarAudioā);
ā¦
ā¦
else {
prez.nextSlide();
prez.variable(āapMudarAudioā) +1; how do I do this implementation?