Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Video Files #8

Open
daniellehoo opened this issue Aug 23, 2018 · 8 comments
Open

Local Video Files #8

daniellehoo opened this issue Aug 23, 2018 · 8 comments

Comments

@daniellehoo
Copy link

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

@rcosgrave
Copy link

Same, did you find a solution?

@daniellehoo
Copy link
Author

daniellehoo commented Jan 8, 2019 via email

@sikeane
Copy link

sikeane commented Apr 5, 2019

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
Copy link

taktojest commented Aug 28, 2019

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
Copy link

amiut commented Nov 4, 2019

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

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

@austona
Copy link

austona commented Apr 7, 2020

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
Copy link

MathisZerbib commented Mar 30, 2022

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
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants