Jetzt abonnieren
Photograph: Julian Chokkattu
,推荐阅读WPS官方版本下载获取更多信息
* Code should be simple and clean, never over-complicate things.
HTMLMediaElement.prototype is the browser’s own internal prototype for all and elements and by redefining the property descriptor for src and srcObject on this prototype, I ensured that regardless of where the audio element lives (whether it’s in the main document, inside an iframe’s shadow, or buried inside a web component) the moment any source is assigned to it, the hook fires. The element cannot receive audio without announcing itself.