You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Able to play sound and no error throw in the init part.
Error should throw when the user use the setRate function in api < 23.
Steps to reproduce
Install to example app in android device api < 23
change mode to play instead of setSource
Press Asset 1 - laser.wav
See a crash
Logs
Unexpected error! java.lang.IllegalStateException: Changing the playback rate is only available for Android M/23+ or using LOW_LATENCY mode.
Full Logs
Unexpected error!
java.lang.IllegalStateException: Changing the playback rate is only available for Android M/23+ or using LOW_LATENCY mode.
at xyz.luan.audioplayers.player.MediaPlayerPlayer.setRate(MediaPlayerPlayer.kt:45)
at xyz.luan.audioplayers.player.WrappedPlayer.configAndPrepare(WrappedPlayer.kt:309)
at xyz.luan.audioplayers.player.WrappedPlayer.setSource(WrappedPlayer.kt:32)
at xyz.luan.audioplayers.AudioplayersPlugin.handler(AudioplayersPlugin.kt:91)
at xyz.luan.audioplayers.AudioplayersPlugin.access$handler(AudioplayersPlugin.kt:25)
at xyz.luan.audioplayers.AudioplayersPlugin$onAttachedToEngine$1$1.invoke(AudioplayersPlugin.kt:41)
at xyz.luan.audioplayers.AudioplayersPlugin$onAttachedToEngine$1$1.invoke(AudioplayersPlugin.kt:41)
at xyz.luan.audioplayers.AudioplayersPlugin$safeCall$1.invokeSuspend(AudioplayersPlugin.kt:62)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Unexpected error!, Changing the playback rate is only available for Android M/23+ or using LOW_LATENCY mode., java.lang.IllegalStateException: Changing the playback rate is only available for Android M/23+ or using LOW_LATENCY mode.
at xyz.luan.audioplayers.player.MediaPlayerPlayer.setRate(MediaPlayerPlayer.kt:45)
at xyz.luan.audioplayers.player.WrappedPlayer.configAndPrepare(WrappedPlayer.kt:309)
at xyz.luan.audioplayers.player.WrappedPlayer.setSource(WrappedPlayer.kt:32)
at xyz.luan.audioplayers.AudioplayersPlugin.handler(AudioplayersPlugin.kt:91)
at xyz.luan.audioplayers.AudioplayersPlugin.access$handler(AudioplayersPlugin.kt:25)
at xyz.luan.audioplayers.AudioplayersPlugin$onAttachedToEngine$1$1.invoke(AudioplayersPlugin.kt:41)
at xyz.luan.audioplayers.AudioplayersPlugin$onAttachedToEngine$1$1.invoke(AudioplayersPlugin.kt:41)
at xyz.luan.audioplayers.AudioplayersPlugin$safeCall$1.invokeSuspend(AudioplayersPlugin.kt:62)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
<asynchronous suspension>
#2 AudioPlayer.play (package:audioplayers/src/audioplayer.dart:123:5)
<asynchronous suspension>
#3 _SourcesTabState.setSource (package:audioplayers_example/tabs/sources.dart:46:7)
<asynchronous suspension>
Flutter doctor:
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.0.1 22A400 darwin-arm, locale en-HK)
• Flutter version 3.3.9 on channel stable at
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b8f7f1f986 (2 weeks ago), 2022-11-23 06:43:51 +0900
• Engine revision 8f2221fbef
• Dart version 2.18.5
• DevTools version 2.15.0
@aideric I think that setting Player to Low Latency mode will resolve this issue for you. It doesn't seem that the MediaPlayer supports variable playback rates.
Checklist
Current bug behaviour
Unable to set source and play with audioPlayer (PlayerMode mediaPlayer)
error throw on configAndPrepare in WrappedPlayer
audioplayers/packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/WrappedPlayer.kt
Lines 306 to 307 in 414d94d
Expected behaviour
Able to play sound and no error throw in the init part.
Error should throw when the user use the setRate function in api < 23.
Steps to reproduce
Logs
Full Logs
Flutter doctor:
Environment information
Platform 1:
debug
release
More information
we can change to configAndPrepare to
or check the sdk version in the Player.configAndPrepare before calling setRate
With the "try catch", I can play sound on android 5.1.1
The text was updated successfully, but these errors were encountered: