我創建這個片段來流視頻,但我得到兩個錯誤聲明方法findViewById(INT)是未定義的,並且構造函數MediaController是未定義的。findViewById(int)方法未定義,構造函數MediaController未定義
public class CommunityFragment extends Fragment {
VideoView videoview;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_community, container, false);
VideoView videoView=(VideoView)v.findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(getActivity().getApplicationContext());
String str="http://202.73.9.10:1935/live2/smil:kctv_all.smil/playlist.m3u8";
Uri uri = Uri.parse("first_uri");
mediaController.setAnchorView(videoView);
videoView.setVideoURI(uri);
videoView.setMediaController(mediaController);
videoView.start();
return v;
}
}
我將所有進入onCreateView,但現在它聲明「無法播放視頻」 – Key