Skip to content

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

Open
HarithaKintali wants to merge 2 commits into
jasonzissman:masterfrom
HarithaKintali:patch-1
Open

Dwell time calculation while a video in iFrame is getting played#59
HarithaKintali wants to merge 2 commits into
jasonzissman:masterfrom
HarithaKintali:patch-1

Conversation

@HarithaKintali

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

javatechy commented Jun 10, 2019

Copy link
Copy Markdown

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
Copy Markdown

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

@DanielMalmgren

Copy link
Copy Markdown

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

acheype commented Feb 26, 2020

Copy link
Copy Markdown

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

@zvictor

zvictor commented Nov 12, 2022

Copy link
Copy Markdown

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