You are not logged in.

1

Sunday, March 15th 2015, 5:41am

Auto pause video player on scroll out of view down the web page (like facebook) ?

Might there be a way to pause the player when its scrolled out of view? Like is done with videos on Facebook, as you scroll down the web page.

or like the brightcove player does when you scroll in and out of view -- http://docs.brightcove.com/en/video-clou…-into-view.html

This post has been edited 3 times, last edit by "SpinStudios" (Mar 18th 2015, 5:05am)


Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Monday, March 16th 2015, 2:50pm

you could use the event onviewchange and then a spheretoscreen check on the hotspots coordinates. If spheretoscreen doesnt return good values its not on the screen. You can then use delayedcall so that your code only runs every half second or so, to lighten the cpu if it seems heavy as onviewchange can sometimes be a bit heavy.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Monday, March 16th 2015, 8:25pm

Thanks, I'll give that a try. But wondering if the extra onviewchange CPU demand may defeat my purpose of stopping the video when not in view to free up the CPU!

I'm wanting to run the Player at the top of the web page, but have it stop pause or unload on scroll out of view to free up resources for additional media further down the page. (Perhaps setting the code to run every few seconds would still accomplish this?) I just need the top player to stop before the second player is started. It likely takes a few seconds for a visitor to meander down the page and click on second player. I just need the code to run often enough to beat the visitors mouse click event.

This post has been edited 2 times, last edit by "SpinStudios" (Mar 16th 2015, 8:41pm)


Umalo

Professional

Posts: 1,047

Location: Osijek, Croatia, EU

  • Send private message

4

Monday, March 16th 2015, 11:46pm

Why you don't try Sacha's proposal but with onviewchanged instead of onviewchange ?

5

Tuesday, March 17th 2015, 5:58pm

like this?

Source code

1
2
3
4
5
6
7
8
9
10
<events name="TestPlayerinView" keep="true" onviewchanged="hotspots_visiblity();"/>
<action name="hotspots_visibility">
   spheretoscreen(hotspot[spot].ath, hotspot[spot].atv, layer[spot].x, layer[spot].y, atv, hotspotcenterx, hotspotcentery);
trace(hotspotx); 
trace(hotspoty); 
if(x != 0, ifnot(x, set(is_visible,false); ));
if(is_visible,false, plugin[videoPlayer].stop();
if(is_visible,false, plugin[videoplayer].play();
   	delayedcall(0.03, hotspots_visibility());
  </action>

This post has been edited 1 times, last edit by "SpinStudios" (Mar 18th 2015, 4:58am)


6

Wednesday, March 18th 2015, 5:04am

Quoted

Pause on scroll out of view, Like is done with videos on Facebook, as you scroll down the web page.

or like the brightcove player does when you scroll in and out of view -- http://docs.brightcove.com/en/video-clou…-into-view.html
I edited my original question.
I would think stopping the krpano player on page scroll out of view would be an important feature already implemented.
(Nothing more irritating then having to hit the pause button to get a video to shut up after you scrolled away down the page)

This post has been edited 1 times, last edit by "SpinStudios" (Mar 18th 2015, 7:26am)


Similar threads