簡體   English   中英

Whatsapp 共享音頻失敗 - “請重試”

[英]Whatsapp sharing audio fails - “please try again”

我已經使用這個代碼幾年了,它工作得很好:

final Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    sharingIntent.setType("audio/mpeg");
    sharingIntent.putExtra(Intent.EXTRA_STREAM,
        SoundProvider.getUriForSound(getContext(), sound));

    getActivity()
        .startActivity(Intent.createChooser(sharingIntent,
            getContext().getString(R.string.share)));

我的SoundProvider生成一個以content://開頭的 URI,該 URI 由FileProvider (實際上是相同的SoundProvider )拾取。 此提供程序從我的raw文件夾中讀取音頻文件。

這些聲音可以直接在 WhatsApp(而不是通用文件)中播放,並以 ID3 標簽中的正確標題顯示。

這已經完美無缺,並且仍然適用於 Telegram/Dropbox 等,但直到幾個月前最近的 WhatsApp 更新它失敗並顯示“共享失敗,請重試”消息。

是否有人知道 WhatsApp 所做的任何更改並遇到過類似的情況?

嘗試這個:

Uri uri = Uri.parse(audioPath);
Intent shareIntent = new Intent();
shareIntent.setType("audio/*");
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);

我不得不通過將聲音復制到external-files-dir來解決這個問題。

我不知道為什么 whatsapp 突然不再接受FileProvider提供的raw目錄中的文件,而其他應用程序仍然沒有任何問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM