Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best practice add video background view?

I want to add background view with video (or gif) like in app "Uber" I'd like to use video background view for a long time in my app.

And I want to know the answers to these questions:

  • What of them will consume less battery energy
  • Can I use it on iPhone or iPad
  • Performance of this method

Screenshot of the registration form

enter image description here

like image 386
Tikhonov Aleksandr Avatar asked Jun 22 '15 09:06

Tikhonov Aleksandr


1 Answers

First of all,

you have two main choices: use a imageView with a GIF or use a video for background with AVPlayer or MPMoviePlayerController. You can find a lot of example for both ways, here's a few:

  • use a GIF for cool background
  • video cover iOS

In reply to your questions:

What of them will consume less battery energy

Generally use a video: as noted by the user vikingosegundo video are usually optimized and their codecs deal with GPUs; displaying a GIF should be a only "CPU-job" because it's just show a loop of frames. So the energy comparison is between a simple loop of frames (GIF) and a more complex frames loop that can be accelerated in many ways (video). In my experience however a small GIF give a good performance anyway.

Can I use it on iPhone or iPad

In both but you have to be careful with aspect ratio and autolayout constraints

Performance of this method

Excellent in both cases but you have to be careful about the size of your GIF or video: bigger is your file (GIF or video), worse should be the performance. For video more precisely, higher is the quality worse should be the performance while the duration of the video shouldn't be impact.

like image 189
Massimo Polimeni Avatar answered Sep 24 '22 12:09

Massimo Polimeni