Hello Developers,
I am getting issue while playing audio files in production mode.
I have one CPU where I am using ubuntu and I do frappe production mode setup on it.
I am using python playsound library, and I am not able to play that audio file , no audio response getting.
please help me
hear is the respective code which I am using
@frappe.whitelist()
def play_audio(audio_profile):
print(“Playing Audio File:–>”,audio_profile)
import os
import tempfile
from playsound import playsound
if not audio_profile:
frappe.throw("Please check the code you have entered...")
if frappe.get_value("Audio File Details",{"audio_profile":audio_profile},["is_enabled"]):
audio = frappe.get_value("Audio File Details",{"audio_profile":audio_profile},["audio_file"])
if audio:
attachment = frappe.get_cached_doc("File",{"file_url":audio})
temp_file_path = os.path.join(tempfile.gettempdir(),attachment.file_name)
print("temp audio path:---->",temp_file_path)
with open(temp_file_path, "wb") as temp_file:
temp_file.write(attachment.get_content())
playsound(temp_file_path)
if os.path.exists(temp_file_path):
os.remove(temp_file_path)