我不明白这个问题,当我通过后置摄像头录制视频时,视频视图显示实际应该在视频中显示的视图,但是当我使用前置摄像头时,它会旋转到相反的位置。我正在使用一个类,然后为什么我得到视频视图的这种类型的行为?
视频观看代码
public class VideoPreviewActivity extends Activity {
VideoView VideoPreview;
String videoURI ="VIDEO";
Button back;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_preview_screen);
VideoPreview = (VideoView) findViewById(R.id.video_preview);
back = (Button) findViewById(R.id.back);
Bundle bundle = getIntent().getExtras();
videoURI = bundle.getString("VIDEO");
PlayVideo();
back.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
Intent i = new Intent(VideoPreviewActivity.this, PicRecordShareActivity.class);
startActivity(i);
}
});
}
private void PlayVideo()
{
try
{
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mediaController = new MediaController(VideoPreviewActivity.this);
mediaController.setAnchorView(VideoPreview);
// Toast.makeText(getApplicationContext(), "Video:\t"+videoIndex, Toast.LENGTH_LONG).show();
Uri video = Uri.parse(videoURI);
VideoPreview.setMediaController(mediaController);
VideoPreview.setVideoURI(video);
VideoPreview.requestFocus();
VideoPreview.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
{
public void onPrepared(MediaPlayer mp)
{
VideoPreview.start();
}
});
}
catch(Exception e)
{
System.out.println("Video Play Error :"+e.toString());
finish();
}
}
}
谢谢