Explore the community Forums Lectora Lectora Questions & Answers Events in Audio/Video files again

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

    Following up on Darrel’s message…

    The simplest way I can describe it is to say that it should be possible to play precisely from point A to point B in an audio or video file. That will save space and download/upload time as well as development time.

    It should also be possible to set these points programmatically i.e. in JavaScript (or whatever) – and it should not be necessary to prepare everything in advance – the students/program should be able to set these points at will (actually as necessary).

    Also, please provide some reasonable granularity in the time intervals e.g. 1 millisecond or something like that. 1-second intervals are far too imprecise for sophisticated work. 1-byte precision would be great….

    Sorry if this sounds like a lot, but such facilities are really important if we are to make some high quality contributions to areas like language/culture education (my area) especially in hugely expanding markets like the ASEAN community (and also contribute in interesting ways to research in those fields). I currently have many PhD students who already occupy important roles in Asian universities who can use this in their study and, of course, in their future professional lives.

    Thanks!

     

    #316626 Score: 0
    Profile photo of Trivantis Support
    Trivantis Support
    Moderator
    friend finder
    intermediate
    advanced
    contributor
    junior moderator
    Trivantis Support
    verified member
    profile
    wise owl
    curious george
    19 pts
    @Support

    Any files included with a Lectora title will include the full file. If you have an MP4 in your title then the entire video will be included regardless of any controls you have set to only play a portion of it.

    Because we already have the Event Timings feature, any new features like a “Jump to Time” would probably be incorporated with this existing interface. So it would include millisecond timings.

    #316629 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 @support and thanks for the information.

    Yes I am aware that the entire file is sent. However, there are still substantial space savings if one can use the master file rather than uploading the master file AND having to make countless clips from the master file

    Good news about the milliseconds.

    Thank you,,,

    #316998 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Interesting followup.

    If I have TWO buttons to access the same audio file (at different times, and whether using the jquery version or not), This is what happens:

    (a) Button 1 is supposed to play from 5 seconds to 7 seconds

    (b) Button 2 is supposed to play from 3 seconds to 10 seconds.

    If I click in Button 2, it correctly plays from 3 – 10. It will do so repeatedly. If I click on Button 1, it will also play correctly from 5 – 7 seconds.

    If I then want to click Button 2 again, it will start at the correct point (3 seconds) but will always stop at 7 seconds (as in Button 1) and NOT at 10 seconds (the correct stopping point).

    It makes no difference whether I set the end point manually or with a variable. It seems to remember the ending point no matter what I do.

    if(currentTime >=10){ // It does not matter what I do this condition does not work. I could change 10 to 3 or 100.
    myplayer.stop();
    }

    If I refresh the page then everything is re-initialised. I have tried creating a new player (myplayer2) and also played with the name of the time variable. Nothing seems to work. I wonder if there is some function to reinitialise the whole system.

    This is puzzling me … I will keep investigating, In the meantime, any expert ideas would be welcome. I tried to attach a zip file using Darrel’s initial programming and different cuepoints – but it was to big for some reason.

    • This reply was modified 3 years, 2 months ago by Profile photo of Andrew Lian Andrew Lian.
    #317048 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    It’s as if the following line

    if(currentTime >=10){

    was changed internally (and invisibly) to

    if(currentTime >=7){

    So strange…

     

    #317331 Score: 1
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    303 pts
    @timk

    Hi,

    I could make Darrels code work for two buttons playing overlapping parts of an audio:

    1. Created a Lectora variable “audio_stop”

    2. Added an action to the page to set up the player and event listener:

    On: Show
    Action: Run javascript
    Javascript:

    myplayer = document.getElementById("audio48Media");
    
    myplayer.addEventListener("timeupdate", function(e) {
    var currentTime = myplayer.currentTime;
    
    if(currentTime >=Varaudiostop.getValue()){
    myplayer.stop();
    }
    }, false);

    3. Add an action to the button to set stop timing

    On: Click
    Action: Modify variable
    Target: audio_stop
    Type: Set equal to
    Value: 10 (the time to stop)

    4. Add an action to the button to set start timing and play

    On: Click
    Action: Run javascript
    Javascript:

    myplayer.setCurrentTime(5);
    myplayer.play();

    This worked for both buttons on all clicks.

    With regard to “the ending point sliding a little”: you wrote in another thread that you’re still on Lectora v12 and thus working with JW Player. As far as I know the JW Player doesn’t know milliseconds but only responds in .1 second steps. If you try to stop at .15 it will actually stop either at .1 or .2.

    Tim

    This post has received 1 vote up.
    #317332 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 Tim

    Thanks so much … sounds ingenious. That way only one instance of the player is ever created. I will see how that works here.

    And no… the “sliding” occurred in Lectora 16… actually I tried out Darrel’s code in Lectora 12 and it did not seem to work.

    Will let you know how things develop – thanks again

    Andrew

    #317337 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Fantastic! I have now tried this with three buttons and passing variables to the player from Lectora as well as hardcoding.

    Thank you Tim (and of course Darrel, Sergey and Math – such a great team – you have all been wonderful to me over many months now)! I am beyond words…  I have literally been waiting for years for an integrated solution (provided by Lectora and you) and must have asked dozens/hundreds of people…

    #317351 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    FYI, Tim’s adaptation of Darrel’s coding also works with multiple players on the same page (well two  anyway) each accessing a different audio file. While it’s great that this works, I wonder what is the explanation of the problem I encountered. The only explanation I can come up with is that in Tim’s coding, players are declared only once each (on page show) whereas the way I had it, a player was declared each time a button was pressed.

    #317352 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
    118 pts
    @mnotermans5114

    That might be the issue Andrew 😉

    Instantation of an element should always be done only once. Then you can change or update any content at any action or at any time, but if you declare the same object again, you need to redo all the actions to check whether its setup properly again too. When for what reason you need to instantiate/declare something again , you need to make sure to kill/remove the old object, else you can run into trouble ( as probably happened ) because the scripts target the wrong object. Your issue might be something like that…having the wrong scope..

    #317506 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    Hey gang. I’ve been quite busy all of a sudden. Tim, thank you for picking this up. Your solution looks elegant. I haven’t had much time to play with this but I’m still having the same issue I had before; it takes two clicks of the second audio button to play. I see there was a typo on your onload page code Varaudiostop.getValue() should be Varaudio_stop.getValue(). Missing the underscore, no biggie unless someone is trying to follow along that doesn’t usually write scripts.

    Unless I’m doing something wrong (extremely possible) I’m not getting Andrews results.

    I used and recommended mediaelement.js when Lectora was still using JSPlayer because I like to have full control using the API. I think some of the issues we’re running into is the way Trivantis is implementing the code. As soon as I have the time I’ll add mediaelement.js using an HTML header script and build it independent of Lectora as a test – unless one of you beat me to it. 

    One player instance should be able to handle this adding and removing event listeners as required.

    Teamwork is awesome.

    #317511 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Maybe two issues.

    Yes – the first issue was the typo (from Tim – which I forgot to report in my euphoria) but I also noticed something else…

    Darrel, when you sent out your code, I noticed you were using a combination of different types of quote marks, e.g. a “grave” accent etc. In order to make your code work I had to replace your quotes with (in my case) standard single quotes and then it was ok. Could that be the reason for your double-clicking issue?

    I have just managed to get the clips to repeat X times using setTimeout and doing a very primitive time calculation to set the limits of the timeout. It is all scavenged code (of course 🙂 ). Does it work, yes. Is it the correct way to code, certainly not. The real problem is that I could not find a way of emulating the Lectora “On Done Playing” action (especially as the code is split). Anyway, I prefer JS as it leaves me more in control. Just need to set up and communicate Lectora variables to JS (which is no great hardship). I am happy to share my code but you will laugh a lot.

    And yes teamwork is awesome. It is the way of the 21st century… I think of it as community intelligence… look at some of the great crowdsourcing successes, e.g. http://fold.it

    cheers

    #317512 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    I’ll check the quote thing. I always say not to copy and paste from the forum because I always run into quote issues, maybe I failed to follow my own suggestion. 

    Also, there is a timerRate option that has a default of 250. This determines how often the timeUpdate fires. I tried to adjust this but I was not successful in getting a noticeable change. Again, I think it has to do with the way Lectora implements mediaelement (Sorry, easy to blame them, it’s probably just me.) I found THIS on github. We’ll conquer this, I’m sure of it.

    I think the best solution will be to implement your own import of mediaelement.js like it doesn’t exist in Lecotra and work from there. Like you said, FULL control without side effects.

    Fold.it – uh oh, like I need another distraction…lol. That’s pretty cool, Thanks for sharing it I’ll be checking it out.

    #317513 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    For interest: A quote about foldit:

    Understanding how proteins fold themselves into configurations that allow them to do their work provides a recent example of discovery’s unanticipated payoffs. Delving into them prodded the development of massive supercomputers. Solving their structure exposed the cause of degenerative brain diseases such as mad cow disease— work that won Horwich and Hartl a Lasker Award, second in prestige only to the Nobel Prize. Most surprisingly, the method created for solving the problem of protein folding spurred a transformation in scientific methods: citizen science. It was not a team of university researchers but a web game that cracked the problem of understanding the rules that govern how proteins fold. In the game Foldit, players come up with optimal shapes based on key protein features. Played by about a quarter of a million enthusiasts at home, motivated simply by achieving the highest posted scores, gamers delivered a groundbreaking, accurate three-dimensional image of an AIDS-causing monkey virus enzyme that had eluded scientists for 15 years. It took them all of 10 weeks. Most had no formal science background or advanced education.

    #317530 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    303 pts
    @timk

    Hi,

    thanks for correcting my typo.

    The forum will change the format of quotes ‘ “, unless it is marked as code:

    myplayer = document.getElementById("audio48Media");

    Tim

    Attachments:
Viewing 15 posts - 16 through 30 (of 37 total)

You must be logged in to reply to this topic.