@pbvision/partner-sdk 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. package/README.md +39 -36
  2. package/package.json +1 -1
  3. package/src/index.js +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # PB Vision Partner Documentation <!-- omit in toc -->
2
2
 
3
3
  The easiest way to use the PB Vision AI Engine is to simply share a link to
4
- your video file. Our AI usually works on each video for about an hour for a
4
+ your video file. Our AI usually works on each video for about 30 minutes for a
5
5
  standard length game, so we'll notify your servers when the results are ready.
6
6
 
7
7
  - [Installation](#installation)
@@ -31,8 +31,8 @@ account. We'll send you an API Key.
31
31
  4. Initialize the SDK:
32
32
 
33
33
  ```javascript
34
- import { PBVision } from '@pbvision/partner-sdk'
35
- const pbv = new PBVision(YOUR_API_KEY)
34
+ import { PBVision } from '@pbvision/partner-sdk';
35
+ const pbv = new PBVision(YOUR_API_KEY);
36
36
  ```
37
37
 
38
38
  5. Use its methods as described to [send us video URLs](#send-videos) to
@@ -47,10 +47,10 @@ an HTTP POST request to a URL ("webhook") of your choice. You can use our SDK
47
47
  to tell our servers where you want us to notify your servers like this:
48
48
 
49
49
  ```javascript
50
- import { PBVision } from '@pbvision/partner-sdk'
50
+ import { PBVision } from '@pbvision/partner-sdk';
51
51
 
52
- const pbv = new PBVision(YOUR_API_KEY)
53
- await pbv.setWebhook(YOUR_WEBHOOK_URL)
52
+ const pbv = new PBVision(YOUR_API_KEY);
53
+ await pbv.setWebhook(YOUR_WEBHOOK_URL);
54
54
  ```
55
55
 
56
56
  Alternatively, you can just use `curl`:
@@ -65,7 +65,7 @@ curl -X POST \
65
65
 
66
66
  ### Send Videos
67
67
 
68
- #### Option 1: PBV Downloads your video from a URL
68
+ #### Option 1: PBV downloads your video from a URL
69
69
 
70
70
  First, upload a video to a _publicly_ accessible URL on your server. For best
71
71
  results, videos should follow our [guidelines](#video-guidelines).
@@ -73,17 +73,17 @@ results, videos should follow our [guidelines](#video-guidelines).
73
73
  Next, tell us to download and work on the video. You can do this using our SDK:
74
74
 
75
75
  ```javascript
76
- import { PBVision } from '@pbvision/partner-sdk'
76
+ import { PBVision } from '@pbvision/partner-sdk';
77
77
 
78
- const pbv = new PBVision(YOUR_API_KEY)
79
- // you can omit this metadata, or provide some or all of this object-- whatever you'd like!
78
+ const pbv = new PBVision(YOUR_API_KEY);
79
+ // you can omit this metadata, or provide some or all of this object—whatever you'd like!
80
80
  const optionalMetadata = {
81
81
  userEmails: [],
82
82
  name: 'Dink Championship 2024',
83
83
  desc: 'A longer description, if you want',
84
- gameStartEpoch: 1711393200 // when the game was played
85
- }
86
- await pbv.sendVideoUrlToDownload(YOUR_VIDEO_URL, optionalMetadata)
84
+ gameStartEpoch: 1711393200, // when the game was played
85
+ };
86
+ await pbv.sendVideoUrlToDownload(YOUR_VIDEO_URL, optionalMetadata);
87
87
  ```
88
88
 
89
89
  Alternatively, you can just use `curl`:
@@ -103,38 +103,39 @@ To use the production server instead of the test server, change `ko3kowqi6a` to
103
103
  You can directly upload your video from a file using the SDK too:
104
104
 
105
105
  ```javascript
106
- import { PBVision } from '@pbvision/partner-sdk'
106
+ import { PBVision } from '@pbvision/partner-sdk';
107
107
 
108
- const pbv = new PBVision(YOUR_API_KEY, { useProdServer: false })
109
- // you can omit this metadata, or provide some or all of this object-- whatever you'd like!
108
+ const pbv = new PBVision(YOUR_API_KEY, { useProdServer: false });
109
+ // you can omit this metadata, or provide some or all of this object—whatever you'd like!
110
110
  const optionalMetadata = {
111
111
  userEmails: [],
112
112
  name: 'Dink Championship 2024',
113
113
  desc: 'A longer description, if you want',
114
- gameStartEpoch: 1711393200 // when the game was played
115
- }
116
- await pbv.uploadVideo(YOUR_VIDEO_FILENAME, optionalMetadata)
114
+ gameStartEpoch: 1711393200, // when the game was played
115
+ };
116
+ await pbv.uploadVideo(YOUR_VIDEO_FILENAME, optionalMetadata);
117
117
  ```
118
118
 
119
119
  ## After Video Processing is Done
120
120
 
121
121
  When our AI is done processing your video, we will email the players in the
122
- game (_if_ their email addresses were provided).
122
+ game (_if_ their email addresses were provided via `userEmails`).
123
123
 
124
124
  If you [provided a webhook](#webhook-setup), then we'll send
125
125
  an HTTP POST request to your server. Your server should acknowledge this
126
126
  callback with a standard 200 (OK) response. If it does not, we will attempt to
127
127
  retry sending this request later (up to some maximum number of attempts).
128
128
 
129
- The HTTP POST body will contain JSON which looks like this:
129
+ The HTTP POST body will contain JSON which looks like this (depending on which
130
+ data is enabled for your API key, only some of these fields may be present):
130
131
 
131
132
  ```json
132
133
  {
133
134
  "from_url": "https://example.com/my-video.mp4",
134
- "webpage": "https://app.pb.vision/video/xyz",
135
+ "webpage": "https://pb.vision/video/tvgz3pqij0ll",
135
136
  "cutVideo": "https://storage.googleapis.com/pbv-pro/xyz/f50272db-69a8-49ed-9d92-3a4d067af87c/rallies.mp4",
136
- "events": EVENTS_DATA,
137
137
  "insights": INSIGHTS_DATA,
138
+ "stats": STATS_DATA,
138
139
  "error": {
139
140
  "reason": "some explanation here..."
140
141
  }
@@ -144,30 +145,32 @@ The HTTP POST body will contain JSON which looks like this:
144
145
  - `from_url` is the video url you sent us in [step 3](#send-videos)
145
146
  - `webpage` is a link to our web app where the stats can be explored
146
147
  - `error` is only present if your video could not be processed
147
- - `events` - describes the pickleball game in detailed, low-level events
148
- - Explore the _events_ schema at <https://pbv-public.github.io/events/dev>
149
- - Schema changes and diffs are in our [`pbv-public/events` repo](https://github.com/pbv-public/events/blob/dev/CHANGELOG.md)
150
- - `insights` - a summary of high-level stats about the video
151
- - Explore the _insights_ schema at <https://pbv-public.github.io/insights/dev>
148
+ - `insights` describes the pickleball game in a detailed, shot-by-shot format
149
+ - Explore the _insights_ schema at <https://pbv-public.github.io/insights?s=~insights~game>
152
150
  - Schema changes and diffs are in our [`pbv-public/insights` repo](https://github.com/pbv-public/insights/blob/dev/CHANGELOG.md)
151
+ - `stats` various stats about the game for advanced players
152
+ - Explore the _stats_ schema at <https://pbv-public.github.io/stats?s=~stats~game>
153
+ - Schema changes and diffs are in our [`pbv-public/stats` repo](https://github.com/pbv-public/stats/blob/dev/CHANGELOG.md)
154
+ - `cutVideo` contains a link to the rally-sliced (dead time removed) .mp4.
153
155
 
154
156
  ## Video Guidelines
155
157
 
156
158
  Requirements:
157
159
 
158
- - Video Encoding: **H.264** codec
159
- - Frame Rate: **30 or 60 FPS**
160
- - File Extension: `.mp4`
160
+ - Comply with [PB Vision's framing guidelines](https://help.pb.vision/en/help/articles/1108176-video-recording-and-framing-tips)
161
+ - Video Encoding: H.264 codec
162
+ - Frame Rate: 30 or 60 FPS
163
+ - Max Duration: 30 minutes
161
164
 
162
165
  For best results, we also recommend:
163
166
 
164
- - Follow our [**video framing** guidelines](https://www.pb.vision/video-tips)
167
+ - File Extension: .mp4
165
168
  - Audio Encoding: MPEG-4 AAC
166
169
  - Resolution: 1080p
167
- - Max bitrate: 2 Mbps
168
- - Max file size: 1GB
169
- - Max duration: 30 minutes
170
+ - Frame Rate: 30 FPS
171
+ - Max Bitrate: 2 Mbps
172
+ - Max File Size: 2GB
170
173
 
171
174
  ## Reference Guide
172
175
 
173
- - [JSDocs](https://pbv-public.github.io/partner-sdk-nodejs/)
176
+ - [JSDocs](https://pbv-public.github.io/partner-sdk-nodejs/)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pbvision/partner-sdk",
3
3
  "description": "SDK for interacting with the PB Vision pickleball AI engine.",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "engines": {
package/src/index.js CHANGED
@@ -26,7 +26,7 @@ const ENVIRONMENTS = {
26
26
  /** @public */
27
27
  export class PBVision {
28
28
  constructor (apiKey, { useProdServer = false } = {}) {
29
- assert(apiKey && apiKey.length === 31 && apiKey.indexOf('_') === 10,
29
+ assert(apiKey && apiKey.indexOf('_') !== -1,
30
30
  `invalid API key: ${apiKey}`)
31
31
 
32
32
  this.apiKey = apiKey