Skip to content
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

Passing options to Video.js player doesn't work #45

Open
hugomendonca98 opened this issue Oct 22, 2024 · 3 comments
Open

Passing options to Video.js player doesn't work #45

hugomendonca98 opened this issue Oct 22, 2024 · 3 comments

Comments

@hugomendonca98
Copy link

hugomendonca98 commented Oct 22, 2024

Hello, I'm trying to pass some options available in Video.js to the player, but it doesn't seem to work. Specifically, I'm setting up the player options including HLS settings, but the player doesn't respond to them as expected. Is there any way to make this work?

<MediaThemeInstaplay
  className="video-js-container min-h-[200px] md:min-h-[480px]"
  style={{
    height: "100%",
    display: "flex",
    flexDirection: "column",
    justifyContent: "center",
    alignContent: "start",
    position: "relative",
  }}
>
  <VideojsVideo
    slot="media"
    src={options.sources[0].src}
    className="video-js-inner"
    playsInline
    style={{ width: "100%", height: "100%" }}
    fluid={true}
    responsive={true}
    autoPlay={options.autoplay}
    muted={options.muted}
    options={{
      fluid: true,
      responsive: true,
      playsinline: true,
      controls: true,
      sources: options.sources,
      hls: {
        limitRenditionByPlayerDimensions: true,
        useDevicePixelRatio: true,
      },
    }}
    hsl={{
      limitRenditionByPlayerDimensions: true,
      useDevicePixelRatio: true,
    }}
    crossOrigin
  />
</MediaThemeInstaplay>
@luwes luwes transferred this issue from muxinc/player.style Oct 23, 2024
@luwes
Copy link
Collaborator

luwes commented Oct 23, 2024

Thanks for the feedback! Yes, this options or config passing is something that lacks in most custom media elements at the moment but we are thinking of adding this in the future.

@luwes luwes removed the enhancement label Dec 3, 2024
@luwes luwes self-assigned this Dec 19, 2024
@rssfrncs
Copy link

Hey. Any idea when configuring videojs or hlsjs elements will be possible?

@hugomendonca98
Copy link
Author

Hey. Any idea when configuring videojs or hlsjs elements will be possible?

You can pass the hsl class directly into the videojs component:

<MediaThemeInstaplay
      className="video-js-container min-h-[200px] md:min-h-[400px] md:max-h-[400px]"
      style={{
        height: "100%",
        display: "flex",
        flexDirection: "column",
        justifyContent: "center",
        alignContent: "start",
        position: "relative",
      }}
    >
      <VideojsVideo
        slot="media"
        src={options.sources[0].src}
        className={cn("video-js-inner", {
          "vjs-fluid vjs_video_3-dimensions": width < 768,
          "min-h-[400px]": width >= 768,
        })}
        playsInline
        style={{ width: "100%", height: "100%" }}
        autoplay={options.autoplay}
        muted={options.muted}
      />
    </MediaThemeInstaplay>

@luwes luwes removed their assignment Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants