You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On line 79: https://github.com/tech-marketing/video-srcset/blob/fea484de46d8a50efc60178dfeed9010a8cbd027/src/video-srcset.js#L79
There is the comparison to test if it should update the src or not. If you use relative URLs like in the main example (e.g. <video srcset="videos/mobile-video.mp4 768w, videos/tablet-video.mp4 1200w, videos/desktop-video.mp4 1920w"></video>) this comparison does not ever equate to true, because selectedSource will be the relative URL, but element.src will be the full URL including http://.
Thanks for this great code!
On line 79:
https://github.com/tech-marketing/video-srcset/blob/fea484de46d8a50efc60178dfeed9010a8cbd027/src/video-srcset.js#L79
There is the comparison to test if it should update the src or not. If you use relative URLs like in the main example (e.g.
<video srcset="videos/mobile-video.mp4 768w, videos/tablet-video.mp4 1200w, videos/desktop-video.mp4 1920w"></video>
) this comparison does not ever equate to true, because selectedSource will be the relative URL, but element.src will be the full URL including http://.I fixed this by changing line 79 to:
if(element.src.slice(-selectedSource.length) !== selectedSource) {
Maybe there's a better way?
The text was updated successfully, but these errors were encountered: