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

Use HLS, We got some variable errors #8715

Closed
SolitaryMist opened this issue Apr 30, 2024 · 5 comments
Closed

Use HLS, We got some variable errors #8715

SolitaryMist opened this issue Apr 30, 2024 · 5 comments

Comments

@SolitaryMist
Copy link

Description

Hi~ I got some problems when i used videojs in ReactApp!

My package.json file

"video.js": "^8.6.1",

My video react component code:

const Video = forwardRef((props: Props, ref) => {
  const {
    src,
    hlsSrc,
    poster,
    onMouseOver,
    onMouseOut,
    controls = true,
    autoplay = false,
    watermaker,
    onEnded,
    pictureInPictureToggle = false,
    fullscreenToggle = false,
    volumePanel = false,
    videoClassName,
    mediaHeightInWorkCard,
  } = props;
  const videoRef = useRef(null);
  useEffect(() => {
    if (!videoRef?.current) return;
    const player = videojs(videoRef?.current, {
      sources: hlsSrc ? [{
        src: hlsSrc,
        type: 'application/x-mpegURL',
      }] : [{ src }],
      ...(hlsSrc ? {
        html5: {
          vhs: {
            overrideNative: true,
            withCredentials: true,
          },
          nativeAudioTracks: false,
          nativeVideoTracks: false,
        },
      } : {}),
      ...(poster ? { poster } : {}),
      controls,
      autoplay,
      preload: 'metadata',
      responsive: true,
      fluid: true,
      muted: true,
      language: 'zh-CN',
      html5: {},
      controlBar: {
        ...(volumePanel
          ? {
            volumePanel: {
              inline: false,
            },
          }
          : {
            volumePanel: false,
          }),
        pictureInPictureToggle,
        fullscreenToggle,
      },
      userActions: {
        doubleClick: false,
      },
    });
    player.on('ended', handleEnded);
    return () => {
      player.dispose();
      player.off('ended', handleEnded);
    };
  }, []);
...
...
...
  return (
    <div data-vjs-player onMouseOver={onMouseOver} onMouseOut={onMouseOut}>
      <video
        ref={videoRef}
        className={classnames('video-js vjs-default-skin', videoClassName)}
      />
    </div>
  );

I saw my console contain some errors,here is screenshot。
image
image

if i delete my hls config,and use normal video source such as .mp4, The error disappeared.

I have no idea, The cause of the error cannot be found.

Reduced test case

none

Steps to reproduce

1.use videojs 8.6.1
2.use hls config and .m3u8 video source
3.error will appear

Errors

No response

What version of Video.js are you using?

8.6.1

Video.js plugins used.

videojs-dynamic-watermark

What browser(s) including version(s) does this occur with?

124.0.6367.79

What OS(es) and version(s) does this occur with?

macos

@SolitaryMist SolitaryMist added the needs: triage This issue needs to be reviewed label Apr 30, 2024
Copy link

welcome bot commented Apr 30, 2024

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@SolitaryMist SolitaryMist changed the title Use HLS, We get some Variable error Use HLS, We got some variable errors Apr 30, 2024
@mister-ben
Copy link
Contributor

This getVariables() code where the error occurs is not part of Video.js.

@SolitaryMist
Copy link
Author

This getVariables() code where the error occurs is not part of Video.js.

When I use the .m3u8 video source and enable the type: 'application/x-mpegURL' configuration of videojs, an error will be reported.

I'm also very troubled. I couldn't find the getVariables() code in the packaged code.

I wonder if it might be a problem caused by the videojs-http-streaming plug-in of videojs.

@mister-ben
Copy link
Contributor

It's not in http-streaming either. Part of the reasons it is imperative to create a reduced test case when opening issues is to isolate where an issue occurs and what combination of factors is relevant. As it is, there is nothing actionable here.

@mister-ben mister-ben added needs: reduced test case and removed needs: triage This issue needs to be reviewed labels May 8, 2024
@SolitaryMist
Copy link
Author

SolitaryMist commented May 9, 2024

It's not in http-streaming either. Part of the reasons it is imperative to create a reduced test case when opening issues is to isolate where an issue occurs and what combination of factors is relevant. As it is, there is nothing actionable here.

I seem to have found the reason. It is indeed not a bug in videojs, but a problem with a certain chrome plugin. I disabled all plugins and found that the problem disappeared. Thank you for helping me answer❤️❤️❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants