Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a video as background

Tags:

android

I am making a login screen for my Android app and was wondering how can I use a video as a background rather than having an image or simple colors?

I want to make it similar to the Spotify / Bible app login screen where they have a video playing and you have buttons to sign in or register.

Images -

(Click image to enlarge)

IMG:

IMG:

like image 859
NatureDevil Avatar asked Nov 01 '15 02:11

NatureDevil


People also ask

Can I use a video as my wallpaper?

Newer versions of Android allow you to create live wallpapers natively. Open the Gallery app, select the video, and choose Set as Live Wallpaper.

How do you set a video as your background Windows 10?

Right-click the playback window, then click Video > Set as Wallpaper to apply the video as your desktop wallpaper.

Can we set video as background in HTML?

To use a video background we have to use the HTML 5 <video> element with position absolute inside a container wrapper.


1 Answers

You just need a few steps to set the video as the background of your app.

  1. Create a video view and make sure it takes up the whole area. If you are using constraint layout, you need to set all the constraints of your video view to parent.
  2. Create a new directory called "raw" under your "res" directory
  3. Place your video file into the "raw" directory
  4. Play the video
     VideoView videoview = (VideoView) findViewById(R.id.videoview); Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.test); videoview.setVideoURI(uri); videoview.start(); 
    I have made a video that explains how to create JOOX login screen in android which looks more or less like the Spotify app. Feel free to check it out and let me know if it helps :)

https://youtu.be/tPeDn18FrGY

like image 113
Jack Tiong Avatar answered Sep 18 '22 22:09

Jack Tiong