@pbvision/partner-sdk 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -60
- package/package.json +1 -1
- package/src/index.js +1 -5
package/README.md
CHANGED
|
@@ -220,25 +220,19 @@ Folders organize the videos in your partner account's library. To put a new
|
|
|
220
220
|
video in a folder, pass the folder's ID as the `fid` [metadata](#video-metadata)
|
|
221
221
|
field.
|
|
222
222
|
|
|
223
|
-
`getOrCreateFolder()` returns the folder
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
for each event, such as one that includes its date; otherwise two events with
|
|
228
|
-
the same name would share one folder. Names are 1 to 200 characters, with no
|
|
229
|
-
leading or trailing whitespace.
|
|
223
|
+
`getOrCreateFolder()` returns the folder with the name you give (inside
|
|
224
|
+
`parent`, if you pass one), creating it if needed, so it's safe to retry. Use a
|
|
225
|
+
unique name for each event, such as one that includes its date. Names are 1 to
|
|
226
|
+
200 characters, with no leading or trailing whitespace.
|
|
230
227
|
|
|
231
228
|
```javascript
|
|
232
229
|
// a folder at the top level of your library
|
|
233
|
-
const { fid, created } = await pbv.getOrCreateFolder('Spring Open 2026-04-18');
|
|
230
|
+
const { fid, created } = await pbv.getOrCreateFolder('Spring Open 2026-04-18'); // created: true if new
|
|
234
231
|
|
|
235
232
|
// a folder inside it
|
|
236
233
|
const { fid: day1Fid } = await pbv.getOrCreateFolder('Day 1', { parent: fid });
|
|
237
234
|
```
|
|
238
235
|
|
|
239
|
-
`created` is `true` if the call made the folder, or `false` if it already
|
|
240
|
-
existed.
|
|
241
|
-
|
|
242
236
|
`updateFolder()` renames a folder, moves it, or makes it public. Fields you
|
|
243
237
|
leave out stay as they are:
|
|
244
238
|
|
|
@@ -249,11 +243,9 @@ await pbv.updateFolder(fid, { public: true }); // let anyone with it
|
|
|
249
243
|
await pbv.updateFolder(day1Fid, { public: true }); // and include Day 1 when it's viewed
|
|
250
244
|
```
|
|
251
245
|
|
|
252
|
-
Anyone with a public folder's link can view its videos, signed in
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
a multi-game video follow their parent). `getPublicFolderUrl()` gives you the
|
|
256
|
-
link:
|
|
246
|
+
Anyone with a public folder's link can view its videos, signed in or not. A
|
|
247
|
+
folder inside it is included only if it's public too. `getPublicFolderUrl()`
|
|
248
|
+
gives you the link:
|
|
257
249
|
|
|
258
250
|
```javascript
|
|
259
251
|
const folderUrl = pbv.getPublicFolderUrl(fid);
|
|
@@ -262,12 +254,11 @@ const folderUrl = pbv.getPublicFolderUrl(fid);
|
|
|
262
254
|
|
|
263
255
|
### Recording with the PB Vision app
|
|
264
256
|
|
|
265
|
-
|
|
266
|
-
partner account. For each game, `makeRecordingLink()` makes a video with the
|
|
257
|
+
For each game, `makeRecordingLink()` makes a video with the
|
|
267
258
|
[metadata](#video-metadata) you give it and returns a link. Opening the link on
|
|
268
259
|
a phone takes the PB Vision app straight to its camera, and the recording
|
|
269
|
-
uploads to that video. Anyone can record from the link,
|
|
270
|
-
|
|
260
|
+
uploads to that video in your partner account. Anyone can record from the link,
|
|
261
|
+
signed in to PB Vision or not.
|
|
271
262
|
|
|
272
263
|
A typical event goes like this:
|
|
273
264
|
|
|
@@ -307,22 +298,14 @@ await pbv.updateFolder(fid, { public: true });
|
|
|
307
298
|
const eventUrl = pbv.getPublicFolderUrl(fid);
|
|
308
299
|
```
|
|
309
300
|
|
|
310
|
-
`makeRecordingLink()` returns
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
`
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
example, any player on the court can tap "Record"), pass a `nonce` that
|
|
319
|
-
identifies the game, such as your own ID for it. Every call with the same nonce
|
|
320
|
-
returns the same video and link, even calls made at the same moment, and the
|
|
321
|
-
first call decides the video's metadata. Until the video is uploaded, each call
|
|
322
|
-
checks that the account paying for it can still pay; a call that can't gets no
|
|
323
|
-
video and throws, and a later call gets the same video once the account can pay.
|
|
324
|
-
`makeVideoId()` takes a `nonce` too (it returns `hasCredits: false` instead of
|
|
325
|
-
throwing).
|
|
301
|
+
`makeRecordingLink()` returns `{ vid, uid, url }`. It takes the same metadata
|
|
302
|
+
as the other methods except `gameStartEpoch` (the game's time comes from its
|
|
303
|
+
recording). It throws if the account paying for the video can't pay for it.
|
|
304
|
+
|
|
305
|
+
**One link per game.** If several people may ask for the same game's link,
|
|
306
|
+
pass a `nonce` that identifies the game, such as your own ID for it. Every call
|
|
307
|
+
with that nonce returns the same video and link, even at the same moment, and
|
|
308
|
+
the first call's metadata is used. `makeVideoId()` takes a `nonce` too.
|
|
326
309
|
|
|
327
310
|
```javascript
|
|
328
311
|
const { url } = await pbv.makeRecordingLink({ nonce: `${eventId}-${gameId}`, fid, playersForTagging });
|
|
@@ -330,12 +313,10 @@ const { url } = await pbv.makeRecordingLink({ nonce: `${eventId}-${gameId}`, fid
|
|
|
330
313
|
|
|
331
314
|
**Camera settings.** By default the link records at 1080p and 30 FPS, and the
|
|
332
315
|
person recording can't change either. Ask for 4K with `resolution: '4k'` or
|
|
333
|
-
60 FPS with `fps: 60
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
requires your partner account to have 4K enabled; otherwise PB Vision rejects
|
|
338
|
-
the upload.
|
|
316
|
+
60 FPS with `fps: 60`; with `mayChangeResolution: true` or `mayChangeFPS: true`
|
|
317
|
+
the person recording may choose lower settings. Phones step down to what they
|
|
318
|
+
support, and recorders don't need a PB Vision subscription. 4K requires your
|
|
319
|
+
partner account to have 4K enabled.
|
|
339
320
|
|
|
340
321
|
```javascript
|
|
341
322
|
const { url } = await pbv.makeRecordingLink({
|
|
@@ -347,24 +328,16 @@ const { url } = await pbv.makeRecordingLink({
|
|
|
347
328
|
});
|
|
348
329
|
```
|
|
349
330
|
|
|
350
|
-
**One recording per link.** Only the first upload to a link's video counts
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
**Testing.** With the test server (`useProdServer: false`), links start with
|
|
362
|
-
`pbvision://record` instead of `https://pb.vision/record` and end with
|
|
363
|
-
`env=test`. Any installed PB Vision app opens them, so test on a phone with a
|
|
364
|
-
development build of the app. Current App Store and Google Play versions check
|
|
365
|
-
the link before recording and say it needs the development build. Older
|
|
366
|
-
versions would record the game and upload it to production, where the test
|
|
367
|
-
video doesn't exist, so the recording would be lost.
|
|
331
|
+
**One recording per link.** Only the first upload to a link's video counts.
|
|
332
|
+
|
|
333
|
+
**Opening the link.** Let the phone open the link: a tap, a scanned QR code,
|
|
334
|
+
or your app handing it to the operating system (`UIApplication.shared.open()`
|
|
335
|
+
on iOS, an `ACTION_VIEW` intent on Android). Don't load it in a webview or an
|
|
336
|
+
in-app browser, where the PB Vision app may not open. Without the app, the link
|
|
337
|
+
shows a page for installing it.
|
|
338
|
+
|
|
339
|
+
**Testing.** Links from the test server (`useProdServer: false`) start with
|
|
340
|
+
`pbvision://record` and need a development build of the PB Vision app.
|
|
368
341
|
|
|
369
342
|
### Video Editors and Viewers
|
|
370
343
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -288,11 +288,7 @@ export class PBVision {
|
|
|
288
288
|
* inside a webview, so that the phone can open the PB Vision app.
|
|
289
289
|
*
|
|
290
290
|
* With the test server (`useProdServer: false`), the link starts with
|
|
291
|
-
* `pbvision://record` and
|
|
292
|
-
* opens it, so test with a development build of the app. Current App Store
|
|
293
|
-
* and Google Play versions check the link before recording and say it needs
|
|
294
|
-
* the development build; older versions would record the game and upload it
|
|
295
|
-
* to production, where the test video doesn't exist, so it would be lost.
|
|
291
|
+
* `pbvision://record` and needs a development build of the PB Vision app.
|
|
296
292
|
*
|
|
297
293
|
* @param {RecordingLinkOptions} [options]
|
|
298
294
|
* @returns {RecordingLink}
|