1

I have some videos in AWS storage... I need to access the videos from a mobile app... I can access when there is internet connection. But if I switch to airplane mode the app is crashing. Is there a way to see the videos when you switch from online to offline mode.? Please let me know.

Thanks in advance.

1 Answer 1

0

you can use flutter_cache_manager

or use cached_video_player

A flutter plugin that has been forked from the official video_player package except that it supports caching.

  CachedVideoPlayerController controller;
  @override
  void initState() {
    controller = CachedVideoPlayerController.network(
        "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4");
    controller.initialize().then((_) {
      setState(() {});
      controller.play();
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: controller.value != null && controller.value.initialized
              ? AspectRatio(
                  child: CachedVideoPlayer(controller),
                  aspectRatio: controller.value.aspectRatio,
                )
              : Center(
                  child: CircularProgressIndicator(),
                )),
    );
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.