Video resize animation

All your problems with Audio, Video and Images.

Video resize animation

Postby azraeal » Fri Sep 04, 2009 7:29 pm

Hi all,

I'd like to achieve a simple video resize animation. I currently have a videoview with corresponding mediaplayer/mediacontroller playing the video with no problems. I've tried attaching an animation to the videoview, but all that did was shrink the viewing area without shrinking the content. Code follows:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void startAnimation(){
  2.  
  3.                 ScaleAnimation a = new ScaleAnimation(1f, .5f, 1f, .5f);
  4.  
  5.                 a.setDuration(5000);
  6.  
  7.                 a.initialize(this.w, this.h, parent.w, parent.h);
  8.  
  9.                 this.startAnimation(a);
  10.  
  11.         }
  12.  
  13.  
  14.  
  15. public void onPrepared(...){
  16.  
  17. ... //play content
  18.  
  19. startAnimation();
  20.  
  21. ...
  22.  
  23. }
  24.  
  25.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Now an instantaneous resize does the same thing but the workaround is to force a layout pass with the videoview shifted by 1px. This is a visual trick and unnoticeable but it works. Below is this old method. MyPlayerView extends VideoView.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private void changeLayout(final int x, final int y, final int width, final int height){
  2.  
  3.         if(getLeft() != x || getRight() != x+width || getTop() != y || getBottom() != y+height){ //sanity/bounds checks
  4.  
  5.                 if(getLeft() == x && getTop() == y){
  6.  
  7.                         MyPlayerView.this.layout(x-1, y-1, x - 1 + width, y - 1 + height);
  8.  
  9.                 }else{
  10.  
  11.                         MyPlayerView.this.layout(x, y, x+width, y+height);
  12.  
  13.                 }
  14.  
  15.         }
  16.  
  17. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


So, I come here seeking help. Has anyone done something similar with videos? I'd like to achieve an animated resize while content is playing. Closest topic I found was http://groups.google.com/group/android- ... b?lnk=raot but the solution doesn't apply to my scenario. Any help would be appreciated.
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Top

Postby azraeal » Thu Sep 10, 2009 12:15 am

Seriously, no one has tried this, or have any suggestions?
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Re: Video resize animation

Postby wiegerthefarmer » Wed Jul 20, 2011 1:12 pm

Did you ever find out how to do this? I"m working on the same thing right now...
wiegerthefarmer
Freshman
Freshman
 
Posts: 2
Joined: Wed Jul 20, 2011 1:08 pm

Re: Video resize animation

Postby azraeal » Wed Jul 20, 2011 6:12 pm

Wow, almost 2 years since I've posted this issue.

In the interim, we've seen the release of Android 2.1, 2.2, 2.3 and 3.0. I take it that this resize still can't be animated?
Unfortunately, I've since been moved off of Android development. I can tell you we've decided to put up with the workaround.
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Re: Video resize animation

Postby wiegerthefarmer » Wed Jul 20, 2011 6:17 pm

WOAH! I can't believe you actually replied! :) Sweet.

I don't know 100% if it can't be animated. What I want to do is make it so that a videoview can be shunk/grown/animated so it can look like it's in a bubble...

Oh shit. Just thought of something. Can I make the video view the entire resolution, and then just redraw the video in a portion of the screen? Then I could apply transformations to the subarea....
wiegerthefarmer
Freshman
Freshman
 
Posts: 2
Joined: Wed Jul 20, 2011 1:08 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 21 guests