小程序video标签播放带有阿里防盗链的视频地址 报错 MEDIA_ELEMENT_ERROR:Format error
- 小程序开发者工具报
MEDIA_ELEMENT_ERROR:Format error
- 真机调试报错:
errMsg: "error code = -499897,
domain = kTTVideoErrorDomainOwnPlayer,
info = { TTPlayerErrorInfoKey = "<avio.c,ffurl_seek,490>AVERROR(ENOSYS)
<http.c,check_http_code,1036>AVERROR(EIO)
<http.c,process_line,1362>ret:-858797304
<http.c,http_read_header,1599>HTTP/1.1 403 Forbidden
<avio.c,ffurl_connect,240>err:-858797304
<utils.c,init_input,420>ret:-858797304
<utils.c,avformat_open_input,562>ret:-858797304
ffmpeg format error.code:-858797304,message:Server returned 403 Forbidden (access denied) open input file. fail:-1";
isDirectURL = 1;
},
src = https://static.dffengguang.com.cn/back-end/carvideo/20220624104613.mp4
--- vid = ,api_version = ,fetcher = --- video_model =
- 判断应该是防盗链问题,解决如下:
-
登录阿里云OSS管理后台配置OSS Referer白名单:
WeChat72211bfe8a0978540100ffa3c687dcc3.png
-
在阿里云cdn配置 Referer白名单:
WeChat25b2a2aa2a53ea5bc3ea221a5850d929.png
3.配置的字节小程序域名:
https://microapp.bytedance.com/
https://tmaservice.developer.toutiao.com/
- 注:当时只设置了阿里OSS的Refer白名单 无效 ,最后添加了cdn的Referer白名单就能播放了。
网友评论