google / flutter.plugins

BSD 3-Clause "New" or "Revised" License
117 stars 55 forks source link

Looping audio doesn't work #82

Open michaelspeedcode opened 4 years ago

michaelspeedcode commented 4 years ago
 _audio2 = Audio.loadFromRemoteUrl(url,
        playInBackground: true,
        looping: true, // <<<<<<<<<<< here!
        onPosition: _backgroundOnPosition,
        onComplete: _backgroundOnComplete,
        onError: (error) => onError(error))
      ..play();

//....

  void _backgroundOnComplete() {
    print('complete!');
  }

  void _backgroundOnPosition(double position) {
    print(position);
  }

  void onError(var error) {
    print(error.toString());
  }

Setting looping to true doesn't make the audio loop.

The above code prints this output:

flutter: 0.0
flutter: 0.250060887
flutter: 0.500675319
flutter: 0.751075692
flutter: 1.001015662
flutter: 1.250292806
flutter: 1.500241974
........
flutter: 9.7511342
flutter: 10.000516212
flutter: 10.250713764
flutter: complete!
monkeyswarm commented 4 years ago

What device and operating system version?

monkeyswarm commented 4 years ago

And what is the remote URL?

michaelspeedcode commented 4 years ago

Sorry, that was half a bug report!

iOS 13.3 iPhone 11 https://medito.app/media/pages/service/backgroundmusic/356537342-1595184663/file_example_mp3_700kb.mp3