Giter Site home page Giter Site logo

Comments (2)

Impre-visible avatar Impre-visible commented on August 26, 2024

After some work, I put the CastProvider in my App.jsx file, and it's not the same error now, now I just have a session_error, but it's an error that I don't have on the demo website, and nothing interesting is provided. Here's my code:
App.js

import React, { useEffect } from 'react';
import { Route, BrowserRouter, Routes, useLocation } from 'react-router-dom';

// routes imports
// ...

import "./App.css";

import { Cast } from '@jdion/cast'
import { CastProvider } from '@jdion/cast-react';

const castInstance = new Cast();


const App = () => {
  return (
    <BrowserRouter>
      <Layout>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/movies/:lib" element={<Movies />} />
		  // ...
        </Routes>
      </Layout>
    </BrowserRouter>
  );
};

export const Layout = ({ children }) => {

  return (
    <>
      <CastProvider instance={castInstance}>
        {children}
      </CastProvider>
    </>
  );
};

export default App;

Video.jsx

import { useCast } from '@jdion/cast-react';


export const Video = ({ options }) => {
  const { player: chromecastPlayer } = useCast()

  const handleCast = async () => {
    console.log('casting');
    chromecastPlayer.state.displayName = 'Chocolate'
    chromecastPlayer.state.title = options.title ?? 'Video';
    chromecastPlayer.state.imageUrl = options.cover;

    chromecastPlayer.startCast(options.sources[0].src, 'application/x-mpegURL')
    console.log(chromecastPlayer.getState());
  }


  return (
    <div>
      <div className='player-wrapper'>
        <button onClick={handleCast}>Cast</button>
      </div>
    </div>
  );
};

export default Video;

And I just have that in the console:

//my logs
Video.jsx:338 casting
Video.jsx:339 {title: undefined, sources: Array(1), cover: 'video_url'}
Video.jsx:345 {currentTime: 0, progress: 0, volume: 1, title: 'Video', imageUrl: 'image_url', …}
// the error
584:1 Uncaught (in promise) session_error```

from mono.

Impre-visible avatar Impre-visible commented on August 26, 2024

The error is still here, there's requests made to load the movie
image
but same error...

from mono.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.