ngx-gallery icon indicating copy to clipboard operation
ngx-gallery copied to clipboard

Video without extensions won't work

Open sqljim opened this issue 4 years ago • 1 comments

Hi,

I'm trying to add a video into the gallery by using the device's camera. I want to display the video in the gallery and at the same time in the background upload it to the cloud.

The issue I'm having is that my URL's look like this:

https://firebasestorage.googleapis.com/v0/b/mycoolappname.appspot.com/o/AAU%2Fperson-media%2F20201031_040941_uploadFile?alt=media&token=aafc5d4c8

Even when I set the URL (to something like newVideo.mkv or uploadedVideo.mp4) and the Type of the object I'm still not able to get the videos to play. The browser records MKV videos, which i'm able to play using a standard video tag:

But the gallery won't play them. Any ideas?

sqljim avatar Oct 31 '20 11:10 sqljim

So I made some changes in a fork and have made a pull request. I checked that all the tests passed and added some new tests for the changes I've made.

Basically this change will let you specify the type of the 'image'. By using the image.type you can specify whether it's an image or a video. The type will be used first if specified, but the function will fall bcak to a slightly altered version of the existing functionality if the type is not specified, where it will attempt to derive the file type from the extension.

Currently the function just splits the filename by . and then pops the last element, assuming that it's a file extension. The change will do the same, except remove anything after a special character, so: mySpecialImage.jpg?alt=media&token=SDFDSFSS will return an image.

I'm new to contributing to projects so happy to make any changes required.

sqljim avatar Nov 02 '20 10:11 sqljim