Skip to content

发送语音电脑端无法播放,手机端却可以 #758

Open
@tuxiaobei-scu

Description

电脑端:

5d5557c1550063f59e1672ee38caf9ee

点击无法播放

手机端却可以正常播放

使用 Base64 传输语音,部分代码:

def wav_to_amr(input_wav, output_amr):
    os.system(f"sox {input_wav} -r 8000 -c 1 {output_amr}")
    with open(output_amr, 'rb') as f:
        audio = f.read()
    audio_base64 = base64.b64encode(audio)
    audio_str = audio_base64.decode('utf-8')
    return audio_str

voice_base64 = wav_to_amr('a.wav', 'b.amr-nb')
# {'type': 'Voice', 'base64': voice_base64}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions