2014-03-31 164 views
7

我想90度旋转视频。视频视图旋转90度在Android

当前我旋转布局但视频无法播放。 XML

<LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="horizontal" 
     android:rotation="90" > 

     <VideoView 
      android:id="@+id/videoView" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" /> 
    </LinearLayout> 

的Java

videoView = (VideoView) findViewById(R.id.videoView); 

      final Uri videoUri = Uri.parse(
       Environment.getExternalStorageDirectory().getAbsolutePath()+"/UnoPlayList/restaurant_menu_pro_mkv.mkv"); 

     videoView.setVideoPath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/UnoPlayList/restaurant_menu_pro_mkv.mkv"); 
     //videoView.setRotation(180); 
    // videoView.setVideoURI(videoUri); 
     videoView.start(); 

有什么办法来旋转视频。

例如: https://play.google.com/store/apps/details?id=com.mycall.videorotate&hl=en

请帮助我。

+0

检查了这一点的videoview:http://stackoverflow.com/questions/8586526/rotating-an-android-videoview – Dunken

回答

-3

没有刚才设置旋转为这一切

  videoView.setRotation(90f); 

      (or) 


<VideoView 
    android:id="@+id/videoView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:rotation="90" /> 
+20

不工作,显示黑色屏幕。 – Hemant

+2

它将显示黑屏,因为videoView固有使用表面视图。由于SurfaceView的内容不在应用程序的窗口中,因此无法高效地转换(移动,缩放,旋转)。 – Jaydev