Jump to content

browser2kodi

From Hugo's wiki

browser2kodi is a browser extension that plays what you are looking at on Kodi, for Firefox, Chrome and the browsers built on them. It does what send2kodi does with a URL, from the browser, and talks to Kodi directly: nothing has to be installed on your computer.

  • Right-click a picture, video, song or link, then Send to Kodi (play now) or Queue on Kodi.
  • Click the toolbar button to send the page you are on, e.g. a YouTube video.

How it works

Everything goes through Kodi's JSON-RPC API, the same way as send2kodi:

You send Kodi plays it with
A YouTube video the YouTube add-on, at the time in the link if it has one; or SendToKodi, if set in the options
A link to a video, song or picture (by extension, or by what the page shows it as) Kodi itself, without any add-on
Any other page the SendToKodi add-on, which resolves it with yt-dlp on the Kodi side
A picture without a file extension Kodi's picture viewer, through the wsrv.nl image proxy

Kodi goes by the extension of a path: given a picture without one, like the thumbnails of an image search, its viewer hands it to the video player, which flashes it and stops. send2kodi serves such pictures itself under a .jpg name; an extension cannot serve anything, so the proxy does it. It only sees the picture's address, and can be turned off.

A notification and a badge on the toolbar button say how it went: … sending, ✓ playing, ! failed (hover for why). The badge is there for desktops without notifications.

Installation

  • Firefox, LibreWolf, Waterfox, Zen, Floorp (Firefox 140 or later): from addons.mozilla.org, or the .xpi of the latest release.
  • Chrome, Chromium, Brave, Vivaldi, Edge, Opera, Helium: unzip the -chrome.zip of the latest release, turn on Developer mode in chrome://extensions and Load unpacked the browser2kodi folder.

Then, in the options page that opens, enter the Kodi box's address, save, and let the extension talk to it: it asks for permission to that one address only. In Kodi, enable Settings → Services → Control → Allow remote control via HTTP. The YouTube add-on and SendToKodi are optional, for YouTube and other video sites.

Options

Option Meaning
Address, port, user, password Kodi's web server; port 8080 and user kodi by default
YouTube Play through the YouTube add-on (faster) or SendToKodi
Pictures Send pictures without a file extension through wsrv.nl
Right-click menu Both items, or just one, which then goes straight in the menu instead of a submenu

Limitations

  • Pictures embedded in the page (the first rows of Google Images) have no address to send: open the picture and send the large one.
  • Things behind a login do not play, since Kodi fetches them without the browser's cookies.
  • Files on your computer cannot be sent: that is what send2kodi is for.
  • On YouTube, right-click a video twice (Shift+right-click in Firefox) to get the browser's menu, or use the toolbar button.
  • Firefox for Android and Safari are not supported.

Development

extension/ is the extension for every browser, and can be loaded as it is: Load Temporary Add-on… in about:debugging on Firefox, Load unpacked on Chrome. node build.js writes dist/chrome and dist/firefox, each without the other browser's manifest keys.

$ node --test

runs the extension in Node against fakes of the browser and Kodi, in under a second; CI runs it on every push. Pushing a v tag with the version in the manifest submits it to addons.mozilla.org and makes a GitHub release with the Chrome zip and the signed .xpi.

See also

  • Kodi, setting Kodi up for this and its sibling tools
  • Source code (MIT)
  • send2kodi, the same from the command line, local files included
  • wl2kodi, to mirror the whole screen instead