muxinc / next-video

The easiest way to add video in your Nextjs app.
https://next-video.dev
MIT License
679 stars 22 forks source link

Can't play videos that don't have an extension on iOS #262

Open lpbonomi opened 1 month ago

lpbonomi commented 1 month ago

Similar to these:

https://stackoverflow.com/questions/32954091/how-to-play-a-video-from-url-with-no-file-extension-in-ios https://stackoverflow.com/questions/30199261/why-wont-safari-play-file-without-extension-in-video

I can't play videos that don't have an extension in the URL on iOS

A previous solution I found was using the tag with the video's URL and specifying the type of the video, this is not supported by NextVideo.

I made a repo: https://github.com/lpbonomi/next-video-error-demo And deployed the code showing this behaviour: https://next-video-error-demo.vercel.app/ (Please use an iOS device to see the problem)

Is there another way to do this?

luwes commented 1 month ago

are you looking for something like this https://github.com/muxinc/next-video/pull/263/files ?

lpbonomi commented 1 month ago

Not really, I don't think this fixes my problem and I would also like to keep the other functionalities from the <Video /> component.


The thing is that some of the videos uploaded with <Video /> component don't have an extension in the resulting URL.

For example,

This video works: https://next-videos-ultradrop.s3.us-east-1.amazonaws.com/videos/113a27a38b7a59b0d0522e30716a89385ccd67da67cdb8582d19fed2b26a43cf.mp4

This one doesn't: https://next-videos-ultradrop.s3.us-east-1.amazonaws.com/videos/0hOSpzin-U7fDiifE0H-hnuZ4u_V_tofCJbxpqpNJCA

(Check out the extension at the end of the URL)

I think that the resulting video doesn't have an extension because the original one didn't have one either, but I can't use the same fix as in the repro repo because I can't use the <source /> tag in NextVideo.


I think that this could get fixed by adding an extension to the resulting URL, maybe by finding out the type of the video, or maybe allow the use of <source /> in the <Video /> component.

@luwes What do you think? I can give out a hand with this if you need

luwes commented 1 month ago

gotcha, yes this might be tricky because the default player is the Mux player web component and it doesn't support source elements at the moment. I'll ask the team here if we might be able to support it.