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:
Screenshot of the registration form
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With