florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
740 stars 337 forks source link

Next and Previous audios takes time to play #449

Closed ManojDvs closed 3 years ago

ManojDvs commented 3 years ago

I am using the latest version of the plugin and when i call next or previous methods , it is taking long time to start next and previous audios .

kalismeras61 commented 3 years ago

It depends on your network speed and also file size..

ZhangZhiH commented 3 years ago

It depends on your network speed and also file size..

I have the same problem Same file size and same network speed The Android environment is much faster than the iOS environment

kalismeras61 commented 3 years ago

It depends on your network speed and also file size..

I have the same problem Same file size and same network speed The Android environment is much faster than the iOS environment

Which version are you using ?

ZhangZhiH commented 3 years ago

It depends on your network speed and also file size..

I have the same problem Same file size and same network speed The Android environment is much faster than the iOS environment

Which version are you using ?

Hello, the version number I used is 2.0.13+1 File size should be around 12MB The Android environment has no lag IOS latency is 5 seconds This is my version of Flutter Flutter 1.22.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 7891006299 (7 weeks ago) • 2020-12-10 11:54:40 -0800 Engine • revision ae90085a84 Tools • Dart 2.10.4

I also found a problem I played my audio in the official demo without that much delay The same 12MB audio switch in iOS environment without delay This delay is only in my project What causes this

Then I thought it was because my project was too big Finally I created a new project There was indeed a delay

image

Mayb3Nots commented 3 years ago

hi @kalismeras61 can you look at this issue for me? https://github.com/florent37/Flutter-AssetsAudioPlayer/issues/447 also 12Mb is kinda huge I can get why it might take some time

kalismeras61 commented 3 years ago

@ZhangZhiH i merged some PR's but for some reason, it is not in pub.dev. Can you import plugin in your project like below and let me know.

assets_audio_player: git: url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git ref: ac9f356b9be5eeb6972947224f2e9245ba40e3bf

kalismeras61 commented 3 years ago

@Mayb3Nots can you try also samething.

Mayb3Nots commented 3 years ago

@kalismeras61 when I used it in my pubspec it gave server unavailable errors and this stdout: stderr: fatal: ambiguous argument 'ac9f356': unknown revision or path not in the working tree. I think you meant to use the main branch URL? even after that I get a version incompatibility with the web version Because every version of assets_audio_player from git depends on assets_audio_player_web ^2.0.13+2 which doesn't match any versions, assets_audio_player from git is forbidden.

kalismeras61 commented 3 years ago

@kalismeras61 when I used it in my pubspec it gave server unavailable errors and this stdout: stderr: fatal: ambiguous argument 'ac9f356': unknown revision or path not in the working tree. I think you meant to use the main branch URL? even after that I get a version incompatibility with the web version Because every version of assets_audio_player from git depends on assets_audio_player_web ^2.0.13+2 which doesn't match any versions, assets_audio_player from git is forbidden.

The last commit used is id. Github is shortened automatically, you have to use it all.

ac9f356b9be5eeb6972947224f2e9245ba40e3bf

kalismeras61 commented 3 years ago

Sorry, it was my mistake, please try below.

assets_audio_player:
git:
url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git
ref: 5eb1cc3d9dace229c0510c327ed01db2c0619672
Mayb3Nots commented 3 years ago

@kalismeras61 Still doesn't work Because every version of assets_audio_player from git depends on assets_audio_player_web ^2.0.13+2 which doesn't match any versions, assets_audio_player from git is forbidden. I think you have to update the version in the web version?

kalismeras61 commented 3 years ago

I did, and changed ref. Please be sure commit id is "5eb1cc3d9dace229c0510c327ed01db2c0619672"

kalismeras61 commented 3 years ago

when try to add new version. Please remove pubspec.lock file and try "flutter clean" and run "flutter pub get. "

Mayb3Nots commented 3 years ago

Still no hope after doing the above.. image

kalismeras61 commented 3 years ago

Still no hope after doing the above.. image

Okay found the problem. Please use this commit 6aee5ada6d751aa1edc5073515daea29bb1f47d4 this should be work

Mayb3Nots commented 3 years ago

Still no hope after doing the above.. image

Okay found the problem. Please use this commit 6aee5ada6d751aa1edc5073515daea29bb1f47d4 this should be work

This times it says Because every version of assets_audio_player from git depends on assets_audio_player_web ^2.0.13+3 which doesn't match any versions, assets_audio_player from git is forbidden. So, because fressic depends on assets_audio_player from git, version solving failed.

kalismeras61 commented 3 years ago

Are you using web ? if not please fork this repository and un comment assets_audio_player_web from pubspec.yaml in your repository. and use your repository link and commit.

Mayb3Nots commented 3 years ago

@kalismeras61 not using web and i forked it and removed comment still doesn't work. And also I think the author has to publish for it to update in pub.dev

EDIT: saw ur lastest commit and it seems to work now, testing now if the notification issue has been fixed.

kalismeras61 commented 3 years ago

@kalismeras61 not using web and i forked it and removed comment still doesn't work. And also I think the author has to publish for it to update in pub.dev

Yeah he should do it. But he is not available. Sorry time is so late for me i think found the problem now :)))

can you try with this commit ? 8ec5fef024fa56049f93db41e5db31ebc4a39ab5

Mayb3Nots commented 3 years ago

@kalismeras61 just tested the latest version and the notification still cant be swiped when the music player is paused. :( Still wanna thank your time for trying to help the community

kalismeras61 commented 3 years ago

@kalismeras61 just tested the latest version and the notification still cant be swiped when the music player is paused. :( Still wanna thank your time for trying to help the community

In my case it is swiple, can you share your code ? how you are opening player ? ( open method)

Mayb3Nots commented 3 years ago

@kalismeras61 just tested the latest version and the notification still cant be swiped when the music player is paused. :( Still wanna thank your time for trying to help the community

In my case it is swiple, can you share your code ? how you are opening player ? ( open method)

Can I see how you do it then? Cause the only way for me to remove the notification is by pressing the stop button. Even then I don't want to stop it because it will remove my song and when user goes back to the music app it shows audio = null. I just wanna pause it when swiped like google's music app.

this is my code

try {
  await player
      .open(audio.value,
          showNotification: true,
          headPhoneStrategy: HeadPhoneStrategy.pauseOnUnplugPlayOnPlug)
      .then((value) => result = true);
  miniPlayer.setShowMiniPlayer;
} catch (t) {
  result = false;
  print(t);
}
return result;
ZhangZhiH commented 3 years ago

@ZhangZhiH i merged some PR's but for some reason, it is not in pub.dev. Can you import plugin in your project like below and let me know.

assets_audio_player: git: url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git ref: ac9f356

@kalismeras61 @ManojDvs Thank you very much for your help in your busy schedule This has solved my problem There is currently no lag on iOS This is my solution `
assets_audio_player:

git:

 url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git

 ref: 8ec5fef024fa56049f93db41e5db31ebc4a39ab5

`

kalismeras61 commented 3 years ago

@ManojDvs, Please use plugin like below.

assets_audio_player: git: url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git ref: 8ec5fef024fa56049f93db41e5db31ebc4a39ab5