I want to detect if a mobile phone/tablet can play HTTP Live Streaming (m3u8).
I'm currently testing with this script:
function isHLSEnabled() {
var videoElement = document.createElement('video'),
canPlayAppMpeg = videoElement.canPlayType('application/x-mpegURL'),
canPlayAppleMpeg = videoElement.canPlayType('vnd.apple.mpegURL');
return (
(canPlayAppMpeg == 'probably' || canPlayAppMpeg == 'maybe')
|| (canPlayAppleMpeg == 'probably' || canPlayAppleMpeg == 'maybe')
);
}
But it doesn't work well on some Samsung browsers (stock, dolphin, etc) - it returns false (because the canPlayTypes are empty strings) however it is able to play the video.
Are there any bulletproof(ish) solutions for detecting this kind of streaming support?