next-cloudinary icon indicating copy to clipboard operation
next-cloudinary copied to clipboard

CldVideoPlayer fullscreen object-cover issue

Open apetta opened this issue 1 year ago • 7 comments

I'm having a challenge getting a full-screen video with object-cover to work with CldVideoPlayer in nextjs 14. I think the styles from next-cloudinary/dist/cld-video-player.css may be causing an issue here. A regular video element works as expected.

The poster image correctly sizes itself, but the video refuses to fill the container.

This is on "next-cloudinary": "~5.20.0"

apetta avatar Feb 19 '24 20:02 apetta

hey @apetta can you share the code you're trying to use and an example of what you're trying to achieve?

colbyfayock avatar Feb 20 '24 00:02 colbyfayock

@colbyfayock Sure thing! Here's a repo with the issue

You can see the issue on a desktop viewport.

Desired layout: Screenshot 2024-02-20 at 11 51 17

With next-cloudinary: Screenshot 2024-02-20 at 11 51 32

Thank you!

apetta avatar Feb 20 '24 11:02 apetta

thanks for the example, that was really helpful

i think this is currently simply not supported natively. I'm currently wrapping the player with an aspect ratio'ed container in order to provide better responsiveness and id imagine that's certainly preventing this ability

looking into the issue itself though, the video player uses videojs under the hood, and found some potential solutions here: https://github.com/videojs/video.js/issues/3431

id be happy to rethink that and add this capability, but currently working on wrapping up a major release, so would need to be once im through with that: https://github.com/cloudinary-community/next-cloudinary/pull/407

that said, i think there are two options in the meantime:

  • you may be able to figure out a hacky solution using absolute positioning or a little javascript to make a video fill its container and hide the overflow

along the lines of:

<div that fills the container and hides overflow>
  <CldVideoPlayer
</div>
  • or you could use getCldVideoUrl to generate the URL and use the native video tag, though im unsure if there are specific features with the Video Player you're hoping to maintain

https://next.cloudinary.dev/getcldvideourl/basic-usage

colbyfayock avatar Feb 22 '24 21:02 colbyfayock

@colbyfayock Thanks for looking into this, glad to know I wan't missing something obvious.

I think the getCldVideoUrl approach should be okay for my current application. It would be great to have this capability for future use though.

Another blocker even if I found a hacky layout, is setting the disableRemotePlayback prop via CldVideoPlayer - couldn't find any docs on this! (Can open another issue if needed)

apetta avatar Feb 23 '24 12:02 apetta

yeah im thinking that because im not exposing anything that allows you to modify the video element that won't be possible

yes please, can you create a new Issue for that one?

colbyfayock avatar Feb 23 '24 15:02 colbyfayock

hey @apetta did you find a solution? i'm having the same issue right now !

Zakisb avatar Nov 03 '24 11:11 Zakisb

hey @apetta did you find a solution? i'm having the same issue right now !

Hey, I think I just generated the URL and used a custom video element in the end

apetta avatar Nov 03 '24 11:11 apetta