Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Issue with Playing Foreground with playlist and specific index #31

Closed
wisecoders opened this issue Mar 6, 2020 · 4 comments
Closed
Labels
Bug Something isn't working Help wanted Extra attention is needed

Comments

@wisecoders
Copy link

wisecoders commented Mar 6, 2020

@danielR2001

I am trying to play, play list. I am trying to store the last played audio and position and trying to seek with the following :

      final Result result = await _audioPlayer.playAll(
        urls,
        index: index,
        position: duration,
        repeatMode: false,
        respectAudioFocus: true,
        playerMode: PlayerMode.BACKGROUND,
        audioNotifications: audioNotifications,
      );

it works on the debug mode. but on release mode(apk), it fails with the following error. Please let me know how to fix this issue. any insight will be very helpful.

17336
    Reason: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{ad023f4 u0 com.xyz.pyx/danielr2001.audioplayer.audioplayers.ForegroundAudioPlayer}
    Load: 1.82 / 1.82 / 2.19
    CPU usage from 0ms to 6715ms later (2020-03-04 19:25:40.086 to 2020-03-04 19:25:46.801) with 99% awake:

@danielR2001
Copy link
Owner

I made an update of the starting position, it wasn't even implemented (i forgot about it). :D
but the release crash is happening to me too, but it happens with all the players even if not using the start position. That's is very strange.

@danielR2001 danielR2001 added Bug Something isn't working Help wanted Extra attention is needed labels Mar 14, 2020
@wisecoders
Copy link
Author

I am working around the issue by letting the first audio play for a second and skipping to the index where I want as of now :-) I know it is ugly. but I am kinda in rush to fix the defect and move on. When I get sometime, I will definitely try to contribute this project. Appreciate your support..

@manash-consultancy
Copy link

First of all, the library is great @danielR2001 . Many thanks.

In the production version of our app which is being used by thousands of users, two main crash clusters (related to this library) were observed - (1) Null pointer exceptions in ForegroundPlayer startcommand and (2) RemoteServiceExceptions like the one mentioned above.

(1) were resolved by simply checking for null values, wherever possible and appropriately returning sticky & non_sticky in the startcommand function

(2) was a bit more complicated. We ended up over-riding the onCreate function and calling startForeground() from onCreate as well.

Would love to contribute these changes to the library.

@MagnusJohansson
Copy link

@hrushi-m could you please create a pull request with theses changes, so others can benefit from theses improvements?
Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working Help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants