muxinc / media-elements

A collection of HTMLMediaElement compatible elements and add-ons
https://media-elements-nextjs.vercel.app
170 stars 12 forks source link

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

Open hugomendonca98 opened 1 month ago

hugomendonca98 commented 1 month ago

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?


  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 commented 1 month ago

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.