Again, this bug is about the Media Player brick in Appmaker showing twice whenever it is being loaded. Later I found out that the same behaviour happens whenever you click on the “Duplicate this brick” button as well. I’m currently waiting for them to look at my pull request so that I can know if I have to change anything. I have tested this fix so far only on clicking the “Duplicate this brick” button because I can’t seem to find a “Save App” button anywhere when running Appmaker locally.
The Media Player brick currently has a default video that loads up whenever you create one. Every time you select the brick, it calls the initPopcorn() function which then works with popcorn.js to create the player. The bug happens whenever you have changed the url for the source of the video and then duplicate the brick(or possibly load the saved app which I did not get the chance to test). This calls initPopcorn() twice – first from ready: and then urlChanged: – which gets triggered when the source gets changed. The quick fix I added was to put a check in ready: to see if it’s the original url, if it is, that’s the only time initPopcorn() will be called from ready:.
It’s a one liner fix that drove me nuts especially since my dev env got messed up last time (still waiting for a feedback but hey it works!) . I am super glad and very thankful to the people who created the Developer tools in Chrome and to Dave who showed that in class – this made my life easier.