#110 ✓ checked-in
Scott Downe

javascript command

Reported by Scott Downe | October 14th, 2010 @ 12:38 PM | in 0.2 release

An idea that has been thrown around, but needs a ticket, is to have a command that says at this time, run this js function.

The function would be run once when it enters a time between the in and out, and run again if it leaves that time frame and comes back to it. That is the only real purpose of out in this situation.

Comments and changes to this ticket

  • David Humphrey

    David Humphrey October 14th, 2010 @ 12:42 PM

    I think you want to also consider the fact that someone might want to start and stop something with this, so in/out are significant. For example, I might want to take a Processing sketch, show it, and call loop() on in, and on out, call noLoop() and hide it. Another thing you might do is do setInterval and then clear the interval later.

    So rather than a js function, I'd suggest a js object with two functions (start() and stop() maybe), or a way to provide two functions.

  • Scott Downe

    Scott Downe October 14th, 2010 @ 01:01 PM

    Yeah, I like two functions. It opens many possibilities.

    One problem I will try to put into words :P and then try and put the solution for that into words :P

    For in an out, I think define two functions in the xml would be the simplest approach. Call them start and stop for now, and this way, if a stop function does not exist, it'll still support my original idea.

    Set interval though, I am not sure what you mean. First thing that comes to mind is timing and stopping something independently from the video's timeline, and if that's the case, I think the setInterval can be defined from inside the functions.

    I think this structure is simple, and very powerful.


  • David Humphrey

    David Humphrey October 14th, 2010 @ 01:07 PM


    var customJS = (function() {
      var interval;
      function work() {
        // do some work
      return {
        start: function() {
          interval = setInterval(work, 10);
        stop: function() {

    Now you can pass customJS.start and customJS.stop as your two functions, and they will kick off another process in the background that happens every 10ms, but will only run until you tell it to stop. This might be something like pulling new data from a server, drawing some new shape to a canvas, updating something in the DOM, etc.

  • Scott Downe

    Scott Downe October 14th, 2010 @ 02:54 PM

    • State changed from “assigned” to “peer-review-requested”
  • annasob

    annasob October 14th, 2010 @ 04:40 PM

    • State changed from “peer-review-requested” to “staged”

    Code looks good. Runs on all browsers and passes make check
    Staged commit

  • annasob

    annasob October 14th, 2010 @ 04:40 PM

    • State changed from “staged” to “checked-in”

    Checked-in to mozilla/popcorn-js

  • annasob

    annasob November 3rd, 2010 @ 11:36 AM

    • Milestone cleared.

    popcorn-js@@@ @@@ [bulk edit]

  • annasob

    annasob November 3rd, 2010 @ 11:36 AM

    • Milestone set to 0.2 release
    • Milestone order changed from “22” to “0”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.

Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.

Shared Ticket Bins

People watching this ticket

Referenced by