使用媒体控制器从 firebase 流式传输视频
video streaming from firebase using media controller
public class MessageFragent extends Fragment {
private VideoView videoView;
private Uri videoUrl;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_message,container, false);
videoView = v.findViewById(R.id.vviewVideo);
videoUrl = Uri.parse("https://firebasestorage.googleapis.com/v0/b/login-app-3bb2f.appspot.com/o/%E0%AC%9A%E0%AC%89%E0%AC%A0%E0%AC%BF%20%E0%AC%B0%E0%AC%BE%E0%AC%A4%E0%AC%BF%20--%20new%20odia%20comedy%20video%20--%20odia%20talking%20Tom%20video%20--%20Hasi%20hasi%20gadi%20jebe%20--%20odia%20jokes--.mp4?alt=media&token=4f74b5f7-5cfd-4338-936f-7b518bb9bc55");
videoView.setVideoURI(videoUrl);
MediaController mediaController = new MediaController(getActivity());
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
return v;
}
}
我的视频没有流式传输并且显示无法播放视频文件
调用此方法播放视频-
videoView.start();
如下所示-
videoView = v.findViewById(R.id.vviewVideo);
videoUrl = Uri.parse("https://firebasestorage.googleapis.com/v0/b/login-app-3bb2f.appspot.com/o/%E0%AC%9A%E0%AC%89%E0%AC%A0%E0%AC%BF%20%E0%AC%B0%E0%AC%BE%E0%AC%A4%E0%AC%BF%20--%20new%20odia%20comedy%20video%20--%20odia%20talking%20Tom%20video%20--%20Hasi%20hasi%20gadi%20jebe%20--%20odia%20jokes--.mp4?alt=media&token=4f74b5f7-5cfd-4338-936f-7b518bb9bc55");
videoView.setVideoURI(videoUrl);
videoView.start();
public class MessageFragent extends Fragment {
private VideoView videoView;
private Uri videoUrl;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_message,container, false);
videoView = v.findViewById(R.id.vviewVideo);
videoUrl = Uri.parse("https://firebasestorage.googleapis.com/v0/b/login-app-3bb2f.appspot.com/o/%E0%AC%9A%E0%AC%89%E0%AC%A0%E0%AC%BF%20%E0%AC%B0%E0%AC%BE%E0%AC%A4%E0%AC%BF%20--%20new%20odia%20comedy%20video%20--%20odia%20talking%20Tom%20video%20--%20Hasi%20hasi%20gadi%20jebe%20--%20odia%20jokes--.mp4?alt=media&token=4f74b5f7-5cfd-4338-936f-7b518bb9bc55");
videoView.setVideoURI(videoUrl);
MediaController mediaController = new MediaController(getActivity());
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
return v;
}
}
我的视频没有流式传输并且显示无法播放视频文件
调用此方法播放视频-
videoView.start();
如下所示-
videoView = v.findViewById(R.id.vviewVideo);
videoUrl = Uri.parse("https://firebasestorage.googleapis.com/v0/b/login-app-3bb2f.appspot.com/o/%E0%AC%9A%E0%AC%89%E0%AC%A0%E0%AC%BF%20%E0%AC%B0%E0%AC%BE%E0%AC%A4%E0%AC%BF%20--%20new%20odia%20comedy%20video%20--%20odia%20talking%20Tom%20video%20--%20Hasi%20hasi%20gadi%20jebe%20--%20odia%20jokes--.mp4?alt=media&token=4f74b5f7-5cfd-4338-936f-7b518bb9bc55");
videoView.setVideoURI(videoUrl);
videoView.start();