Skip to content

Dwell time calculation while a video in iFrame is getting played #59

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HarithaKintali
Copy link

When a user clicks on any iFrame Timer will stop as window gets blur. Timer will start again only when it gets focus. It will get focus by clicking on the page. So in addition to that now timer will also start when user moves mouse on screen.

When a user clicks on any iFrame Timer will stop as window gets blur. Timer will start again only when it gets focus. It will get focus by clicking on the page. So in addition to that now timer will also start when user moves mouse on screen.
@jasonzissman
Copy link
Owner

Hi! Thanks for the pull request. I do not understand your description of the solution. I tried your code in a test page with an embedded youtube video (iFrame), but the timer in the parent page still stops when you click on the youtube video, even as you move the mouse.

@HarithaKintali
Copy link
Author

Hi, Thanks for your response.
When a page contains iFrame and user performs any action on iframe, iframe will get the focus and the page will not be in focus, because of that dwell time timer of that page will pause. It will resume again only when user performs any click or any other action on the page which will get page into focus. So at present after performing any action on iframe when user moves cursor on page(any place other than iframe) the timer will not start. So with my fix, after performing any action on iframe when user moves cursor on page(any place other than iframe) the page will get focus and timer will start again.

@javatechy
Copy link

javatechy commented Jun 10, 2019

Before the fix:

When the user clicks inside the iFrame, the timer stops immediately. When user goes back to the main page, the timer doesn't resume itself.

Check this video for better understanding : https://youtu.be/mZq3K8IIGRM

After the fix by @HarithaKintali

After updating the code, this issue is fixed as shown in this video https://youtu.be/DQi05-Nw8Lc

document.addEventListener("mousemove", function () { TimeMe.resetIdleCountdown();  window.focus(); });

@javatechy
Copy link

@jasonzissman Did you get a chance to look at the pull request?

@DanielMalmgren
Copy link

This fixed a problem I've been having with embedded Vimeo movies.

However, I've been hit by a side effect. Apparently there are a lot of people out there still using IE and this fix broke all textareas and text inputs in IE. I can click in a textarea and start writing, but if I move my mouse pointer even the slightest (which people tend to do), the textarea looses focus. Any fix for that?

@acheype
Copy link

acheype commented Feb 26, 2020

Has anybody found a fix for the last described side effect ? Thx !

@zvictor
Copy link

zvictor commented Nov 12, 2022

I have pushed a new solution for this issue and I would love to have your feedback on it: #77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants