sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
701 stars 808 forks source link

[BUG] LiveBottomBar - InheritedYoutubePlayer - _LiveBottomBarState - slider.dart: Failed assertion - 'value >= min && value <= max': is not true. #666

Open Ashkan-Sarlak opened 2 years ago

Ashkan-Sarlak commented 2 years ago

Describe the bug When playing live Youtube stream, I can see the video, but plugin constantly throws this exception:

======== Exception caught by widgets library ======================================================= The following assertion was thrown building LiveBottomBar(dirty, dependencies: [InheritedYoutubePlayer], state: _LiveBottomBarState#1c04f): 'package:flutter/src/material/slider.dart': Failed assertion: line 147 pos 15: 'value >= min && value <= max': is not true.

To Reproduce This is the relevant YoutubePlayer parts of code:

YoutubePlayerController _controller = YoutubePlayerController( initialVideoId: YoutubePlayer.convertUrlToId(store.youtubeBroadcastLink!) ?? '', flags: const YoutubePlayerFlags( isLive: true, ), );

return ClipRRect( borderRadius: BorderRadius.circular(5), child: AspectRatio( aspectRatio: 345 / 180, child: YoutubePlayer(controller: _controller), ), );

Expected behavior Plugin should not throw this exception. It floods the log panel and I can't see any other of my app's logs.

Technical Details:

phatnguyen1006 commented 1 year ago

Did you find out how to fix this issue?

Ashkan-Sarlak commented 1 year ago

No I haven't, any thoughts @sarbagyastha ?

iballan commented 1 year ago

Hi @Ashkan-Sarlak ,

Settings isLive: false fixed the issue but the Slider is randomly going back and forth

I would like to ask a question related to this LiveBottomBar, do we need the seekbar (Slider) in live videos ? It looks like we don't need the slider and calculating its position when the video is live. just showing any placeholder container instead of the slider would fix this issue.

Ashkan-Sarlak commented 1 year ago

Hi @iballan, I can do without the slider for my particular use case, but other apps might need it. If setting isLive: false (though this does not make sense semantically; wouldn't this affect any other part of the functionality?) silences the logs, having an option to remove the slider is not a bad solution.

iballan commented 1 year ago

Just checked what youtube does with the slider when it is live video:

slider slider 2

I am not sure whether this what the author was trying to do there, anyway it is crashing now. As a workaround, setting isLive:false just worked fine for me.

If we are not able to do it like youtube, having fixed placeholder or disabled slider would fix the issue.

@sarbagyastha may help us here

AzaanForcebolt commented 1 year ago

Any update on this issue I’m only able to hear the sound of the Live video.