0
我的視頻在高api水平手機上播放它的MP4格式小剪輯視頻觀看android和低api水平
但不是在低的例如。三星二重奏API 15 - 沒有錯誤只是在視頻查看
,所以我檢查了我的gradle這個對於分鐘SDK及其11及上限爲23,因此不會使一個問題
這裏黑屏是代碼
private String path ;
private VideoView mVideoView;
IN-的onCreate
path = "android.resource://" + getPackageName() + "/"+R.raw.nameofvideo;
mVideoView = (VideoView) findViewById(R.id.myVideo);
mVideoView.setVideoPath(path);
mVideoView.start();
XML部件用於視頻視圖
<VideoView
android:id="@+id/myVideo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"/>
如何在api 15或類似13的手機上播放視頻?
的VideoView本身是相當不穩定的 - 看看ExoPlayer由谷歌更好的視頻播放器的支持。 https://google.github.io/ExoPlayer/guide.html – Ewald