function loadAndAutoplay() {
// htm5 video prep
// this function detects whether the browser supports h264 html5
// if it does, then it autoplays the video
// if it doesn't, then it removes the html5 video and injects flowplayer
if ((screen.width >= 321) && (screen.height >= 481))
{
var video = document.getElementsByTagName("video")[0];
var videoSrc = $('source').attr('src');
var poster = $('video').attr('poster');
if (!video.play)
{
remove_media_player("","","flowplayer.php");
}
var quicktime = supports_h264_baseline_video();
if (quicktime == "" in navigator.plugins)
{
remove_media_player("","","flowplayer.php");
}
// as far as I can tell, this just autoplays the html5 video
if (video.play)
{
video.addEventListener("play", function() { video.play(); }, true);
video.addEventListener("pause", function() { video.pause(); }, true);
video.addEventListener("canplaythrough", function() { video.play(); }, true);
}
}
}
function supports_video() {
return !!document.createElement('video').canPlayType;
}
// FUNCT: check if browser supports H.264
function supports_h264_baseline_video() {
if (!supports_video()) { return false; }
var v = document.createElement("video");
return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
}
// FUNCT: check if browser supports OGG
function supports_ogg_theora_video() {
if (!supports_video()) { return false; }
var v = document.createElement("video");
return v.canPlayType('video/ogg; codecs="theora, vorbis"');
}
// html5_video.js
if ((screen.width>=321) && (screen.height>=481)) {
var video = document.getElementsByTagName("video")[0];
var videoSrc = $('source').attr('src');
var poster = $('video').attr('poster');
var flash = $('').attr('flashvars', 'file='+videoSrc+'&image='+poster+'&stretching=fill');
if ( !video.play ) {
$('video').replaceWith(flash);
}
var quicktime = video.canPlayType("video/mp4");
if (quicktime == "" in navigator.plugins){
$('video').replaceWith(flash); }
if ( video.play ) {
video.addEventListener("play", function() { video.play(); }, true);
video.addEventListener("pause", function() { video.pause(); }, true);
video.addEventListener("canplaythrough", function() { video.play(); }, true);
}
}