- Joined
- May 9, 2011
- Messages
- 31
- Reaction score
- 0
- Points
- 6
Hello..
i am building a site where it has lots of video on it and i need it to work on all browsers.
I found that browsers need different video containers to work... Safari needs HTML5 , Firefox and Chrome need Flash.
Here is the code i am using :
The weird and annoying thing is that HTML5 in safari is not loading as fast as Flash and sometimes it just doesnt play at all... So i decided to use Flash ...everything seemed ok...i tested it on windows and OS different machines etc etc,...until a friend the other day told me that he couldnt view the video at all
Is Flash really unstable for safari? Whats the solution to this?
Many Thanks for reading this
i am building a site where it has lots of video on it and i need it to work on all browsers.
I found that browsers need different video containers to work... Safari needs HTML5 , Firefox and Chrome need Flash.
Here is the code i am using :
Code:
// Player support options
define('PLAYER_FLASH', 0);
define('PLAYER_HTML5', 1);
define('PLAYER_HTML5FALLBACK', 2);
define('PLAYER_UNSUPPORTED', 3);
// Returns a supported video player type for the user's browser
// Recognized extensions are: flv f4v mp4 m4v ogv webm
function getSupportedPlayerType($ext, $browser)
{
if ($ext === 'flv' || $ext === 'f4v')
return PLAYER_FLASH;
else
{
switch($browser)
{
case 'firefox':
case 'opera':
if ($ext === 'webm' || $ext === 'ogv')
return PLAYER_HTML5;
else if ($ext === 'mp4' || $ext === 'm4v')
return PLAYER_FLASH;
else
return PLAYER_HTML5FALLBACK;
break;
case 'ie9plus':
case 'safari':
if ($ext === 'mp4' || $ext === 'm4v' || $ext === 'mov')
return PLAYER_FLASH;
else if ($ext === 'webm' || $ext === 'ogv')
return PLAYER_UNSUPPORTED;
else
return PLAYER_HTML5FALLBACK;
break;
case 'chrome':
return PLAYER_FLASH;
break;
case 'ipad':
if ($ext === 'ogv' || $ext === 'webm')
return PLAYER_UNSUPPORTED;
else
return PLAYER_HTML5;
break;
// Ancient IE only supports Flash
case 'ie':
default:
if ($ext === 'webm' || $ext === 'ogv')
return PLAYER_UNSUPPORTED;
else
return PLAYER_FLASH;
break;
}
}
return PLAYER_UNSUPPORTED;
}
The weird and annoying thing is that HTML5 in safari is not loading as fast as Flash and sometimes it just doesnt play at all... So i decided to use Flash ...everything seemed ok...i tested it on windows and OS different machines etc etc,...until a friend the other day told me that he couldnt view the video at all
Is Flash really unstable for safari? Whats the solution to this?
Many Thanks for reading this