dbrekalo / simpleLightbox

SimpleLightbox is lightweight and responsive lightbox library with no dependencies. Display images, galleries, videos or custom content and control your lightbox with easy to use api.
http://dbrekalo.github.io/simpleLightbox/
MIT License
270 stars 76 forks source link

Local Video Files #8

Open daniellehoo opened 6 years ago

daniellehoo commented 6 years ago

Are local video files supported? When I tried to link to local videos the lightbox gets hung up while displaying 'Loading...'

rcosgrave commented 5 years ago

Same, did you find a solution?

daniellehoo commented 5 years ago

I did not

On Tue, Jan 8, 2019 at 11:14 AM Raymond Cosgrave notifications@github.com wrote:

Same, did you find a solution?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dbrekalo/simpleLightbox/issues/8#issuecomment-452356787, or mute the thread https://github.com/notifications/unsubscribe-auth/AcTX2DqhseYH9oXpKudn2fEtovqwenuTks5vBMP4gaJpZM4WJxYa .

sikeane commented 5 years ago

I know this is old, but just encase this is helpful. You can use the Custom content example to get local videos working. I use data objects on the HTML to get the video source, but you choose another method.

var = mp4 = $this.data('mp4') !== 'undefined' ? '<source src="' + $this.data('mp4') + '" type="video/mp4">' : null ,
    webm = $this.data('webm') !== 'undefined' ? '<source src="' + $this.data('webm') + '" type="video/mp4">' : null ,
    ogg = $this.data('ogg') !== 'undefined' ? '<source src="' + $this.data('ogg') + '" type="video/mp4">' : null ;

SimpleLightbox.open({
    content: '<video id="js-banner-video" class="l-banner__video" autoplay="" loop="" width="100%" controls>' +
        mp4 +
        webm +
        ogg +
    '</video>',
    elementClass: 'slbContentEl',
    htmlClass: ' v-lightbox-open',
    closeBtnClass: ' v-lightbox__close-button',
    nextBtnClass: ' v-lightbox__next-button',
    prevBtnClass: ' v-lightbox__prev-button',
    overlayClass: ' v-lightbox__overlay'
});
taktojest commented 5 years ago

Nice, it works, but can someone give me some hint how to implement sliding option with this solution. I have several local video files that I will to show once in lightbox (via next/prev buttons), it would be great to have such possibility.

amiut commented 4 years ago

Well there's a better way which is not documented :

$('.gallery a').simpleLightbox({
  videoRegex: new RegExp(/\.mp4/)
});
austona commented 4 years ago

Well there's a better way which is not documented :

$('.gallery a').simpleLightbox({
  videoRegex: new RegExp(/\.mp4/)
});

This is amazing. Why it is not documented?

MathisZerbib commented 2 years ago

Well there's a better way which is not documented :

$('.gallery a').simpleLightbox({
  videoRegex: new RegExp(/\.mp4/)
});

Thank you Buddy works well in vanillaJS

    window.onload = () => {
        new SimpleLightbox({
            elements: '.imageWallContainer a',
            videoRegex: new RegExp(/\.mp4/)
        });
    }
darkpivot commented 1 year ago

Well there's a better way which is not documented :

$('.gallery a').simpleLightbox({
  videoRegex: new RegExp(/\.mp4/)
});

Thank you Buddy works well in vanillaJS

    window.onload = () => {
        new SimpleLightbox({
            elements: '.imageWallContainer a',
            videoRegex: new RegExp(/\.mp4/)
        });
    }

I managed to get this working, thank you so much. One question, is there a way to set the embedded video's attributes with this method? I'd like the video to loop, but I'm having difficulty figuring out if this is possible. Any help would be appreciated!