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
"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
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)
| Engine | Method | Args | Does |
|---|---|---|---|
| player | play | {url, title?, subtitles?: [{url, lang, label}], startAt?} | Opens Pulsar Player with that stream (https only). startAt in seconds. |
| converter | convert | {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?}. |
| files | open | {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.openrefusesfile:andcontent: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 forsave: "page".
Errors
| error | Means |
|---|---|
| denied | The person said no, cancelled the picker, or removed your access. Or it was called from a private tab. |
| blocked | The engine is switched off on this phone (or by Pulsar). |
| unknown_engine | No such engine, or it isn’t in your manifest. |
| unknown_method | The engine has no such method. |
| bad_args | Wrong arguments, or more than 64 KB of them. |
| busy | Another call to this engine is running, or a daily limit is used up. |
| failed | The engine couldn’t do it (a broken file, a dead link). |