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

[Bug]: possible CORS issue in embedded video #886

Open
10 tasks
JamesPHoughton opened this issue Aug 19, 2024 · 3 comments
Open
10 tasks

[Bug]: possible CORS issue in embedded video #886

JamesPHoughton opened this issue Aug 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@JamesPHoughton
Copy link
Collaborator

What happened?

With embedded training video on prod (not on dev server)

image

Issue:
image

What browsers do you see the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

What operating system do you see the problem on?

  • Windows
  • Mac
  • Linux

How did we discover the bug?

  • Reported by participant
  • Observed on Sentry
  • Found in dev

Priority

Blocking all data collection

@JamesPHoughton JamesPHoughton added the bug Something isn't working label Aug 19, 2024
@JamesPHoughton
Copy link
Collaborator Author

image

@JamesPHoughton
Copy link
Collaborator Author

On local server:
image

@JamesPHoughton
Copy link
Collaborator Author

Github Copilot suggests adding some error logging:

export function TrainingVideo({ url }) {
  const timer = useStageTimer();
  const player = usePlayer();
  const [elapsedOnLoad, setElapsedOnLoad] = useState(null);
  const [playing, setPlaying] = useState(false);

  useEffect(() => {
    console.log(`Playing video from: ${url}`);

    // test if autoplay will work
    const testAudio = new Audio("1sec_silence.mp3");
    const promise = testAudio.play();
    if (promise !== undefined) {
      promise
        .then(() => {
          setPlaying(true);
        })
        .catch((error) => {
          console.error("Autoplay failed:", error);
        });
    }
  }, [url]);

  const handleError = (error) => {
    console.error("Error playing video:", error);
  };

  return (
    <div>
      <ReactPlayer
        url={url}
        playing={playing}
        onError={handleError}
        controls
      />
      <Button onClick={() => setPlaying(!playing)}>
        {playing ? "Pause" : "Play"}
      </Button>
    </div>
  );
}

We could probably also update reactPlayer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant