[英]How to call a function when loading of audio in react audio tag is failing
I am loading audio from a s3 bucket.我正在从 s3 存储桶加载音频。 Below is my audio tag.下面是我的音频标签。
<audio ref={audioRef} controls src={audioUrl} />
Sometimes audio tag is not able to load the audio from the audioUrl .有时音频标签无法从audioUrl加载音频。
I want to call a function.我想打电话给 function。 only when loading fails.仅在加载失败时。 Which even should I use?我应该使用哪个?
If you need any more information then please inform me如果您需要更多信息,请通知我
There are onError and onAbort Event in audio element.音频元素中有 onError 和 onAbort 事件。 Try it试试看
onemptied.一次清空。 onerror.错误。 onstalled.安装。 onsuspend.暂停。
Refer.. https://www.w3schools.com/jsref/event_onerror_media.asp参考.. https://www.w3schools.com/jsref/event_onerror_media.asp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.