blackmann / story_view

Story view for apps with stories.
BSD 3-Clause "New" or "Revised" License
417 stars 340 forks source link

"Media failed to load." appear for no reason #103

Open tised opened 3 years ago

tised commented 3 years ago

When switching between cached videos already(tap on left-right edge), label "Media failed to load." appear for a split second

blackmann commented 3 years ago

Hello @tised do you experience this with your app or with the demo project?

devashishpuri commented 3 years ago

It happens when widget.videoLoader.state = LoadState.success but controller is not initialized. For LoadState.loading it shows Loader, but in other cases, it shows the message.

JosephChuang129 commented 3 years ago

Hello @blackmann "Media failed to load." text show in the demo project. Do you have any suggestions?, thanks

christxph commented 3 years ago

This is happening in case the video loader state is in state LoadState.success and playerController!.value.isInitialized still equals false.

A quick and dirty workaround is to change line 117 in story_video.dart (https://github.com/blackmann/story_view/blob/master/lib/widgets/story_video.dart#L117)

from: return widget.videoLoader.state == LoadState.loading

to: return widget.videoLoader.state == LoadState.loading || widget.videoLoader.state == LoadState.success

This will result in the loading spinner being shown for a split second instead of the error text. Note that that's not a proper fix.

bartonip commented 3 years ago

I've made PR #121 that replicates Instagram's story switching which is just a brief black screen when the following video is loaded to allow for minimally invasive cuts between continuous video.

AmitBhandari7777 commented 2 months ago

errorWidget: Container( color: Colors.black, width: MediaQuery.sizeOf(context).width, height: MediaQuery.sizeOf(context).height, ),

Adding this to StoryItem might be another alternative