Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown on try to play recorded audio clip #713

Closed
ghost opened this issue Oct 3, 2022 · 2 comments
Closed

Exception is thrown on try to play recorded audio clip #713

ghost opened this issue Oct 3, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 3, 2022

I record audio clip using start method of audio facade, then after few seconds I finish it with stop method. All required permissions are granted (for recording audio and accessing external storage) and I am stuck at this point - when I try to play recording with play method, kivy app immediately crashes. Here is the error which causes app to crash:
10-03 17:37:26.553 31608 32011 I python : Traceback (most recent call last): 10-03 17:37:26.553 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/app/main.py", line 40, in <module> 10-03 17:37:26.555 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/app.py", line 955, in run 10-03 17:37:26.557 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/base.py", line 574, in runTouchApp 10-03 17:37:26.558 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/base.py", line 339, in mainloop 10-03 17:37:26.560 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/base.py", line 383, in idle 10-03 17:37:26.560 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/base.py", line 334, in dispatch_input 10-03 17:37:26.561 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/base.py", line 302, in post_dispatch_input 10-03 17:37:26.562 31608 32011 I python : File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch 10-03 17:37:26.563 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/uix/behaviors/button.py", line 179, in on_touch_up 10-03 17:37:26.564 31608 32011 I python : File "kivy/_event.pyx", line 727, in kivy._event.EventDispatcher.dispatch 10-03 17:37:26.565 31608 32011 I python : File "kivy/_event.pyx", line 1307, in kivy._event.EventObservers.dispatch 10-03 17:37:26.566 31608 32011 I python : File "kivy/_event.pyx", line 1191, in kivy._event.EventObservers._dispatch 10-03 17:37:26.567 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/kivy/lang/builder.py", line 55, in custom_callback 10-03 17:37:26.568 31608 32011 I python : File "/data/data/bwilk315.sendroidexample.sendroidexample/files/app/main.kv", line 14, in <module> 10-03 17:37:26.569 31608 32011 I python : root.play_recording() 10-03 17:37:26.570 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/app/main.py", line 29, in play_recording 10-03 17:37:26.571 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/app/temp/audio.py", line 51, in play 10-03 17:37:26.572 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/plyer/facades/audio.py", line 79, in play 10-03 17:37:26.573 31608 32011 I python : File "/home/bartek/Desktop/Python/PyPI/sendroid/sendroid/example/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/sendroidexample/arm64-v8a/plyer/platforms/android/audio.py", line 53, in _play 10-03 17:37:26.574 31608 32011 I python : File "jnius/jnius_export_class.pxi", line 885, in jnius.jnius.JavaMethod.__call__ 10-03 17:37:26.576 31608 32011 I python : File "jnius/jnius_export_class.pxi", line 982, in jnius.jnius.JavaMethod.call_method 10-03 17:37:26.577 31608 32011 I python : File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception 10-03 17:37:26.578 31608 32011 I python : jnius.jnius.JavaException: JVM exception occurred: Prepare failed.: status=0x1 java.io.IOException

@ghost
Copy link
Author

ghost commented Oct 5, 2022

Okay I found the problem: it appears to be misunderstanding about audio states, when I record the audio and then finish it, state is "ready", when I check states carefuly for me audio will play only if state is not "recording". In simple words just make a few if statements to check for valid state and that fixed my problem.

@ghost ghost closed this as completed Oct 5, 2022
@JacobPL53
Copy link

okay

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant