Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 687451c

Browse files
committed
Basic HTML5 video support
1 parent d3000f0 commit 687451c

File tree

4 files changed

+44
-6
lines changed

4 files changed

+44
-6
lines changed

dist/jquery.fancybox.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==================================================
2-
// fancyBox v3.2.9
2+
// fancyBox v3.2.10
33
//
44
// Licensed GPLv3 for open source use
55
// or fancyBox Commercial License for commercial use
@@ -640,6 +640,7 @@
640640
opts = {},
641641
$item,
642642
type,
643+
found,
643644
src,
644645
srcParts;
645646

@@ -708,6 +709,13 @@
708709
} else if ( src.match(/\.(pdf)((\?|#).*)?$/i) ) {
709710
type = 'pdf';
710711

712+
} else if ( found = src.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i) ) {
713+
type = 'video';
714+
715+
if ( !obj.opts.videoFormat ) {
716+
obj.opts.videoFormat = 'video/' + ( found[1] === 'ogv' ? 'ogg' : found[1] );
717+
}
718+
711719
} else if ( src.charAt(0) === '#' ) {
712720
type = 'inline';
713721
}
@@ -1655,6 +1663,17 @@
16551663

16561664
break;
16571665

1666+
case 'video' :
1667+
1668+
self.setContent( slide,
1669+
'<video controls>' +
1670+
'<source src="' + slide.src + '" type="' + slide.opts.videoFormat + '">' +
1671+
'Your browser doesn\'t support HTML5 video' +
1672+
'</video>'
1673+
);
1674+
1675+
break;
1676+
16581677
default:
16591678

16601679
self.setError( slide );
@@ -2734,7 +2753,7 @@
27342753

27352754
$.fancybox = {
27362755

2737-
version : "3.2.9",
2756+
version : "3.2.10",
27382757
defaults : defaults,
27392758

27402759

dist/jquery.fancybox.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@fancyapps/fancybox",
33
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
4-
"version": "3.2.9",
4+
"version": "3.2.10",
55
"homepage": "http://fancyapps.com/fancybox/",
66
"main": "./dist/jquery.fancybox.js",
77
"author": "fancyApps",

src/js/core.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@
630630
opts = {},
631631
$item,
632632
type,
633+
found,
633634
src,
634635
srcParts;
635636

@@ -698,6 +699,13 @@
698699
} else if ( src.match(/\.(pdf)((\?|#).*)?$/i) ) {
699700
type = 'pdf';
700701

702+
} else if ( found = src.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i) ) {
703+
type = 'video';
704+
705+
if ( !obj.opts.videoFormat ) {
706+
obj.opts.videoFormat = 'video/' + ( found[1] === 'ogv' ? 'ogg' : found[1] );
707+
}
708+
701709
} else if ( src.charAt(0) === '#' ) {
702710
type = 'inline';
703711
}
@@ -1645,6 +1653,17 @@
16451653

16461654
break;
16471655

1656+
case 'video' :
1657+
1658+
self.setContent( slide,
1659+
'<video controls>' +
1660+
'<source src="' + slide.src + '" type="' + slide.opts.videoFormat + '">' +
1661+
'Your browser doesn\'t support HTML5 video' +
1662+
'</video>'
1663+
);
1664+
1665+
break;
1666+
16481667
default:
16491668

16501669
self.setError( slide );

0 commit comments

Comments
 (0)