mediaelement / mediaelement-plugins

Plugins for the main mediaelement project
405 stars 137 forks source link

Audio description also for external YouTube videos #200

Closed digitas-git closed 2 years ago

digitas-git commented 3 years ago

Hi, concerning the issue https://github.com/mediaelement/mediaelement-plugins/issues/199 this pull request should fix the problem using audio description in for external videos.

The EventListeners for playing, pausing, timeupdate etc. added to the player.node are working fine for "local" videos, but YouTube videos the player.media (that is the wrapper for the iframe tag and the video tag) needs these eventListeners. Changing t.node.addEventListener to t.media.addEventListener makes the plugin work also for YouTube videos. Also the timeupdate event and the volumechange event have been modified because t.node.currentTime or t.node.volume are unknown for YouTube videos.