first my question: Is it possible to change video output using the animations framework? For example with the code below it is possible to scale and rotate a ListView, is it possible to apply such matrix operations on a video which is played using a the Mediaplayer and SurfaceView class?
What I have done so far: The video plays using basically this demo code from android developers.
The animation class I am using consist the following code:
Using java Syntax Highlighting
- import android.graphics.Matrix;
- import android.view.animation.Animation;
- import android.view.animation.LinearInterpolator;
- import android.view.animation.Transformation;
- public class ViewAnimation extends Animation
- {
- float centerX, centerY;
- public ViewAnimation(){}
- @Override
- public void initialize(int width, int height, int parentWidth, int parentHeight)
- {
- super.initialize(width, height, parentWidth, parentHeight);
- setDuration(2500);
- setFillAfter(true);
- setInterpolator(new LinearInterpolator());
- this.centerX = width/2;
- this.centerY = height/2;
- }
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t)
- {
- final Matrix matrix = t.getMatrix();
- matrix.setScale(interpolatedTime, interpolatedTime);
- matrix.preTranslate(-centerX, -centerY);
- matrix.postTranslate(centerX, centerY);
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Then, I used the following code to apply the animation on the surface view (just like the working ListView)
Using java Syntax Highlighting
- //get the surfaceview which the mediaplayer is using
- SurfaceView s = (SurfaceView) findViewById(R.id.surface);
- s.startAnimation(new ViewAnimation());
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
although the animation code is called, the video continues without any animation...
So, because the SurfaceView is a more advanced view, I looked up about doing animations on a SurfaceView. According to this page, the surface has to be handled using it's holder, and using lockcanvas() and unlockCanvasAndPost() to draw on the surface.
Although drawing something on the video is not my direct goal, it is a start... So I Called those methods. But than I get an error because the SurfaceHolder which the player is using is of type SURFACE_TYPE_PUSH_BUFFERS. changing that type to SURFACE_TYPE_NORMAL results in a black screen.
Because the above listed tries results don't work, it seems to me at the moment that video output can't be altered using animation/matrix operations... Any suggestions?
Thanks in advance!


