henrygd / bigger-picture

JavaScript lightbox gallery for images, video, audio, iframes, html. Zoomable, responsive, accessible, lightweight.
https://biggerpicture.henrygd.me
MIT License
231 stars 17 forks source link

flawed mime type detection for videos #3

Closed mlaadd closed 2 years ago

mlaadd commented 2 years ago

https://github.com/henrygd/bigger-picture/blob/a8a3ae84a2ae80940bb84bf6c2f370456c291331/src/components/video.svelte#L26 When I try to pass a video with the file extension ogv it cannot play the video since video/ogv is not a valid mime type. the mime type to be used should be video/ogg. a similar problem arises when the link itself has no file extension but redirects to the actual file.

henrygd commented 2 years ago

Thanks for testing!

Considering the possibility of non-extension URL redirects, I think the only way to solve this is forcing the user to pass data via object. The upside to this is that it's more flexible and also allows people to specify codecs if they want.

The downside is that it makes it more difficult for 99% of users who just want to plug in their mp4 / webm files. I'm kind of in between on changing to an object or just specifying mp4 / webm file support in the readme.

If you have a strong opinion either way let me know.

<div data-video='[{"src": "example.mp4", "type": "video/mp4"}, {"src": "example.webm", "type": "video/webm"}]'>
henrygd commented 2 years ago

Changed video to sources as of v0.2.0 and added an audio player for audio files. Should have no issues playing ogv or anything else. Appreciate your feedback.

https://github.com/henrygd/bigger-picture/blob/main/readme.md#sources