Explore the community Forums Lectora Lectora Questions & Answers Changing playback speed of Audio or Video

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #373542 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 everyone

    Is it possible to change the playback speed of an imported audio or video file (both slower and faster)? How could one do that?

    Thanks

    Andrew

    #373544 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
    131 pts
    @mnotermans5114

    Guess you know the answer. Using javascript 😉 And some library to get that done.

    Here is a sample i did quite a while ago about spritesheets. In it a character running. Several buttons below it. Among them 2, 1 to slowdown speed and 1 to make him run faster. Click multiple times to see the effect.

    Spritesheet setup in Lectora

    Similar technique(s) will work for video offcourse. As the Lectora mediaplayer is based upon the Mediaelement.

    http://www.mediaelementjs.com/

    It should be possible to enhance Lectoras mediaplayer with javascript or add existing Mediaelement plugins to a project. There is for example a plugin to give the player an extra button to set the playbackspeed.

    https://github.com/mediaelement/mediaelement-plugins/blob/master/docs/speed.md

    Sounds like a interesting option. I got no clue how to add a plugin to an existing mediaelement. HTML5 video has default the playbackRate property.

    https://www.w3schools.com/tags/av_prop_playbackrate.asp

     

    For audio you offcourse need something else.
    You could for example use this audio library.

    Fade audio in Lectora

    Checking the documentation for Buzz
    http://buzz.jaysalvat.com/documentation/sound/

    you quickly find that there is a speed property. So you can speedup/slowdown audio with Buzz.

    Set the playback speed where 1 is normal speed, 2 is double speed, etc.
    mySound.setSpeed(2);

    Enough said i guess. With Javascript you can 😉

    Kind regards,
    Math

    This post has received 1 vote up.
    #373547 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
    131 pts
    @mnotermans5114

    Checking the default Lectora17 mediaplayer you find a tag called playbackRate in that file ( trivantis-mep.min.js )

    “playbackRate:-1,defaultPlaybackRate:-1”

    Because that is a minified javascript its quite hard to change anything inthere. You could get the mep.js from Mediaelement.com add/change things inthere and replace the trivantis-mep.min.js with that file.. should work..

    Just downloaded both Mediaelement and the plugins i mentioned. There are definately some good samples inthere of working players with speedup/speeddown options. So standalone it works. Now get it working in Lectora 😉
    Might give that a try this week…

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

    Terrific. Thanks a lot Math!

    Where do you find the information about the mediaplayer etc.? I would not need to bother you/the community then (maybe 😉   )

    I don’t mind Javascript in this case (or ever actually except in a few special cases – depending on who is using it). The main problem I  have with JS is that it is a client-side language and is a huge security risk when you are trying to protect people’s work). It would be better to write in PHP but you would lose at least both functionality and flexibility.

    thanks again!

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

    These 2 links you should find all needed for Mediaelement.

    http://www.mediaelementjs.com/

    https://github.com/mediaelement/mediaelement-plugins/blob/master/docs/speed.md

    Noticed it can also be used for audio playing. Not sure whether Lectora uses it for both ( i do suspect it does ). I have something i need to test/try with an audioplayer anyway. So i probably doublecheck whether mediaelement.js is used for both video and audio and do some digging…seeing if i can extend the player in L16 and 17.

    Regards,

    Math

    PS. adding a suggestion for the developers. Make it possible to extend/override scripts like this in an easy way

    #420935 Score: 0
    Profile photo of Joe Wieloch
    Joe Wieloch
    Moderator
    beginner
    intermediate
    friend finder
    contributor
    LUC16 Attendee
    verified member
    wise owl
    LUC17 Attendee
    advanced
    picture perfect
    74 pts
    @wheels

    We are looking into adding this as an option, but as Math says it can be done in JavaScript.

    I am attaching a Lectora Online Package file which can be imported into either Online or Desktop which shows an example of how you can use scripting to slow down or speed up playback.

    Hope this helps!

    – Joe

    • This reply was modified 1 year, 7 months ago by Profile photo of Joe Wieloch Joe Wieloch. Reason: updated example title
    #430347 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thank you Joe. For some reason I only saw this now

    Andrew

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.