@pbvision/partner-sdk 0.1.11 → 0.1.12
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 +12 -16
- package/package.json +1 -1
- package/src/index.js +2 -1
package/README.md
CHANGED
|
@@ -22,10 +22,10 @@ standard length game, so we'll notify your servers when the results are ready.
|
|
|
22
22
|
|
|
23
23
|
### Step 1: Get API Access
|
|
24
24
|
|
|
25
|
-
Email **[
|
|
25
|
+
Email **[support@pb.vision](mailto:support@pb.vision)** to request API access for your
|
|
26
26
|
account. Let us know which data you need access to (e.g. insights, stats) which
|
|
27
27
|
is documented below in the [Callback Data](#callback-data) section. We'll send
|
|
28
|
-
you an API Key after discussing your needs more in depth.
|
|
28
|
+
you an API Key after discussing your needs more in depth and laying out our billing options.
|
|
29
29
|
|
|
30
30
|
### Step 2: SDK Setup
|
|
31
31
|
|
|
@@ -79,12 +79,11 @@ Next, tell us to download and work on the video. You can do this using our SDK:
|
|
|
79
79
|
```javascript
|
|
80
80
|
import { PBVision } from '@pbvision/partner-sdk';
|
|
81
81
|
|
|
82
|
-
const pbv = new PBVision(YOUR_API_KEY);
|
|
82
|
+
const pbv = new PBVision(YOUR_API_KEY, { useProdServer: true });
|
|
83
83
|
// you can omit this metadata, or provide some or all of this object—whatever you'd like!
|
|
84
84
|
const optionalMetadata = {
|
|
85
|
-
userEmails: [],
|
|
86
|
-
name: 'Dink Championship
|
|
87
|
-
desc: 'A longer description, if you want',
|
|
85
|
+
userEmails: [], // these users will have the video in their PB Vision library
|
|
86
|
+
name: 'Dink Championship 2025',
|
|
88
87
|
gameStartEpoch: 1711393200, // when the game was played
|
|
89
88
|
};
|
|
90
89
|
await pbv.sendVideoUrlToDownload(YOUR_VIDEO_URL, optionalMetadata);
|
|
@@ -107,12 +106,11 @@ You can directly upload your video from a file using the SDK too:
|
|
|
107
106
|
```javascript
|
|
108
107
|
import { PBVision } from '@pbvision/partner-sdk';
|
|
109
108
|
|
|
110
|
-
const pbv = new PBVision(YOUR_API_KEY, { useProdServer:
|
|
109
|
+
const pbv = new PBVision(YOUR_API_KEY, { useProdServer: true });
|
|
111
110
|
// you can omit this metadata, or provide some or all of this object—whatever you'd like!
|
|
112
111
|
const optionalMetadata = {
|
|
113
|
-
userEmails: [],
|
|
114
|
-
name: 'Dink Championship
|
|
115
|
-
desc: 'A longer description, if you want',
|
|
112
|
+
userEmails: [], // these users will have the video in their PB Vision library
|
|
113
|
+
name: 'Dink Championship 2025',
|
|
116
114
|
gameStartEpoch: 1711393200, // when the game was played
|
|
117
115
|
};
|
|
118
116
|
await pbv.uploadVideo(YOUR_VIDEO_FILENAME, optionalMetadata);
|
|
@@ -121,8 +119,8 @@ await pbv.uploadVideo(YOUR_VIDEO_FILENAME, optionalMetadata);
|
|
|
121
119
|
### Video Editors
|
|
122
120
|
|
|
123
121
|
Editors can tag themselves and friends in the video. They also have access to
|
|
124
|
-
the video even if the video is private (to make uploaded by your partner
|
|
125
|
-
account private by default, please
|
|
122
|
+
the video even if the video is private (to make videos uploaded by your partner
|
|
123
|
+
account private by default, please let us know via email).
|
|
126
124
|
|
|
127
125
|
You can get the current list of editors on a video by using the `getVideoEditors()`
|
|
128
126
|
method. Similarly, the `setVideoEditors()` method can be used to change the
|
|
@@ -145,8 +143,7 @@ data is enabled for your API key, only some of these fields may be present):
|
|
|
145
143
|
```json
|
|
146
144
|
{
|
|
147
145
|
"from_url": "https://example.com/my-video.mp4",
|
|
148
|
-
"webpage": "https://pb.vision/video/
|
|
149
|
-
"cutVideo": "https://storage.googleapis.com/pbv-pro/xyz/f50272db-69a8-49ed-9d92-3a4d067af87c/rallies.mp4",
|
|
146
|
+
"webpage": "https://pb.vision/video/83gyqyc10y8f",
|
|
150
147
|
"cv": CV_DATA,
|
|
151
148
|
"insights": INSIGHTS_DATA,
|
|
152
149
|
"stats": STATS_DATA,
|
|
@@ -170,7 +167,6 @@ data is enabled for your API key, only some of these fields may be present):
|
|
|
170
167
|
- `stats` various stats about the game for advanced players
|
|
171
168
|
- Explore the _stats_ schema at <https://pbv-public.github.io/stats?s=~stats~game>
|
|
172
169
|
- Schema changes and diffs are in our [`pbv-public/stats` repo](https://github.com/pbv-public/stats/blob/dev/CHANGELOG.md)
|
|
173
|
-
- `cutVideo` contains a link to the rally-sliced (dead time removed) .mp4.
|
|
174
170
|
- only included if `insights` is included:
|
|
175
171
|
- `vid` - the unique ID of the video in our system
|
|
176
172
|
- `aiEngineVersion` - the version number of our AI used to process the video
|
|
@@ -191,7 +187,7 @@ For best results, we also recommend:
|
|
|
191
187
|
- Audio Encoding: MPEG-4 AAC
|
|
192
188
|
- Resolution: 1080p
|
|
193
189
|
- Frame Rate: 30 FPS
|
|
194
|
-
- Max Bitrate:
|
|
190
|
+
- Max Bitrate: 4 Mbps
|
|
195
191
|
- Max File Size: 2GB
|
|
196
192
|
|
|
197
193
|
## Reference Guide
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -140,7 +140,8 @@ export class PBVision {
|
|
|
140
140
|
async uploadVideo (mp4Filename, { userEmails = [], name, desc, gameStartEpoch, facility, court, fid } = {}) {
|
|
141
141
|
const pieces = mp4Filename.split('.')
|
|
142
142
|
const ext = pieces[pieces.length - 1]
|
|
143
|
-
const
|
|
143
|
+
const platform = { name: 'api', version: '0.1.12' }
|
|
144
|
+
const makeVIDResp = await this.__callAPI('make_video_id', { platform, userEmails, name, desc, gameStartEpoch, facility, court, fid, fileExt: ext })
|
|
144
145
|
const { hasCredits, vid } = JSON.parse(makeVIDResp)
|
|
145
146
|
if (hasCredits === false) {
|
|
146
147
|
return { hasCredits }
|