PBVision()

new PBVision()

Classes

PBVision

Methods

async getMyPartnerAccountInfo() → {PartnerAccountInfo}

Tells you what your partner account may do, e.g. whether to offer 4K.

async getOrCreateFolder(name, optionsopt) → {GetOrCreateFolderResponse}

Gets the folder in your partner account's library with exactly this name, creating it if there is none. Calling it again with the same name returns the same folder, as long as it hasn't been renamed or moved since, so it is safe to retry. Use a unique name for each event, such as one that includes its date; otherwise two events with the same name would share one folder.
Parameters:
Name Type Attributes Description
name string the folder's name: 1 to 200 characters, with no leading or trailing whitespace
options Object <optional>
Properties
Name Type Attributes Description
parent integer <optional>
the ID of the folder to look in, and to create the folder in; omit for the top level of your library

getPublicFolderUrl(fid) → {string}

The link to a folder's page on PB Vision, where anyone can view its videos once the folder is public (see updateFolder()).
Parameters:
Name Type Description
fid integer the folder's ID
Returns:
string

async getVideoEditors(vid)

Gets the email addresses (if any) which have editor access to a video your partner account uploaded.
Parameters:
Name Type Description
vid string video id
Makes a video for a game and a link that opens the PB Vision app on a phone straight to its camera, to record the game into that video. Anyone can record from the link, signed in to PB Vision or not. On a phone without the app, the link shows a page for installing it. By default the app records at 1080p and 30 FPS, and the person recording can't change either. A phone that can't record what the link asks for steps down to the best quality it supports. The link's settings apply regardless of the recorder's own PB Vision subscription. 4K requires your partner account to have 4K enabled (see getMyPartnerAccountInfo()), so without it this refuses a 4K link rather than make a video PB Vision won't analyze. Each link is for one recording: only the first upload to its video counts, so make a new link for each game. If several people may ask for the same game's link, pass the same `nonce` (e.g. your own ID for the game) and they all get one video and one link. Open the link with a real tap (e.g. in a text message, an email, or a scanned QR code) or by handing it to the phone's operating system, not inside a webview, so that the phone can open the PB Vision app. With the test server (`useProdServer: false`), the link starts with `pbvision://record` and needs a development build of the PB Vision app.
Parameters:
Name Type Attributes Description
options RecordingLinkOptions <optional>
Throws:
if gameStartEpoch is given, a camera setting is invalid, 4K is asked for and your partner account doesn't have 4K, or PB Vision doesn't make the video (e.g. because the account paying for it can't pay for it)
Type
Error
Returns:
RecordingLink

async makeVideoId(metadataopt) → {Object}

Allocate a new video ID *without* uploading a file yourself. Useful when the video will be recorded and uploaded by another client. Pass the returned `vid` (and `uid`) to that client so it uploads to this video instead of allocating a new one. To have the game recorded with the PB Vision app, use makeRecordingLink() instead.
Parameters:
Name Type Attributes Description
metadata VideoMetadata <optional>
the video's metadata, plus fileExt
Properties
Name Type Attributes Default Description
fileExt string <optional>
"mp4" the extension the video will be uploaded with
nonce string <optional>
1 to 200 characters you choose, such as your own ID for the game. Every call with the same nonce gets the same video, even calls made at the same moment; the first call decides its metadata. Until the video is uploaded, each call checks that the account paying for it can still pay; if not, that call gets no video (`hasCredits` false), and a later call gets the same video once it can. A call that gets no video doesn't use the nonce up.
Returns:
Object - the new video id and the uid it belongs to. `hasCredits` is false, with no `vid`, when the account paying for the video can't pay for it; for passthrough partners it is always present.

async sendVideoUrlToDownload(videoUrl, metadataopt) → {VideoUrlToDownloadResponse}

Tells PB Vision to download the specified video and process it. When processing is complete, your webhook URL will receive a callback.
Parameters:
Name Type Attributes Description
videoUrl string the publicly available URL of the video
metadata VideoMetadata <optional>

async setVideoEditors(vid, editorEmails, viewerEmails)

Sets the email addresses (if any) which have editor access to a video your partner account uploaded.
Parameters:
Name Type Description
vid string video id
editorEmails Array.<string> a list of 0 to 8 email addresses to allow edit access to the video (replaces any previous editors list).
viewerEmails Array.<string> a list of 0 to 8 email addresses to allow view access to the video (replaces any previous editors list).

async setWebhook(webhookUrl)

Tells PB Vision to make an HTTP POST request your URL after each of your videos is done processing.
Parameters:
Name Type Description
webhookUrl string must start with https://

async updateFolder(fid, changesopt)

Renames a folder in your partner account's library, moves it, or changes whether it is public. Fields you omit are left as they are.
Parameters:
Name Type Attributes Description
fid integer the ID of the folder to change
changes Object <optional>
Properties
Name Type Attributes Description
name string <optional>
the folder's new name: 1 to 200 characters, with no leading or trailing whitespace
parent integer <optional>
<nullable>
the ID of the folder to move it into, or null to move it to the top level of your library
public boolean <optional>
whether anyone with the folder's link may view it, signed in or not (see getPublicFolderUrl()). A folder inside a public folder is only shown with it if it is public too.

async uploadVideo(mp4Filename, metadataopt) → {VideoUrlToDownloadResponse}

Upload a video for processing by the AI. The video is only uploaded if the account paying for it has credit(s) available with which the video can be analyzed. If not, nothing is uploaded and this returns `{ hasCredits: false }` with no `vid`. The upload resumes by itself after a dropped connection or a temporary error from the storage service. If it still fails, the error thrown has the video's ID as its `vid` property. To retry without making a second video for the game, pass a `nonce` (see makeVideoId()): calling this again with the same nonce uploads to the same video.
Parameters:
Name Type Attributes Description
mp4Filename string
metadata VideoMetadata <optional>
Throws:
if the upload fails, with the video's ID as `vid`. A missing or empty file is refused before any video is made.
Type
Error