-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
How to fetch a data-photodata attrubute for an mp4 video? #2084
Comments
Your {html: '<video controls poster="slides/IMG_0877.jpg"><sou…t/slides/IMG_0877.mp4" type="video/mp4"> </video>'} I'm not sure how do you generate it, but you can store either a reference to the element or contents of |
@dimsemenov I generate that in the 'itemData' event:
But that is a rather complicated way to handle videos. I still hope that you develop a video plugin! |
you can do something like: if (element && element.dataset.pswpIsVideo) {
const videoURL = element.href;
const imgPoster= element.dataset.pswpIsPoster;
e.itemData = {
html: `<video controls poster="${imgPoster}"><source src="${videoURL}" type="video/mp4"> </video>`,
photodata: element.dataset.photodata,
};
} and then access it via |
Yes that solves the problem, thanks! |
@dimsemenov I wonder if there is not a simular way to solve this Dynamic caption issue: If I use the dynamic caption plugin in this album, videos do not show a caption with this code:
|
ChatGPT advised to use this code: `const captionPlugin = new PhotoSwipeDynamicCaption(lightbox, {
}); If I click on the 2nd thumbnail, no caption is displayed and the console show this: |
I have a data-photodata attribute for fetching metadata of a picture and video:
I use next code to show a button to display these metadata:
This works correctly for an image, but not for a video, see the first 2 slides of this album: https://andrewolff.jalbum.net/PhotoSwipeVideoTest/
My question is why is lightbox.pswp.currSlide.data.element.getAttribute('data-photodata') not showing the metadata of an mp4 video?
The text was updated successfully, but these errors were encountered: