Skip to content

Commit

Permalink
added loading effect on play button
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Feb 2, 2024
1 parent 827ee15 commit 29a6c68
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ jobs:
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/bloomee_tunes_v1.1.3+${{github.run_number}}.apk"
tag: v1.1.3+${{github.run_number}}
tag: v1.2.2+${{github.run_number}}
token: ${{secrets.SECRET_KEY}}
56 changes: 45 additions & 11 deletions lib/screens/screen/audioPlayer_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class _AudioPlayerViewState extends State<AudioPlayerView> {
InkWell(
onTap: () => musicPlayer.rewind(),
child: const Icon(
FluentIcons.arrow_repeat_1_24_filled,
FluentIcons.replay_20_regular,
color: Default_Theme.primaryColor1,
size: 35,
),
Expand All @@ -273,19 +273,53 @@ class _AudioPlayerViewState extends State<AudioPlayerView> {
size: 35,
),
),
StreamBuilder<PlayerState>(
StreamBuilder(
stream: context
.watch<BloomeePlayerCubit>()
.bloomeePlayer
.audioPlayer
.playerStateStream,
builder: (context, snapshot) {
return PlayPauseButton(
size: 75,
onPause: () => musicPlayer.pause(),
onPlay: () => musicPlayer.play(),
isPlaying: snapshot.data?.playing ?? false,
);
.isLinkProcessing,
builder: (context, snapshot2) {
return snapshot2.hasData &&
snapshot2.data == true
? Container(
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color:
Default_Theme.accentColor2,
spreadRadius: 1,
blurRadius: 20)
],
shape: BoxShape.circle,
color: Default_Theme.accentColor2,
),
width: 75,
height: 75,
child: const Center(
child: SizedBox(
width: 35,
height: 35,
child: CircularProgressIndicator(
color:
Default_Theme.primaryColor1,
),
),
))
: StreamBuilder<PlayerState>(
stream: context
.watch<BloomeePlayerCubit>()
.bloomeePlayer
.audioPlayer
.playerStateStream,
builder: (context, snapshot) {
return PlayPauseButton(
size: 75,
onPause: () => musicPlayer.pause(),
onPlay: () => musicPlayer.play(),
isPlaying:
snapshot.data?.playing ?? false,
);
});
}),
InkWell(
onTap: () => musicPlayer.skipToNext(),
Expand Down
5 changes: 5 additions & 0 deletions lib/services/bloomeePlayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class BloomeeMusicPlayer extends BaseAudioHandler
List<MediaItemModel> currentPlaylist = [];
BehaviorSubject<String> currentQueueName =
BehaviorSubject<String>.seeded("Empty");

BehaviorSubject<bool> isLinkProcessing = BehaviorSubject<bool>.seeded(false);
int currentPlayingIdx = 0;
bool isPaused = false;

Expand Down Expand Up @@ -100,6 +102,8 @@ class BloomeeMusicPlayer extends BaseAudioHandler
if (mediaItem.extras?["source"] == "youtube") {
audioPlayer.seek(Duration.zero);
audioPlayer.stop();
isLinkProcessing.add(true);

final tempStrmVideo = await YouTubeServices()
.getVideoFromId(mediaItem.id.replaceAll("youtube", ''));
if (tempStrmVideo != null) {
Expand All @@ -114,6 +118,7 @@ class BloomeeMusicPlayer extends BaseAudioHandler

getLinkOperation.then((tempStrmLinks) {
audioPlayer.setUrl(tempStrmLinks.first).then((value) {
isLinkProcessing.add(false);
if (super.mediaItem.value?.id == mediaItem.id && !isPaused) {
audioPlayer.play();
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.2.1+0
version: 1.2.2+0

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down

0 comments on commit 29a6c68

Please sign in to comment.