Replit audio has a breakdown when used by others

Problem description:
Replit audio has a meltdown when the owner isn’t using it

Expected behavior:
Replit audio to work

Actual behavior:
It has a complete mental breakdown if im not using it

Steps to reproduce:
Paste the following code into your own replit and try it on your testing account…

Code:

  • make sure you have a file named “notif.mp3”
from replit import audio
from time import sleep
audio.play_file("notif.mp3")
sleep(0.5)

Browser/OS/Device:
Firefox/Chrome / Windows 11 / PC

btw, error is:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    audio.play_file("notif.mp3")
  File "/home/runner/BdqRSvINGyE/venv/lib/python3.10/site-packages/replit/audio/__init__.py", line 294, in play_file
    return self.__get_new_source(name, does_loop)
  File "/home/runner/BdqRSvINGyE/venv/lib/python3.10/site-packages/replit/audio/__init__.py", line 230, in __get_new_source
    sources = AudioStatus(self.read_status())["Sources"]
  File "/home/runner/BdqRSvINGyE/venv/lib/python3.10/site-packages/replit/audio/__init__.py", line 382, in read_status
    with open("/tmp/audioStatus.json", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/audioStatus.json'

Replit audio is known to not work very well, and when it does work it only works in your dev environment. So I don’t think it would work on the cover page.

1 Like

Hey @jpg!

Can you please send me the link to the Repl that you’re having issues with so I can take a look?

Hi, this is for every repl; copy & paste the code and the same error should occur while playing on a test account

1 Like

I wasn’t able to reproduce this issue. I created a new Repl and added an mp3 file. I then ran the Repl, it asked me for permission to play the audio, and it worked fine.

Here’s the Repl I used: https://replit.com/@ShaneAtReplit/repl-audio-test

their problem is that replit audio doesn’t work when you use it from the spotlight page without an account with write access to the repl

Read @UMARismyname 's post

I’m sorry, I did not notice that you were reporting that it didn’t work for spotlight pages. This is due to a technical limitation which we noted here: https://docs.replit.com/tutorials/replit/playing-audio-replit#known-limitations

2 Likes

if enabled through secrets (as opposed to through the .replit file)

They have audio=true in the .replit file

Interesting, I was not aware of this. I have let the team know that this is an issue and will follow up once I have an update!

1 Like

Hey Shane, it has been a month (well, almost). Do you have any progress?

After enabling audio with audio=true in your Repl, open the VNC output window and enable the checkbox in the lower-right corner.