views:

36

answers:

2

If there's a better way I am all for it. But I wanna detect a smartphone user on my site.

Whether they be a webOS, Android, or iPhone OS phone. I have a flash video on my site, but when I detect a smartphone users I want it to be a HTML5 video on the site instead.

A: 

You could try using this js library: http://videojs.com/

Tereno
My bad should of mention we use JW Player and FlowPLayer, I just wanted to know a if else statement of some sort.If browsing on if {//show html5 video tag}else{//Do regularly stuff}
Minicade
Ah ok, well do you want specifically for smartphones or browsers that support HTML5? Videojs is open-source so you could theoretically look at how they are providing the fallback for Flash.For browsers that support HTML 5, look at: http://diveintohtml5.org/detect.htmlYou can detect for HTML 5 video playback support and then fall back to Flash. Otherwise, if you're trying to detect smartphones only, I would imagine you'd have some sort of dictionary that contains the user agent strings of the various devices.
Tereno
A: 

Here is a link to a javascript fix that I used in a similar situation. It not so much detects devices such as smart phones, rather detects whether the user has is able to view flash or not, displaying flash content first and falling back with whatever you specify if flash is not installed.

http://www.featureblend.com/javascript-flash-detection-library.html

Really simple to use and it played nicely with jQuery when I used it.

-Paul

Paul T