我正在尝试让视频在片段中播放,但无法播放。除了“文件不是扩展名不是DRM”之外,我没有收到任何其他错误。不确定这是否是视频无法开始的原因
public class HomeFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.home_page, container, false);
videoPlay(rootView);
return inflater.inflate(R.layout.home_page, container, false);
}
public void videoPlay(View rootView){
MediaController mc = new MediaController(getActivity());
VideoView videoView = (VideoView)rootView.findViewById(R.id.videoView);
String videoPath = "android.resource://" + getActivity().getPackageName() + "/" + R.raw.ds;
videoView.setVideoURI(Uri.parse(videoPath));
videoView.setMediaController(mc);
videoView.start();
Log.i("myTag", "chicken");
}
}