Skip to content

not working in nextjs14 #269

@Piyushsomething

Description

@Piyushsomething

i been using it in node express where its been working perfectly fine with that loadPlayer of rtsp
but when i read the docs and try implementing in frontend with nextjs nothing is showing, but in network tab its visble the websockets are working perfectly but player is not working

Kindly provide me a fix for this
my code

"use client";
import React, { useRef, useEffect } from "react";
import { loadPlayer } from "rtsp-relay/browser";

const DaylightStream = () => {
  const canvasRef = useRef(null);

  useEffect(() => {
    const canvas = canvasRef.current;

    if (!canvas) {
      throw new Error("Canvas ref is null");
    }

    loadPlayer({
      url: "ws://localhost:2000/api/stream/camera3",
      canvas,
    });
  }, []);

  return (
    <div>
      <h1>Daylight Stream</h1>
      <div className="border-8 border-black">
        <canvas
          style={{ width: "100%", height: "100%", border: "1px solid blue" }}
          ref={canvasRef}
        />
      </div>
    </div>
  );
};

export default DaylightStream;

my network tab for help

image

Also the console is clean nothing is showing .

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions