Use Modernizr to check for <video> support and show an error messag if absent.
This commit is contained in:
parent
80060b37c1
commit
471e0eb820
@ -199,6 +199,14 @@ a:hover {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#video-unsupported {
|
||||||
|
background-image: url(../img/video-unsupported.png);
|
||||||
|
background-position: top center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
padding-top: 96px;
|
||||||
|
}
|
||||||
|
|
||||||
#auth-text input {
|
#auth-text input {
|
||||||
color: rgb(0, 0, 0);
|
color: rgb(0, 0, 0);
|
||||||
background-color: rgb(200, 200, 200);
|
background-color: rgb(200, 200, 200);
|
||||||
|
BIN
web/img/video-unsupported.png
Normal file
BIN
web/img/video-unsupported.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
1393
web/js/005-modernizr.js
Normal file
1393
web/js/005-modernizr.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -147,7 +147,8 @@ $(document).ready(function() {
|
|||||||
$("#album-view").removeClass("photo-view-container");
|
$("#album-view").removeClass("photo-view-container");
|
||||||
$("#subalbums").show();
|
$("#subalbums").show();
|
||||||
$("#photo-view").hide();
|
$("#photo-view").hide();
|
||||||
$("#video").remove();
|
$("#video-box-inner").empty();
|
||||||
|
$("#video-box").hide();
|
||||||
}
|
}
|
||||||
setTimeout(scrollToThumb, 1);
|
setTimeout(scrollToThumb, 1);
|
||||||
}
|
}
|
||||||
@ -182,18 +183,26 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
function showPhoto() {
|
function showPhoto() {
|
||||||
var width, height, photoSrc, videoSrc, previousPhoto, nextPhoto, nextLink, text;
|
var width, height, photoSrc, videoSrc, previousPhoto, nextPhoto, nextLink, text;
|
||||||
|
width = currentPhoto.size[0];
|
||||||
|
height = currentPhoto.size[1];
|
||||||
|
|
||||||
if (currentPhoto.mediaType == "video") {
|
if (currentPhoto.mediaType == "video") {
|
||||||
width = currentPhoto.size[0];
|
if (!Modernizr.video) {
|
||||||
height = currentPhoto.size[1];
|
$('<div id="video-unsupported"><p>Sorry, your browser doesn\'t support the HTML5 <video> element!</p><p>Here\'s a <a href="http://caniuse.com/video">list of which browsers do</a>.</p></div>').appendTo('#video-box-inner');
|
||||||
$(window).unbind("resize", scaleVideo);
|
}
|
||||||
$(window).unbind("resize", scaleImage);
|
else if (Modernizr.video.webm) {
|
||||||
videoSrc = photoFloat.videoPath(currentAlbum, currentPhoto);
|
$('<div id="video-unsupported"><p>Sorry, your browser doesn\'t support the WebM video format!</p></div>').appendTo('#video-box-inner');
|
||||||
$('<video/>', { id: 'video', controls: true }).appendTo('#video-box-inner')
|
}
|
||||||
.attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1])
|
else {
|
||||||
.attr("src", videoSrc)
|
$(window).unbind("resize", scaleVideo);
|
||||||
.attr("alt", currentPhoto.name)
|
$(window).unbind("resize", scaleImage);
|
||||||
.on('loadstart', scaleVideo);
|
videoSrc = photoFloat.videoPath(currentAlbum, currentPhoto);
|
||||||
|
$('<video/>', { id: 'video', controls: true }).appendTo('#video-box-inner')
|
||||||
|
.attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1])
|
||||||
|
.attr("src", videoSrc)
|
||||||
|
.attr("alt", currentPhoto.name)
|
||||||
|
.on('loadstart', scaleVideo);
|
||||||
|
}
|
||||||
$("head").append("<link rel=\"video_src\" href=\"" + videoSrc + "\" />");
|
$("head").append("<link rel=\"video_src\" href=\"" + videoSrc + "\" />");
|
||||||
$("#video-box-inner").css('height', height + 'px').css('margin-top', - height / 2);
|
$("#video-box-inner").css('height', height + 'px').css('margin-top', - height / 2);
|
||||||
$("#photo-box").hide();
|
$("#photo-box").hide();
|
||||||
@ -219,7 +228,7 @@ $(document).ready(function() {
|
|||||||
.attr("title", currentPhoto.date)
|
.attr("title", currentPhoto.date)
|
||||||
.load(scaleImage);
|
.load(scaleImage);
|
||||||
$("head").append("<link rel=\"image_src\" href=\"" + photoSrc + "\" />");
|
$("head").append("<link rel=\"image_src\" href=\"" + photoSrc + "\" />");
|
||||||
$("#video").remove();
|
$("#video-box-inner").empty();
|
||||||
$("#video-box").hide();
|
$("#video-box").hide();
|
||||||
$("#photo-box").show();
|
$("#photo-box").show();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user