video/x-flv fallback with flowplayer
This commit is contained in:
parent
0bf7dfcfad
commit
8db3bf8c74
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -65,10 +65,20 @@ function addPlayer(container, res) {
|
||||||
'</object>');
|
'</object>');
|
||||||
fallback.attr('data', movie);
|
fallback.attr('data', movie);
|
||||||
fallback.find('param[name="movie"]').attr('value', movie);
|
fallback.find('param[name="movie"]').attr('value', movie);
|
||||||
|
} else if (r.type === 'video/x-flv') {
|
||||||
|
/* Create unique id for multiple containers on one page */
|
||||||
|
var containerId = 'flowplayer' + Math.round(Math.random() * 9999);
|
||||||
|
fallback = $('<div>Moment bitte</div>');
|
||||||
|
fallback.attr('id', containerId);
|
||||||
|
/* Defer loading because fallback needs to be appended first, and we want that .js on demand anyway */
|
||||||
|
window.setTimeout(function() {
|
||||||
|
loadFlowplayer(function() {
|
||||||
|
fallback.text('');
|
||||||
|
flowplayer(containerId, { src: '/script/flowplayer-3.2.5.swf' },
|
||||||
|
{ clip: r.href });
|
||||||
|
});
|
||||||
|
}, 1);
|
||||||
}
|
}
|
||||||
/* FIXME:
|
|
||||||
* support video/x-flv
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Add stuff to page */
|
/* Add stuff to page */
|
||||||
|
@ -145,8 +155,22 @@ function canPlayVideo(type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function canFallback(type) {
|
function canFallback(type) {
|
||||||
return type === 'audio/mpeg';
|
return type === 'audio/mpeg' ||
|
||||||
/* FIXME:
|
type === 'video/x-flv';
|
||||||
* support video/x-flv
|
}
|
||||||
*/
|
|
||||||
|
function loadFlowplayer(cb) {
|
||||||
|
if (window.flowplayer)
|
||||||
|
cb();
|
||||||
|
else {
|
||||||
|
var playerScript = $('<script type="text/javascript" src="/script/flowplayer-3.2.4.min.js"></script>');
|
||||||
|
$(document).append(playerScript);
|
||||||
|
/* Cannot use load event because it won't work if when cached */
|
||||||
|
var interval = window.setInterval(function() {
|
||||||
|
if (window.flowplayer) {
|
||||||
|
window.clearInterval(interval);
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue