webtor-io / embed-sdk-js

Webtor.io embed SDK for online torrent streaming and download on your site
https://webtor.io
MIT License
362 stars 83 forks source link

How to make the player work with chromecast? #27

Closed ChrisMichaelPerezSantiago closed 3 years ago

ChrisMichaelPerezSantiago commented 3 years ago

Chromecast option when playing videos is not showing.

export let loadPlayer = async (torrent_magnet) => {
  window.webtor = window.webtor || [];
  window.webtor.push({
    id: 'player',
    magnet: torrent_magnet,
    width: '100%',
    on: function (e) {
      if (e.name == window.webtor.TORRENT_FETCHED) {
        console.log('Torrent fetched!', e.data);
      }
      if (e.name == window.webtor.TORRENT_ERROR) {
        console.log('Torrent error!');
      }
    },
    features: {
      p2pProgress: true,
      title:       true,
      settings:    true,
      fullscreen:  true,
      subtitles:   true,
      continue:    true,
      playpause:   true,
      currentTime: true,
      timeline:    true,
      duration:    true,
      volume:      true,
      chromecast:  true,
      browse:      true,
      download:    true,
    },
    i18n: {
      en: {
        common: {
          "prepare to play": "Preparing Video Stream... Please Wait...",
        },
        stat: {
          "seeding": "Seeding",
          "waiting": "Client initialization",
          "waiting for peers": "Waiting for peers",
          "from": "from",
        },
      },
    },
  });
};

Any implementation required to make that functionality work?

wlasser commented 3 years ago

Wow. You comment is make me happy as default show-example. @vintikzzz hello. At tnis comment, i am starting thinking you are made great project with too many missunderstanding options. Please be a simple.

Albermonte commented 3 years ago

It works just like that, if you don't see the chromecast button maybe be because you don't have it enabled on your web browser

image

For example, in Brave you need to have Media Router enabled:

image

ChrisMichaelPerezSantiago commented 3 years ago

I have a desktop application with electronjs. In that case it would have to see how internally with electronjs I can activate it.

Albermonte commented 3 years ago

Then you don't need Webtor, you can use Webtorrent that will be faster since Webtor is downloading from Webtor's servers and Webtorrent is connecting directly to the p2p network. This is a problem in the browser since browsers don't have UDP support, but in ElectronJS you can do it on the main side and stream it to the renderer side

ChrisMichaelPerezSantiago commented 3 years ago

Thank you, I will consider it! :)

vintikzzz commented 3 years ago

@Albermonte thanks for help! @ChrisMichaelPerezSantiago in some cases users just don't want to use p2p (because of fees for torrenting in some countries).