liquidx / webviewscreensaver

Mac OS X Screen Saver powered by a Web View
Apache License 2.0
1.17k stars 138 forks source link

Framerate in this app vs Safari #16

Closed philipbulley closed 7 years ago

philipbulley commented 9 years ago

Anyone know why https://www.tumblr.com/tv has a good framerate in Safari, but suffers significantly when loaded into this screensaver?

ghost commented 7 years ago

I have same problem with YouTube. 'hd=1' has no effect in 'https://www.youtube.com/embed/UGPuEDyAsU8?hd=1&autoplay=1', but this works fine in Safari.

round commented 7 years ago

I can confirm that any movement or animations (including canvas) in this wrapper has a significantly lower frame rate than in the browser.

liquidx commented 7 years ago

I'm not sure why it might have a lower frame rate than Safari. I suspect the WebView that's used in Safari is different from the one that is exposed for developers.

I generally get pretty good framerates on my 2014 MacBook Air for youtube videos though.

liquidx commented 7 years ago

This may not be something we can do anything about. Closing this issue for now.

round commented 6 years ago

Just used this solution on another project that solved all performance issues with 2D canvas' in WebViews like this: https://stackoverflow.com/a/36363908

EmersonYe commented 5 years ago

@round I tried the workaround of enabling accelerated canvas rendering to no avail.

I ran

defaults write net.liquidx.WebViewScreenSaver WebKitAccelerated2dCanvasEnabled -bool true
defaults write net.liquidx.WebViewScreenSaver WebKitAcceleratedDrawingEnabled -bool true
defaults write net.liquidx.WebViewScreenSaver WebKitCanvasUsesAcceleratedDrawing -bool true

in terminal as suggested by the workaround, then built the application and installed it. The website still rendered extremely slowly (<10 fps).

The website I am setting as my background uses requestAnimationFrame() to draw on the canvas. I wonder why the suggested websites in the README render fine and mine doesn't.

denishowe commented 5 years ago

I can't see the app set animationTimeInterval anywhere.

I read somewhere that the default is one second, which would explain why, e.g. http://foldoc.org/pub/js/clock.html (JavaScript canvas animation) runs smoothly in Safari but jerkily in webviewscreensaver.

Would setting this to a really low value (a) solve the problem and (b) be a good idea?