あなたのビデオを再生する方法、ストリームを再生する方法、またはあなたの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>
これはあなたを助けることを願っていますが、それをストリーミングしたり、私のSDカード上のフォルダから再生するかどうかを選択することができます! SurfaceViewにはいくつか問題がありましたが、このようにして問題が解決しました。
この回答が参考になった場合は、マークしたとおりです。そうでなければ、別の解決策を見つけることができますか – SterAllures