VideoView无法播放带有片段的视频,我创建了一个片段,为什么要使用ButtonNavigationView。这是源代码,请帮助我,我没有发现错误:
package mediaser.tivvmialive;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.MediaController;
import android.widget.VideoView;
public class Home extends Fragment {
public static Home newInstance() {
Home fragment = new Home();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_home, container, false);
VideoView videoView = view.findViewById(R.id.videoView);
Uri video = Uri.parse("http://rumblehwk.altervista.org/VideoHome/default.mp4");
videoView.setVideoURI(video);
videoView.start();
return inflater.inflate(R.layout.activity_home, container, false);
}
}