Explore the community Forums Lectora Lectora Questions & Answers Dynamically changing name of media files

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #351830 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    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

    #351864 Score: 1
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    75 pts
    @mnotermans5114

    Maybe its possible to use variables for that. If you can share a simple sample, we can try to use variables for the media file to be played…

    This post has received 1 vote up.
    #351869 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    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

    Attachments:
    1. title3.zip
    #351872 Score: 1
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    75 pts
    @mnotermans5114

    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

    This post has received 1 vote up.
    Attachments:
    1. title3.1.zip
    #351875 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thanks Math – will take a look a bit later as I have to go to work now.

    I will report back

    cheers

    andrew

    #351877 Score: 1
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    75 pts
    @mnotermans5114

    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

    This post has received 1 vote up.
    Attachments:
    1. Title-3.2.zip
    #351884 Score: 1
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    75 pts
    @mnotermans5114

    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

    This post has received 1 vote up.
    Attachments:
    1. Title3.3.zip
    #351937 Score: 1
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    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!

     

     

    This post has received 1 vote up.
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.