Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,786,823 Members 41,928 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Loop video on login screen like Spotify

Tip us?
 
Moonbloom
Old
#1  
Senior Member - OP
Thanks Meter 97
Posts: 442
Join Date: Aug 2011
Default [Q] Loop video on login screen like Spotify

Hello

I'm currently making an app and i want to spruce up the login screen with a video like Spotify currently has.
It plays a small video in the background, behind the login buttons/logo etc and simply loops the video over and over again.

I've tried to mess around with a VideoView and a MediaPlayer to control it, but i can't seem to get a proper grip on it. And especially not with setting the correct size of the video dependent on different screen sizes or looping the video.

If anyone got an idea/link/knows how Spotify does it, i'd love to get some inputs

- Moon
Please click the "Thanks" button if I helped you

If you really want to thank me, or just need a Dropbox account, use my referral link by clicking on the image below and we both get 500 MB more space when you install the program, completely free!
 
gh0stslayer
Old
#2  
gh0stslayer's Avatar
Senior Member
Thanks Meter 133
Posts: 195
Join Date: Nov 2010
Location: Bangalore
Quote:
Originally Posted by Moonbloom View Post
Hello

I'm currently making an app and i want to spruce up the login screen with a video like Spotify currently has.
It plays a small video in the background, behind the login buttons/logo etc and simply loops the video over and over again.

I've tried to mess around with a VideoView and a MediaPlayer to control it, but i can't seem to get a proper grip on it. And especially not with setting the correct size of the video dependent on different screen sizes or looping the video.

If anyone got an idea/link/knows how Spotify does it, i'd love to get some inputs

- Moon
For the loop part you could try alarm manager. Now I know this is not the ideal solution for your case, but it works well if you want to loop a function
PHP Code:
 PendingIntent pi;
    
BroadcastReceiver br;
    
AlarmManager am;




private 
void replay() {
        
br = new BroadcastReceiver() {

               @
Override

               
public void onReceive(Context cIntent i) {

                   
//The method which runs video

                      
}

               };

        
registerReceiver(br, new IntentFilter("com.your.packagename") );

        
pi PendingIntent.getBroadcastthis0, new Intent("com.your.packagename"),);

        
int video_length =exact length of your video in seconds;
       
        
am = (AlarmManager)(this.getSystemServiceContext.ALARM_SERVICE ));
        

            
am.setRepeating(AlarmManager.RTCSystem.currentTimeMillis(), 1000 video_lengthpi);
        
  } 
call this replay method at the place where you are calling the method to play the video.
Worth a try, might work
 
danelab
Old
#3  
Junior Member
Thanks Meter 5
Posts: 15
Join Date: Mar 2014
Quote:
Originally Posted by Moonbloom View Post
Hello

I'm currently making an app and i want to spruce up the login screen with a video like Spotify currently has.
It plays a small video in the background, behind the login buttons/logo etc and simply loops the video over and over again.

I've tried to mess around with a VideoView and a MediaPlayer to control it, but i can't seem to get a proper grip on it. And especially not with setting the correct size of the video dependent on different screen sizes or looping the video.

If anyone got an idea/link/knows how Spotify does it, i'd love to get some inputs

- Moon
Did you tried to use MediaPlayer.OnCompletionListener to restart a video? To be honest I'm not sure, that this way will provide smooth restart.
I can't download Spotify, because it's not available in my country, but maybe Spotify uses something like looped AnimationDrawable?
AnimationDrawable works great with short animations.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes