Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically adding and removing iframe creates milestone event loop #19

Closed
L-Triple-O opened this issue Feb 10, 2022 · 4 comments · Fixed by #24
Closed

Dynamically adding and removing iframe creates milestone event loop #19

L-Triple-O opened this issue Feb 10, 2022 · 4 comments · Fixed by #24
Assignees
Labels
bug Something isn't working

Comments

@L-Triple-O
Copy link

L-Triple-O commented Feb 10, 2022

Describe the bug
When an iframe is constructed, added and removed from the page dynamically, it seems to create a loop with triggering milestone events. This seems to happen if the action is performed quickly.

To Reproduce
Steps to reproduce the behavior:

  1. Using launch, setup a custom event rule to check for the existence of the iframe added to the page, then trigger() once one is found.
  2. Setup an action inside this rule using this extension to Enable video playback tracking with any player selected and Load Youtube Iframe API checked.

Here is an example of adding a video dynamically: https://codepen.io/l-triple-o/pen/podPQYN.

Expected behavior
Opening and closing the video does not continue to trigger Video Milestone event from extension.

Desktop

  • OS: MAC
  • Browser : Chrome
  • Version : Latest
@L-Triple-O L-Triple-O added the bug Something isn't working label Feb 10, 2022
@yuhui
Copy link
Owner

yuhui commented Feb 20, 2022

@L-Triple-O just to be clear, are you saying that when the same video is added-and-removed from a web page constantly, then each time during playback, the milestones get tracked? i.e.

Page loads
Add video to page
Play video
Milestone 1 reached --> track
Milestone 2 reached --> track
Remove video from page
Add the same video back to the page
Play video
Milestone 1 reached --> track
Milestone 2 reached --> track
Remove video from page
etc...

@L-Triple-O
Copy link
Author

Hi @yuhui ,
No. I'd actually expect what you've described.
What I'm seeing is the video being removed, but the milestones are still being tracked when there isn't an iframe video on the page anymore. I've updated your explanation a little. This also happens after a few times of adding/removing the video.
ex: It works on the 1st time but not the 5th.

Page loads
Click play button
Add iframe video to page
Video autoplays
Milestone 1 reached --> track
Milestone 2 reached --> track
Remove video from page( iframe removed.)
Click play button.
Add the same video iframe back to the page
Video autoplays
Milestone 1 reached --> track
Milestone 2 reached --> track
Remove video from page (iframe removed)
Milestone 2 continues in a loop, being fired and still tracking over and over.

@yuhui
Copy link
Owner

yuhui commented Feb 22, 2022

@L-Triple-O alright, I understand the problem now. Currently, my extension doesn't handle unloading of videos. So when that action occurs, the tracking setup still persists, resulting in the loop that you're experiencing. I'll have to update my extension to handle video unloading. In the meantime, unfortunately, I don't believe there is a workaround aside from forcing a page reload when unloading videos (which might not be desirable for you).

@L-Triple-O
Copy link
Author

@yuhui thanks for noting the issue and the insight on no real workaround for it. You're right, forcing a page reload isn't really an option. It's a great extension and I hope with this update we can move back to using it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants