如何在Android中将视频旋转90度、180度或270度?

3
我正在寻找在安卓系统中实现视频旋转的程序代码。
之前,我用以下代码完成了图像旋转。
bMap = BitmapFactory.decodeResource(getResources(), R.drawable.aa_presell_ribs);

//Create object of new Matrix.
matrix = new Matrix();

//set image rotation value to 270 degrees in matrix.
matrix.postRotate(270);

//Create bitmap with new values.
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(), bMap.getHeight(), matrix, true);

//put rotated image in ImageView.
imageView.setImageBitmap(bMapRotate);

我在谷歌和其他来源上搜索过,但是没有找到这样的代码。

2个回答

0

-2

你只需要旋转图像视图

就像这样... 但它只能在API 11及之后的版本中工作...百分之百可以工作

    imageView1 =(ImageView) findViewById(R.id.imageView1);
    imageView1.setRotation((float)90);

你只需要使用视频视图替换图像视图。
private VideoView videoView1;   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    videoView1 =(VideoView) findViewById(R.id.videoView1);
    videoView1.setRotation((float)90);

} 

那将运行良好....


1
好的,但我想要旋转视频。在安卓中有没有旋转视频的方法? - Hemantvc

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接