乐鑫技术交流
直播中

zhongnian

8年用户 1333经验值
擅长:MEMS/传感技术
私信 关注
[问答]

esp-adf esp_audio_play()播放https异常的原因?怎么处理?

esp_audio.h文件的接口说明是支持HTTP和HTTPs的,但是我测试只有HTTP能正常
有人遇到相同的问题吗?

esp_audio.h头文件接口说明如下:


  • /**
  • * @brief Play the given uri
  • *
  • * The esp_audio_play have follow activity, setup inputstream, outputstream and codec by uri, start all of them.
  • * There is a rule that esp_audio will select input stream, codec and output stream by URI field.

  • * Rule of URI field are as follow.
  • *     - `UF_SCHEMA` field of URI for choose input stream from existing streams. e.g:"http","file"
  • *     - `UF_PATH` field of URI for choose codec from existing codecs. e.g:"/audio/mp3_music.mp3"
  • *     - `UF_FRAGMENT` field of URI for choose output stream from existing streams, output stream is I2S by default.
  • *     - `UF_USERINFO` field of URI for specific sample rate and channels at encode mode.
  • *
  • *     The format "user:password" in the userinfo field, "user" is sample rate, "password" is channels.
  • *
  • * Now esp_audio_play support follow URIs.
  • *     - "https://dl.espressif.com/dl/audio/mp3_music.mp3"
  • *     - "http://media-ice.musicradio.com/ClassicFMMP3"
  • *     - "file://sdcard/test.mp3"
  • *     - "iis://16000:2@from.pcm/rec.wav#file"
  • *     - "iis://16000:1@record.pcm/record.wav#raw"
  • *
  • * @note
  • *     - The URI parse by `http_parser_parse_url`,any illegal string will be return `ESP_ERR_AUDIO_INVALID_URI`.
  • *     - If the esp_decoder codec is added to `handle`, then the `handle` of esp_decoder will be set as the default decoder,
  • *       even if other decoders are added.
  • *     - Enabled `CONFIG_FATFS_API_ENCODING_UTF_8`, the URI can be support Chinese characters.
  • *     - Asynchronous interface
  • *
  • * @param handle The esp_audio_handle_t instance
  • * @param uri    Such as "file://sdcard/test.wav" or "http://iot.espressif.com/file/example.mp3".
  • *               If NULL to be set, the uri setup by`esp_audio_setup` will used.
  • * @param type   Specific handle type decoder or encoder
  • * @param pos    Specific starting position by bytes
  • *
  • * @return
  • *      - ESP_ERR_AUDIO_NO_ERROR: on succss
  • *      - ESP_ERR_AUDIO_TIMEOUT: timeout the play activity
  • *      - ESP_ERR_AUDIO_NOT_SUPPORT: Currently status is AUDIO_STATUS_RUNNING
  • *      - ESP_ERR_AUDIO_INVALID_URI: URI is illegal
  • *      - ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
  • */
  • audio_err_t esp_audio_play(esp_audio_handle_t handle, audio_codec_type_t type, const char *uri, int pos);



更多回帖

×
20
完善资料,
赚取积分