javascript - Detect Mobile Device - YouTube JS API -


using standard js api youtube have implemented video make auto-play on desktop (hiding controls) , show custom controls.

on mobile cannot auto-play , wish show standard youtube video controls (and other bits).

what's best method detect devices don't support non-fullscreen non-auto-play video embeds?

i'd avoid device width solutions , regex user-agent sniffing isn't great solution.

cheers

i needed detect android browsers in application i'd built. don't know how detect devices, can try same idea.

to fix problem, used:

var ua = navigator.useragent.tolowercase(); var isandroid = ua.indexof("android") > -1; //&& ua.indexof("mobile"); if(isandroid) {     // something!     // redirect android-site?     window.location = 'http://android.davidwalsh.name'; } 

hope help.


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -