Skip to content

Commit

Permalink
update readme banner and Imp. static routes, and player
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Mar 11, 2024
1 parent 2d305c7 commit 1fa613c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![BloomeeTunes](./assets/icons/Bloomee_Logo_cover.png)
![BloomeeTunes](./assets/icons/new_bloomee_bamnner.png)
# **Bloomee Music 🌸🎶**

Bloomee is my experimental Flutter project, a music app to learn Flutter for My future projects and designed to bring you ad-free tunes from various sources. Dive into a world of limitless music from platforms like YouTube and Jio Saavn, with more sources blooming soon! 🌼🎵
Expand Down
Binary file added assets/icons/new_bloomee_bamnner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions lib/blocs/mediaPlayer/bloomee_player_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class BloomeePlayerCubit extends Cubit<BloomeePlayerState> {
@override
Future<void> close() {
EasyDebounce.cancelAll();
bloomeePlayer.audioPlayer.dispose();
bloomeePlayer.currentQueueName.close();
bloomeePlayer.stop();
bloomeePlayer.currentQueueName.close();
bloomeePlayer.audioPlayer.dispose();
return super.close();
}
}
29 changes: 26 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import 'package:Bloomee/model/MediaPlaylistModel.dart';
import 'package:Bloomee/model/songModel.dart';
import 'package:Bloomee/model/youtube_vid_model.dart';
import 'package:Bloomee/repository/Youtube/youtube_api.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/screens/widgets/snackbar.dart';
import 'package:Bloomee/services/bloomeePlayer.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:Bloomee/blocs/add_to_playlist/cubit/add_to_playlist_cubit.dart';
Expand Down Expand Up @@ -58,14 +60,17 @@ void ProcessIncomingIntent(List<SharedMediaFile> _sharedFiles) {
if (value != null) {
YouTubeServices()
.formatVideo(video: value, quality: "High")
.then((value) {
.then((value) async {
if (value != null) {
MediaItemModel _mIM = fromYtVidSongMap2MediaItem(value);
MediaPlaylist _tempPlaylist = MediaPlaylist(
albumName: "Shared Playlist",
mediaItems: [_mIM],
);
log(_mIM.title, name: "Shared Files");
await bloomeePlayerCubit.bloomeePlayer
.loadPlaylist(_tempPlaylist, doPlay: true);
GlobalRoutes.globalRouter.pushNamed(GlobalStrConsts.playerScreen);
}
});
}
Expand All @@ -74,13 +79,21 @@ void ProcessIncomingIntent(List<SharedMediaFile> _sharedFiles) {
}
}

late BloomeePlayerCubit bloomeePlayerCubit;
void setupPlayerCubit() {
bloomeePlayerCubit = BloomeePlayerCubit();
}

void main() {
WidgetsFlutterBinding.ensureInitialized();

try {
dotenv.load(fileName: "assets/.env");
} on Exception catch (e) {
log("error $e");
dotenv.load(mergeWith: io.Platform.environment);
}
setupPlayerCubit();
runApp(const MyApp());
}

Expand All @@ -107,6 +120,7 @@ class _MyAppState extends State<MyApp> {
log(_sharedFiles[0].mimeType.toString(), name: "Shared Files");
log(_sharedFiles[0].path, name: "Shared Files");
ProcessIncomingIntent(_sharedFiles);

// Tell the library that we are done processing the intent.
ReceiveSharingIntent.reset();
});
Expand All @@ -118,15 +132,24 @@ class _MyAppState extends State<MyApp> {
log(_sharedFiles[0].mimeType.toString(), name: "Shared Files Offline");
log(_sharedFiles[0].path, name: "Shared Files Offline");
ProcessIncomingIntent(_sharedFiles);
ReceiveSharingIntent.reset();
});
}

@override
void dispose() {
_intentSub.cancel();
bloomeePlayerCubit.bloomeePlayer.audioPlayer.dispose();
bloomeePlayerCubit.close();
super.dispose();
}

@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => BloomeePlayerCubit(),
create: (context) => bloomeePlayerCubit,
lazy: false,
),
BlocProvider(
Expand Down Expand Up @@ -169,7 +192,7 @@ class _MyAppState extends State<MyApp> {
} else {
return MaterialApp.router(
scaffoldMessengerKey: SnackbarService.messengerKey,
routerConfig: GlobalRoutes().globalRouter,
routerConfig: GlobalRoutes.globalRouter,
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion lib/routes_and_consts/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:Bloomee/screens/widgets/global_navbar.dart';
class GlobalRoutes {
static final globalRouterKey = GlobalKey<NavigatorState>();

final globalRouter = GoRouter(
static final globalRouter = GoRouter(
initialLocation: '/${GlobalStrConsts.exploreScreen}',
navigatorKey: globalRouterKey,
routes: [
Expand Down
1 change: 0 additions & 1 deletion lib/screens/widgets/mini_player_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ class MiniPlayerWidget extends StatelessWidget {
onPressed: () => context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.audioPlayer
.stop(),
icon: const Icon(
Icons.close_rounded,
Expand Down
3 changes: 2 additions & 1 deletion lib/services/bloomeePlayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class BloomeeMusicPlayer extends BaseAudioHandler
@override
Future<void> stop() async {
// log("Called Stop!!");
// audioPlayer.stop();
audioPlayer.stop();
super.stop();
}

Expand All @@ -177,6 +177,7 @@ class BloomeeMusicPlayer extends BaseAudioHandler

@override
Future<void> onNotificationDeleted() {
audioPlayer.dispose();
audioPlayer.stop();
super.stop();

Expand Down

0 comments on commit 1fa613c

Please sign in to comment.