Dynamically changing name of media files

mlapl1
Community Member Posts: 350 ♪ Opening Act ♪
Hello
In the absence of loop structures in Lectora, I have created an action group that calls itself a number of time to perform certain repetitive actions. One of these actions is to play a media file.
My problem is that I would like to apply the same loop to multiple media files. In order to achieve this I would have to be able to change the name of the played media file dynamically. The catch is that I do not want to use Javascript to do this - or to play the file itself in JS.
If I cannot attribute the media file name dynamically, then the solution would be to create as many action groups as there are audio files. This means duplicating the same group say 10 times but changing the name of the file inside the group. Duplication would just occupy a lot of space and, potentially, be confusing to non-programmers trying to write lessons in "pure" Lectora.
So... is there a simple non-JS -based solution for this difficulty?
Thanks for any help.
Andrew
In the absence of loop structures in Lectora, I have created an action group that calls itself a number of time to perform certain repetitive actions. One of these actions is to play a media file.
My problem is that I would like to apply the same loop to multiple media files. In order to achieve this I would have to be able to change the name of the played media file dynamically. The catch is that I do not want to use Javascript to do this - or to play the file itself in JS.
If I cannot attribute the media file name dynamically, then the solution would be to create as many action groups as there are audio files. This means duplicating the same group say 10 times but changing the name of the file inside the group. Duplication would just occupy a lot of space and, potentially, be confusing to non-programmers trying to write lessons in "pure" Lectora.
So... is there a simple non-JS -based solution for this difficulty?
Thanks for any help.
Andrew
Comments
-
-
Hi Math
attached is a simple example of what I am trying to do. The idea is also to avoid use of javascript at least beyond the setting up stages of the file.
Thanks a lot as ever!
Andrew -
Hi Andrew,
The sample attached is a step in the right direction. I do think its not a complete fix for your issues/question but for sure a step in a possible solution.
What i added:
- variable for the mediaToPlay -> default is 1, then after your first audio played 3x its set to 2
- extra actiongroup to add to the variable whenever needed.
Clicking the play button when your first audio has played 3x, well then the 2nd audio plays.
I/You/We/Us need to figure out whether that will work with 10 audios..and if not find a solution for that.
Another option i think is possible is just use the 'Change Contents' action on the audio file. It is available for audio files too, so should work. Might give that approach a try too.
Regards,
Math -
Next version with 5 audios in it. Works as i thought it would. Slight changes needed on the previous one
- in the ag_updateMedia group:
- mediaToPlay incrementing the variable instead of setting it to a fixed num
- resetting Max_Reps to 0 to ensure when a audio has played 3 times, it can do the same with the next audio
Do replace audio3, 4 and 5 with your own shorter version... just picked 3 audio files i quickly found.. way too long for proper testing ;-)
Minus i just noticed with my longer audios also is that due to the fact you loop Grp_LoopMedia01 after 5 secs..my newest audio ( 3,4,5 ) only play once, because they are longer then 5 seconds. Gonna think of a way to trigger the loop in another way...
Allthough this works swell, i am gonna try to dynamically change a variable and try 'Change Content' on audio...
So some alternatives available soon....
~Math -
I do think this version fits your needs nicely. Using 'Change Content' on a generic audiofile. So you have 1 audioplayer in your project and it gets filled by the next ones in line depending on variables. In fact i did use OnDonePlaying here, because that way also audios longer then that predefined 5 secs in your previous one get played 3x.
Lectora file in my opinion is nice and neat. Any decent developer should have no problem finding their way in this one. You need to make sure your audios end up in the media folder. I did by importing them to stage and then removing them...
Regards,
~Math -
I think that looks genial Math! I was not aware that you could change media files like that. It does mean that I can use OnDonePlaying which, of course, is much more precise than the delays I put in and less troublesome.
I will experiment a bit more and report back.
Thank you so much!
Categories
- 35.8K All Categories
- 109 ✫ Announcements
- 33.1K Lectora®
- 31.1K Lectora Discussions
- 28.9K Lectora Desktop
- 2K Lectora Online
- 2K Lectora Feature Requests
- 71 Lectora User Groups
- 36 Lectora Accessibility User Group (LAUG)
- 22 ELB Learning Content
- 22 ELB Learning Content Discussions
- 321 CenarioVR®
- 188 CenarioVR Discussions
- 133 CenarioVR Feature Requests
- 41 Rockstar Learning Platform®
- 38 Rockstar Learning Platform Discussions
- 108 CourseMill®
- 108 CourseMill Discussions
- 47 ReviewLink®
- 47 ReviewLink Discussions
- 7 The Training Arcade®
- 7 The Training Arcade Discussions
- 934 All Things eLearning
- 36 eLearning Development
- 546 Learning Management System (LMS) Integration
- 332 Web Accessibility
- 1.2K ♪ The Green Room
- 9 Additional Learning Products