私はアプリ内のリソース(res/rawまたはassets)からmp4ビデオを再生しようとしていますが、運がないとか、チュートリアルやソリューションを見つけることができません。 。Android:内部MediaPlayerのビデオをリソースから再生するにはどうすればいいですか?
以下のコードは動作すると思っていましたが、それはどうですか?
おかげ ルーシー
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video);
final Button button = (Button) findViewById(R.id.play);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Uri uri = Uri.parse("android.resource://com.video.play.test/" + R.raw.test2);
Intent intent=new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "video/mp4");
startActivity(intent);
}
});
}