Skip to content

Commit edec91a

Browse files
committed
improve file:// support for vimeo as much as we can
1 parent bcba314 commit edec91a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

fathom.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,24 @@ github.com/markdalgleish/fathom/blob/master/MIT-LICENSE.txt
296296
},
297297

298298
_setupVimeoVideo: function(vid) {
299-
var self = this;
299+
var self = this, vid = this.config.video, downgrade = false;
300300

301301
if(window.location.protocol === "file:") {
302-
( "console" in window ) && console.log("vimeo video player api does not work with local files. Falling back basic video support\nsee http://vimeo.com/api/docs/player-js");
303-
this.config.timeline = null;
304-
this.config.video.autoplay = false;
302+
( "console" in window ) && console.log("vimeo video player api does not work with local files. Downgrading video support\nsee http://vimeo.com/api/docs/player-js");
303+
downgrade = true;
305304
}
306305

307-
var vid = this.config.video, times = this.config.timeline || [], currentSlide;
308-
309306
function loadFrame() {
310307
var id = "p" + vid.id;
311308
var frameSrc = "<iframe id=\"" + id + "\" width=\""+ ( vid.width || 360 ) + "\" height=\"" + (vid.height || 203 ) + "\" frameborder=\"0\" src=\"http://player.vimeo.com/video/" + vid.id + "?api=1&player_id=" + id + "\">";
312309
return $( frameSrc ).appendTo( vid.parent || "body" )[0];
313310
}
314311

315-
if( this.config.timeline || this.config.video.autoplay ) {
312+
if( downgrade ) {
313+
$( loadFrame() ).bind("load", function() {
314+
self._setupDefaultTimeSource();
315+
});
316+
} else {
316317
$.getScript("http://a.vimeocdn.com/js/froogaloop2.min.js?", function() {
317318
$f( loadFrame() ).addEvent( 'ready', function (player_id) {
318319
var vimeo = $f( player_id ), timer = false;
@@ -332,8 +333,6 @@ github.com/markdalgleish/fathom/blob/master/MIT-LICENSE.txt
332333
vid.autoplay && vimeo.api( "play" );
333334
} );
334335
} );
335-
} else {
336-
loadFrame();
337336
}
338337
},
339338

0 commit comments

Comments
 (0)