我有一个视频流来播放视频,它工作正常,但视频的大小太小,我尝试在API演示中流式传输,同一视频的大小是正常的。我做错了什么?这是一些代码:
main.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingLeft="2px"
android:paddingRight="2px"
android:paddingTop="2px"
android:paddingBottom="2px"
android:layout_width="fill_parent"
android:orientation="vertical">
<VideoView
android:id="@+id/VideoView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
</LinearLayout>
Main.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video);
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse("http://www.free-3gp-video.com/download.php?do-beer-not-drugs.3gp");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
}
答案 0 :(得分:2)
无需代码以全屏模式播放视频
<?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/myvideoview"
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>