Skip to content

Commit

Permalink
mini player bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Sep 28, 2024
1 parent d9a06f2 commit e47e9cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/blocs/mini_player/mini_player_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'dart:async';
import 'dart:developer';

import 'package:audio_service/audio_service.dart';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:Bloomee/blocs/mediaPlayer/bloomee_player_cubit.dart';
Expand Down Expand Up @@ -76,6 +74,7 @@ class MiniPlayerBloc extends Bloc<MiniPlayerEvent, MiniPlayerState> {

_playerStateSubscription =
playerCubit.bloomeePlayer.audioPlayer.playerStateStream.listen((event) {
log("${event.processingState}", name: "MiniPlayer");
switch (event.processingState) {
case ProcessingState.idle:
add(MiniPlayerInitialEvent());
Expand All @@ -97,6 +96,10 @@ class MiniPlayerBloc extends Bloc<MiniPlayerEvent, MiniPlayerState> {
if (event.playing) {
add(MiniPlayerPlayedEvent(
playerCubit.bloomeePlayer.currentMedia));
} else if (playerCubit.bloomeePlayer.isLinkProcessing.value ==
true) {
add(MiniPlayerProcessingEvent(
playerCubit.bloomeePlayer.currentMedia));
} else {
add(MiniPlayerPausedEvent(
playerCubit.bloomeePlayer.currentMedia));
Expand All @@ -109,11 +112,6 @@ class MiniPlayerBloc extends Bloc<MiniPlayerEvent, MiniPlayerState> {
playerCubit.bloomeePlayer.currentMedia));
} catch (e) {}
break;
case AudioProcessingState.error:
try {
add(MiniPlayerErrorEvent(playerCubit.bloomeePlayer.currentMedia));
} catch (e) {}
break;
}
});
}
Expand Down
1 change: 1 addition & 0 deletions lib/screens/widgets/mini_player_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class MiniPlayerWidget extends StatelessWidget {
),
MiniPlayerWorking() => MiniPlayerCard(
state: state,
isProcessing: state.isBuffering,
),
MiniPlayerError() => const SizedBox(),
MiniPlayerProcessing() => MiniPlayerCard(
Expand Down

0 comments on commit e47e9cf

Please sign in to comment.