Skip to content

Commit

Permalink
Merge pull request #389 from lamarios/fix/not_going_back_after_video_…
Browse files Browse the repository at this point in the history
…autoplay

fix issue when video autoplay is enabled, it would not browse back to…
  • Loading branch information
lamarios authored Nov 30, 2023
2 parents 3c4b99c + 674af8b commit 9dbe1ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 0 additions & 3 deletions lib/videos/states/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class VideoCubit extends Cubit<VideoState> {

getDownloadStatus();

if (settings.state.autoplayVideoOnLoad) {
playVideo(false);
}
} catch (err) {
var state = this.state.copyWith();
if (err is InvidiousServiceError) {
Expand Down
7 changes: 6 additions & 1 deletion lib/videos/views/screens/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ class VideoScreen extends StatelessWidget {
create: (BuildContext context) =>
VideoCubit(VideoState(videoId: videoId), downloadManager, player, settings)),
],
child: BlocBuilder<VideoCubit, VideoState>(
child: BlocConsumer<VideoCubit, VideoState>(
listenWhen: (previous, current) => settings.state.autoplayVideoOnLoad && previous.video != current.video,
listener: (context, state) {
AutoRouter.of(context).pop();
context.read<VideoCubit>().playVideo(false);
},
builder: (context, _) {
var cubit = context.read<VideoCubit>();
var settings = context.read<SettingsCubit>();
Expand Down

0 comments on commit 9dbe1ef

Please sign in to comment.