How to detect if Safari power saver mode is enabled?
Asked Answered
V

2

9

I'm experiencing issues with the YouTube player failing to load when the power save mode is enabled in Safari 6.1 and 7 on OSX. The issue doesn't happen if the youtube user is using the experimental HTML5 player, but it's still in beta and most people are still using the Flash player. The "disable plugins to save power" option is on by default in most new versions of Safari and this causes the YouTube iFrame API to enter an endless loop as it tries to initialize the player.

Is there any attribute on the window or navigator objects that would possibly indicate that the power save mode is enabled so that I can warn users?

Vergne answered 15/1, 2014 at 18:3 Comment(0)
L
2

This issue is semi-intentional. The Power Saver mode in Safari deliberately stops flash content. You can read more about it in this article.

If the flash content is 'front and centre' (within a 3000 x 3000 pixel boundary starting at the top left corner of the document) it should still play. So it may help, if the youtube video is off to the side of the page, to try and centre it. Apple says content will not play if it is in the margins (see this page under the Safari Power Saver heading).

Lamm answered 27/1, 2014 at 4:23 Comment(5)
The limitations I've discovered are that "front and center" mean within a 3000 x 3000 pixel boundary starting at the top left corner of the document. Content can be loaded off screen to the direct right or bottom, then moved back into place. Negative top or left positions will result in the content not loading. I may turn this into my own answer.Vergne
Thank you for the comment @Soviut, that would also make a good answer. I included the definition of front and center you have discovered in my answer as well so hopefully people find it straight away.Lamm
@Vergne - I'm not sure that 3000x3000 pixel boundary is accurate (and is video at 2900,2900 really front and center?) No youtube video is going to be off to the side, at least not on youtube.com, but youtube videos still start paused. To satisfy my curiousity, I looked at the location of youtube videos and they are at (179,60) with my settings. Can't get much more front and center than that.Alcantara
@Alcantara It's up to the browser to decide what "front and centre" means. In my tests I found it to be a 3000 pixel boundary in a positive direction assuming the top left of the page is (0,0). My issue isn't playing videos on YouTube, it's embedding videos on a large page while still ensuring the players loaded correctly.Vergne
@Vergne Understood. The main issue seems to be that while Apple claims it's "front and center" they are being somewhat disingenuous. From my tests, it seems that if Apple thinks the Flash video might be advertising, Safari will pause it, no matter where on the page it appears. My guess is they are using URL lists for this but I have no confirmation. That would explain why Youtube videos with pre-roll ads attached won't play, even on youtube.com. Interestingly, once a single video has been approved, Safari "whitelists" the site, and all videos will play, no matter where they are located.Alcantara
H
0

Well i do not think there is any readable JS property to know that, if so Apple would have a flawed design, and the Safari Users would get nagged to disable that mode, in order to have the web site working "properly" ... What you could do of course is to try to make a server call on your web site via flash, and then try to read the changed session variable via JavaScript, then you would know ...

Hagridden answered 26/1, 2014 at 17:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.