sampotts / plyr

A simple HTML5, YouTube and Vimeo player
https://plyr.io
MIT License
26.56k stars 2.93k forks source link

migrateStyles giving out JS error if this.media.styles contains length = 0 #1915

Open syedhusain-appspace opened 4 years ago

syedhusain-appspace commented 4 years ago

When using the library in LG WebOS3.0 TVs, migrateStyles will throw a JS error (undefined is not a function) due to this.media.styles contains a property length=0 (or any numbers - as per screenshot).

Suggest to modify the filter function to also check if key is a string or not before running key.startsWith('--plyr')

image

(first time submitting bug in GitHub, do let me know if I'm not following any guidelines)

syedhusain-appspace commented 4 years ago

If anyone needs a workaround for this, in your main application, create a 'polyfill' for startsWith for Number Number.prototype.startsWith = function() { return false; }

sampotts commented 3 years ago

Thanks for this and apologies for the massive delay getting the fix out. It's in v3.6.3 👍

Quraian commented 3 years ago

Is this released already? it's not on npm!

Thanks

sampotts commented 3 years ago

Apologies, I'll get it on npm shortly.

sampotts commented 3 years ago

Done!

Quraian commented 3 years ago

Apologies, I'll get it on npm shortly.

Thanks a lot, Sam!