forked from 0x2620/pandora
fix videosupport
This commit is contained in:
parent
9d01baf3c5
commit
3b7b1deb32
2 changed files with 14 additions and 5 deletions
|
@ -4,7 +4,6 @@
|
||||||
<title>{{settings.SITENAME}}</title>
|
<title>{{settings.SITENAME}}</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<link rel="shortcut icon" type="image/png" href="/static/png/icon.16.png"/>
|
<link rel="shortcut icon" type="image/png" href="/static/png/icon.16.png"/>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/oxjs/build/css/ox.ui.css"/>
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
if(typeof(console)=='undefined') {
|
if(typeof(console)=='undefined') {
|
||||||
console = {};
|
console = {};
|
||||||
|
|
|
@ -1,19 +1,29 @@
|
||||||
|
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||||
jQuery.support.video = function() {
|
jQuery.support.video = function() {
|
||||||
jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
|
jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
|
||||||
var video = {};
|
var video = {};
|
||||||
var v = document.createElement('video');
|
var v = document.createElement('video');
|
||||||
if (v) {
|
if (v) {
|
||||||
video.support = true;
|
video.support = true;
|
||||||
|
|
||||||
|
//get supported types
|
||||||
video.webm = !!(v.canPlayType && v.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
|
video.webm = !!(v.canPlayType && v.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
|
||||||
|
video.h264 = !!(v.canPlayType && v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
|
||||||
|
video.ogg = !!(v.canPlayType && v.canPlayType('video/ogg; codecs="theora, vorbis"').replace(/no/, ''));
|
||||||
|
|
||||||
//Disable WebM on Safari/Perian, seeking does not work
|
//Disable WebM on Safari/Perian, seeking does not work
|
||||||
if(video.webm && /safari/.test(navigator.userAgent.toLowerCase()) && ! /linux/.test(navigator.userAgent.toLowerCase())) {
|
if(!jQuery.browser.chrome &&
|
||||||
|
video.webm &&
|
||||||
|
/safari/.test(navigator.userAgent.toLowerCase()) &&
|
||||||
|
!/linux/.test(navigator.userAgent.toLowerCase())) {
|
||||||
video.webm = false;
|
video.webm = false;
|
||||||
}
|
}
|
||||||
video.h264 = !!(v.canPlayType && v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
|
//use webm if possible
|
||||||
if(jQuery.browser.chrome && video.webm)
|
if(jQuery.browser.chrome && video.webm) {
|
||||||
video.h264 = false;
|
video.h264 = false;
|
||||||
|
}
|
||||||
|
//aliases
|
||||||
video.mp4 = video.h264;
|
video.mp4 = video.h264;
|
||||||
video.ogg = !!(v.canPlayType && v.canPlayType('video/ogg; codecs="theora, vorbis"').replace(/no/, ''));
|
|
||||||
video.ogv = video.ogg;
|
video.ogv = video.ogg;
|
||||||
} else {
|
} else {
|
||||||
video.support = false;
|
video.support = false;
|
||||||
|
|
Loading…
Reference in a new issue