Add On-Demand Video to Video Library
Interface Description
1、添加账号对应的点播视频到直播频道下的视频库
2、接口支持https协议
Interface URL
http://api.polyv.net/live/v3/channel/playback/add
Request Method
POST
Interface Constraints
The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details
To set up three-screen playback across channels, call the Modify Video Information interface to change the tag of the video corresponding to the vid to: channel number|ppt, e.g., 2566989|ppt
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details in Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored on the client side for direct use. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See details in Signature Generation Rules |
| channelId | true | String | Channel ID |
| vid | true | String | On-demand video vid Can be obtained via On-Demand API - Search Video. For cross-channel usage, please read the second point of Interface Constraints |
| setAsDefault | false | String | Position in the video library list. Default is N Y: Pin to top of playback list N: Pin to bottom of playback list |
| listType | false | String | List type. Default is vod for regular live streaming, playback for three-screen scenarios playback: Playback list vod: On-demand list |
Example
http://api.polyv.net/live/v3/channel/playback/add
Form Parameters:
vid=1b448be32378ab852b8989f5cbf1359c_1&appId=frlr1zazn3&sign=A7AB37F4D0FC3EFFA4B40344E145410D&listType=playback&channelId=2191541×tamp=1621841372083
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure See details in Global Error Description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides auxiliary error reason description |
| data | Object | Empty on failure. Contains channel recording video information on success See details in data Field Description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| videoId | String | ID generated by the live streaming system |
| videoPoolId | String | On-demand video vid |
| userId | String | POLYV user ID, consistent with the Polyv official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| channelId | String | Live streaming channel ID corresponding to the playback video |
| title | String | Video title |
| firstImage | String | Video thumbnail |
| duration | String | Video length, format: HH:mm:ss |
| myBr | String | Default video playback quality 1: Smooth 2: HD 3: Full HD |
| qid | String | Visitor information collection ID |
| seed | Integer | Video encryption status 1: Encrypted 0: Not encrypted |
| ordertime | Integer | Sorting field for associated on-demand video |
| createdTime | Long | Date added as playback video, 13-digit millisecond timestamp |
| lastModified | Long | Last modification date of the video, 13-digit millisecond timestamp |
| rank | Integer | Sorting value, higher value indicates higher priority |
| asDefault | String | Whether it is the default playback video Y: Play N: Do not play |
| url | String | Video playback URL. Note: If the video is encrypted, this URL cannot be accessed |
| channelSessionId | String | Used for PPT data requests, related to PPT live streaming playback. Value is null for regular live streaming playback |
| status | String | Status of the associated on-demand video |
| fileUrl | String | Video URL |
| fileId | String | Temporary fileId before playback video transfer |
| startTime | String | Live streaming start time, format: yyyyMMddHHmmss |
| liveType | String | Live streaming type alone: Event live streaming ppt: Three-screen topclass: Large class seminar: Seminar |
| width | Integer | Video width |
| height | Integer | Video height |
| origin | String | Transfer file source manual: Manual recording auto: Automatic recording merge: Merged clip: Clipped |
| callbackUrl | String | Callback URL set during video transfer |
| errorCount | Integer | Number of processing failures |
| lang | String | Language type, default is Chinese zh_CN: Chinese EN: English |
| videoIdEN | String | English playback videoId |
| enFileUrl | String | English playback file URL |
| mergeInfo | String | Video merge information |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.
It is strongly recommended to use the Live Java SDK for API functionality integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelPlayBackTest.class);
/**
* 将点播中的视频添加到视频库
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testAddVodPlayback() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/playback/add";
String channelId = "2191532";
String vid = "1b448be323e68e4404332113a57353b2_1";
String setAsDefault = "Y";
String listType = "playback";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("vid", vid);
requestMap.put("setAsDefault", setAsDefault);
requestMap.put("listType", listType);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试将点播中的视频添加到视频库,返回值:{}", response);
//do somethings
}
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
{
"code":200,
"status":"success",
"message":"",
"data":{
"videoId":"1b96d90bf5",
"videoPoolId":"1b448be323e68e4404332113a57353b2",
"userId":"1b448be323",
"channelId":2191532,
"title":"Spring 知识精讲1111",
"firstImage":"1b448be323/2/1b448be323e68e4404332113a57353b2_0.jpg",
"duration":"00:01:53",
"myBr":"1",
"qid":null,
"seed":0,
"ordertime":0,
"createdTime":1615515464000,
"lastModified":1615777234000,
"rank":0,
"asDefault":"N",
"url":"https://hls.videocc.net/source/1b448be323/2/1b448be323e68e4404332113a57353b2_1.m3u8",
"channelSessionId":"fwmnnydr06",
"status":"Y",
"fileUrl":"https://oss-live-2.videocc.net/record/record/recordf/1b448be323161536226913173df/1b448be323e68e4404332113a57353b2/2021-03-11-16-13-14_2021-03-11-16-15-07.m3u8",
"fileId":"94ea693e1733389ae2e7693ebdacbd43",
"startTime":"20210311161313",
"liveType":"ppt",
"width":1280,
"height":720,
"origin":"auto",
"callbackUrl":null,
"errorCount":0,
"lang":"zh_CN",
"videoIdEN":null,
"enFileUrl":null,
"mergeinfo":null
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
