비디오 재생을위한 응용 프로그램을 개발했습니다. 비디오를 재생하는 코드는 여기에 있습니다.android : 와이드 스크린 비디오 재생
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.videoview);
Intent i = getIntent();
Bundle extras = i.getExtras();
filename = extras.getString("videofilename");
mVideoView = (VideoView)findViewById(R.id.videoview);
path=filename;
if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(
ViewVideo.this,
"Please edit VideoViewDemo Activity, and set path"
+ " variable to your media file URL/path",
Toast.LENGTH_LONG).show();
} else {
mVideoView.setVideoPath(path);
mc = new MediaController(this);
mVideoView.setMediaController(mc);
mVideoView.requestFocus();
mVideoView.bringToFront();
mVideoView.start();
}
}
다음은 xml 코드입니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView android:id="@+id/videoview"
android:layout_width="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_height="fill_parent">
</VideoView>
</RelativeLayout>
문제는 그 때 와이드 스크린을 재생하려고 할 때입니다. 16 : 9 비디오. 그것을 전체 화면에 표시하고 문자가 꽉 짜여진 것처럼 보입니다. 매트와 함께 와이드 스크린 형식으로 재생해야합니다 (위와 아래에있는 두 개의 검은 색 가로 막대) .. 어떤 제안을 해주시겠습니까 ??
XML 레이아웃도 게시 할 수 있습니까? – theisenp
xml을 포함하도록 코드를 편집했습니다. 여기 좀 도와주세요. – Farhan
VideoView 레이아웃 매개 변수를 설정해야 할 수도 있습니다. stackoverflow 게시물 중 하나에 비디오 재생을하는 Activty 코드를 넣었습니다. http://stackoverflow.com/questions/6977382/videoview-in-eclipse-not-playing-on-phone/6977770#6977770 – Shash316