Developers

Engines

Engines are big parts of Pulsar that extensions and websites can use: the Player, the Files viewer and the Converter. You call them with one line; Pulsar does the work on the phone.

Declare the engines you use

manifest.json
"pulsar": { "api": 1, "engines": ["converter", "player"] }

This shows at install as a line like “Use the Converter engine”. There is no prompt on each call. People can take the access away on Settings › Engines (“Remove”); then your calls answer denied until the extension is installed again.

Call an engine

background.js
const r = await Pulsar.engines.call("converter", "convert", { to: "mp3", save: "downloads" });
if (r.ok) {
  Pulsar.call("status.set", { text: `Saved ${r.name}` });
} else if (r.error === "busy") {
  // one call at a time per engine, or the free daily limit is used up
}

The answer comes when the engine is done, and the person may be picking a file first, so a call can wait up to 10 minutes. Private tabs can’t use engines.

Methods (v1)

EngineMethodArgsDoes
playerplay{url, title?, subtitles?: [{url, lang, label}], startAt?}Opens Pulsar Player with that stream (https only). startAt in seconds.
converterconvert{to: "mp3" | "mp4" | "gif" | "m4a", save?: "downloads" | "page"}The person picks one file; it is converted on the phone. Answers {ok, name, size, type, savedTo, blob?}.
filesopen{url}Opens a document or archive (PDF, DOCX, CSV, ZIP, …) from an https link in the Files viewer (at most 200 MB).
  • Files never pass silently: anything that reads a file makes the person pick it.
  • files.open refuses file: and content: links and addresses on the phone or the local network.
  • Results go to Downloads, or back as a blob (base64, under 50 MB) when you ask for save: "page".

Errors

errorMeans
deniedThe person said no, cancelled the picker, or removed your access. Or it was called from a private tab.
blockedThe engine is switched off on this phone (or by Pulsar).
unknown_engineNo such engine, or it isn’t in your manifest.
unknown_methodThe engine has no such method.
bad_argsWrong arguments, or more than 64 KB of them.
busyAnother call to this engine is running, or a daily limit is used up.
failedThe engine couldn’t do it (a broken file, a dead link).