비디오를 재생하거나 스트리밍하거나 sdcard 또는/res 폴더로 복사하는 방법을 모르겠지만 비디오를 재생하려면 다음이 필요합니다. 나는
Video.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.VideoView;
public class Movie extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_layout);
VideoView video = (VideoView) findViewById(R.id.movie);
//this is the place where you define where to get the video from (this can be from your sd or a stream)
video.setVideoPath(
"/sdcard/video/videofile.mp4"
/*"rtsp://Youtube Stream*/
);
//after the video is loaded it will then start
video.start();
}
}
video_layout.xml에게
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView
android:id="@+id/movie"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center">
</VideoView>
</FrameLayout>
이 당신을 도울 것입니다 희망을 스트리밍 또는 내 SDCARD에있는 폴더에서 재생할지 여부를 선택할 수 있습니다! SurfaceView에는 몇 가지 문제가 있지만이 방법으로 문제가 해결되었습니다.
이 답변이 도움이 되었다면 표시는 답과 같습니다. 그렇지 않으면 다른 해결책을 찾을 수 있습니까? – SterAllures