bbc / VideoContext

An experimental HTML5 & WebGL video composition and rendering API.
http://bbc.github.io/VideoContext/
Apache License 2.0
1.33k stars 157 forks source link

Is there any way to reduce power consumption on mobile platform #108

Closed yoli799480165 closed 6 years ago

yoli799480165 commented 6 years ago

I use this lib on my cordova project, everything works fine on android or ios platform. But after some testing, I found that when I used this lib on a mobile platform, the power consumption was too high. Is there any way to optimize?

PTaylour commented 6 years ago

There are a few things you can do to optimise the amount of work required to render each frame.

For example, the dimensions of the canvas element will often make a substantial difference to the performance. If you reduce the width and height of the canvas (you can use css to scale the element to your required size) you reduce the size of the bitmap that needs to be drawn on the canvas, which require less CPU.

The best optimisation steps will depend on your videocontext graph and it it's inputs. For example, if you're using a lot of high resolution videos the browser will require a significant amount of power to decode them in parallel. We may be able to better assist if you can provide a bit more about your use case?

Pete

PTaylour commented 6 years ago

re-opening to ask: have you tried setting preserveDrawingBuffer to false?

see https://github.com/bbc/VideoContext/issues/59

PTaylour commented 6 years ago

Shall close for now. But feel free to re-open