How to detect HTML5 audio MP3 support?

You could either check the User-Agent and see what browser is being used or you could test support with Javascript. var a = document.createElement(‘audio’); return !!(a.canPlayType && a.canPlayType(‘audio/mpeg;’).replace(/no/, ”)); I got the above code from this page. return !!(a.canPlayType) is better because (some recent versions of)Firefox not supports mp3 and a.canPlayType(‘audio/mpeg;’) will be false

Detect if device is iOS

Detecting iOS With iOS 13 iPad both User agent and platform strings are changed and differentiating between iPad and MacOS seems possible, so all answers below needs to take that into account now. This might be the shortest alternative that also covers iOS 13: function iOS() { return [ ‘iPad Simulator’, ‘iPhone Simulator’, ‘iPod Simulator’, … Read more

tech