1

I tried to use webodecs in my react project. But it doesn't seem to work.

Here is my debug code:

import logo from './logo.svg';
import './App.css';
// import Editor from './components/pages/editor/editor';
import { useEffect } from 'react';

function App() {
  useEffect(() => {
    console.log(window.VideoDecoder);
  });

  return (
    <div></div>
    // <Editor/>
  );
}

export default App;

Then I opened http://localhost:port/, I got ƒ VideoDecoder() { [native code] } in console. But if I opened http://ip:port/, I would get undefined in console.

1 Answer 1

4

The VideoDecoder interface is only available in secure contexts

[Exposed=(Window,DedicatedWorker), SecureContext]

You must serve your page from such a secure context, i.e from https:// here.

Sign up to request clarification or add additional context in comments.

1 Comment

for development purpose you can set about://flags/#unsafely-treat-insecure-origin-as-secure to trust your server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.