Skip to content

SubtitlesOctopus Nextjs Runtime Error #157

Closed
@Abdullah-988

Description

@Abdullah-988

I've been trying to solve this problem since forever
when using SubtitlesOctopus with Nextjs project I always get errors like

image

I'm using Nextjs With Typescript
My code:

// Player.tsx

import { useEffect, useRef } from "react";
// @ts-ignore
import SubtitlesOctopus from "libass-wasm";

const MainDomain = "https://cdn..../"; // Basically my CDN url

type PlayerProps = {
  eng: string;
};

export default function Player({ eng }: PlayerProps) {

 useEffect(() => {
    Subtitles();
  }, []);

  function Subtitles() {
    var options = {
      video: document.querySelector("video"),
      subUrl: MainDomain + eng,
      workerUrl: new URL("libass-wasm/dist/js/subtitles-octopus-worker.js", import.meta.url)
    };

    var instance = new SubtitlesOctopus(options);
  }

  return <video />;
}

I would be appreciated If someone know how to solve this issue or If someone can make a repo example of how to use SubtitlesOctopus with Nextjs Typescript

Thank You!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions