Create a Single Channel (Legacy)
Updated: 2022-12-20 17:27:05
API Description
1、创建频道并进行相关设置
2、接口支持https协议
API URL
http://api.polyv.net/live/v2/channels/
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. Click for details
Request Parameters Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See: 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 used to generate the signature is critical for data security. It must never be used directly on the client side. All API calls must be relayed through your own server to the POLYV server to obtain response data. See: Signature Generation Rules |
| userId | true | String | POLYV user ID, same as on the official website. Path: Official Website -> Login -> Live (Development Settings) |
| name | true | String | Channel name, maximum length 60 |
| channelPasswd | true | String | Channel password, maximum length 16 |
| scene | false | String | Live streaming scene, default is alonealone: Event recordingppt: Three-screen layouttopclass: Large classseminar: Seminar |
| pureRtcEnabled | false | String | Whether it is a zero-latency live stream, default is NY: YesN: No |
| cnAndEnLiveEnabled | false | String | Bilingual (Chinese/English) live room toggle, default is NY: EnabledN: Disabled |
| englishSettingEnabled | false | String | English live room toggle, default is NY: EnabledN: Disabled |
| publisherEnglishName | false | String | English host name |
| channelEnglishName | false | String | English channel name |
| categoryId | false | Integer | Category ID for the new channel. If not provided, the default category is used. (Category IDs can be obtained via the Query Live Categories API) |
| maxViewer | false | Integer | Maximum concurrent viewers. 0 and -1 mean unlimited. |
| linkMicLimit | false | Integer | Maximum number of participants for mic connection, up to 16 (range >= -1, <= global setting). -1: Use global setting. |
| playerColor | false | String | Player control bar color, default: #666666 |
| autoPlay | false | Integer | Whether to auto-play0: Do not auto-play1: Auto-play, default is 1 |
| receive | false | String | Whether it is a receiving relay channel. Leave empty or use other values for a sending relay channel. (Note: Requires the channel relay feature to be enabled.)Y: YesN: No |
| receiveChannelIds | false | String | Receiving relay channel IDs, separated by commas. Invalid if receive is Y. (Note: Requires the channel relay feature to be enabled.) |
| channelObject | false | String | Channel attribute |
| doubleEnabled | false | String | Dual-teacher channel attribute. N: Not enabled (default), Y: Dual-teacher channel |
| bookingEnabled | false | String | Booking feature toggle, default is YY: EnabledN: Disabled |
| streamType | false | String | Live streaming methodclient: Client pushpull: Pull streamthirdpull: Third-party pull streamdisk: Pseudo-liveaudio: Audio live stream |
| aloneWatchLayout | false | String | Layout configuration for standard live viewing page (normal: normal, portrait: portrait). Default is standard live. |
Example
http://api.polyv.net/live/v2/channels?appId=frlr1zazn3×tamp=1671527624000&sign=AD7FC9F7F3E55B1145E354FB291590E3&name=%E5%B0%8F%E8%AF%BE%E5%A0%82&userId=1b448be323&channelPasswd=32L8PQC08sg
Response Parameters Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success. Non-200 indicates failure. See: Global Error Description |
| status | String | Response status text |
| message | String | Response description. Provides auxiliary error details when code is 400 or 500. |
| data | Object | Returns detailed channel information on success. See: Data Field Description |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Live channel ID |
| userId | String | POLYV user ID, same as on the official website. Path: Official Website -> Login -> Live (Development Settings) |
| name | String | Live channel name |
| publisher | String | Host |
| description | String | Live channel description |
| url | String | Live stream URL |
| stream | String | Live stream name |
| logoImage | String | Logo image URL |
| logoOpacity | Double | Logo opacity |
| logoPosition | String | Logo position on the player |
| logoHref | String | Logo external link |
| coverImage | String | Cover image URL |
| coverHref | String | Cover image external link |
| waitImage | String | Waiting stream image |
| waitHref | String | Waiting stream image external link |
| cutoffImage | String | Stream cutoff image URL |
| cutoffHref | String | Stream cutoff image external link |
| advertType | String | Ad type: no ad, image ad, FLV ad |
| advertDuration | Integer | Ad duration, in seconds |
| advertWidth | Integer | Ad width, in pixels |
| advertHeight | Integer | Ad height, in pixels |
| advertImage | String | Image ad URL |
| advertHref | String | Ad external link |
| advertFlvVid | String | FLV ad videoId in the PolyV system |
| advertFlvUrl | String | FLV ad URL |
| playerColor | String | Player control bar color |
| autoPlay | Boolean | Whether to auto-play |
| warmUpFlv | String | Warm-up video |
| passwdRestrict | Boolean | Whether password protection is set |
| playCodeRestrict | Boolean | Whether password protection is set (equivalent to passwdRestrict) |
| passwdEncrypted | String | MD5 encrypted playback password |
| playCodeEncrypted | String | MD5 encrypted playback password (equivalent to passwdEncrypted) |
| isOnlyAudio | String | Whether it is an audio-only live stream |
| isLowLatency | String | Whether it is a low-latency live stream |
| m3u8Url | String | M3U8 URL |
| m3u8Url1 | String | Standard definition M3U8 URL |
| m3u8Url2 | String | High definition M3U8 URL |
| m3u8Url3 | String | Ultra high definition M3U8 URL |
| channelLogoImage | String | Channel logo image |
| scene | String | Live streaming scene |
| channelViewerPasswd | String | Participant password |
| channelPasswd | String | Channel password |
| linkMicLimit | Integer | Maximum mic connection participants |
| streamType | String | Live streaming method |
| pureRtcEnabled | String | Whether it is pure RTC pull stream |
| type | String | Channel type: sending relay, receiving relay |
| cnAndEnLiveEnabled | String | Bilingual live room toggle |
| pushEnUrl | String | English push stream URL |
| closeDanmu | String | Danmaku toggle |
Java Request Example
For quick integration of the basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.
It is strongly recommended to use the Live Java SDK for API 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(ChannelOperateTest.class);
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": {
"channelId": 11667086,
"userId": "1b448be323",
"name": "polyv小课堂",
"publisher": "主持人",
"description": "",
"url": "rtmp://push-d1.videocc.net/recordf/1b448be32316715274020016771?auth_key=1671529203-0-0-f6198f001ccf7fca946c90801ef9c504",
"stream": "1b448be32316715274020016771",
"logoImage": "https://liveimages.videocc.net/uploaded/images/2021/04/fy3ce1e8uh.png",
"logoOpacity": 0.37,
"logoPosition": "tr",
"logoHref": "",
"coverImage": "",
"coverHref": "",
"waitImage": "",
"waitHref": "",
"cutoffImage": "",
"cutoffHref": "",
"advertType": "NONE",
"advertDuration": 0,
"advertWidth": 0,
"advertHeight": 0,
"advertImage": "",
"advertHref": "",
"advertFlvVid": "",
"advertFlvUrl": "",
"playerColor": "#666666",
"autoPlay": false,
"warmUpFlv": "",
"passwdRestrict": false,
"playCodeRestrict": false,
"passwdEncrypted": "",
"playCodeEncrypted": null,
"isOnlyAudio": "N",
"isLowLatency": "N",
"m3u8Url": "http://pull-d1.videocc.net/recordf/1b448be32316715274020016771.m3u8?auth_key=1671527403-0-0-de8272610bc40f7102dcb880cfde138d",
"m3u8Url1": "",
"m3u8Url2": "",
"m3u8Url3": "",
"channelLogoImage": "https://liveimages.videocc.net/uploaded/images/2022/11/gffeocwo9n.png",
"scene": "alone",
"channelViewerPasswd": null,
"channelPasswd": "QIbGmAmhMJ1dq",
"loginCode": null,
"linkMicLimit": 16,
"streamType": "client",
"pureRtcEnabled": "N",
"type": "normal",
"cnAndEnLiveEnabled": "N",
"pushEnUrl": null,
"closeDanmu": "N",
"currentTimeMillis": 1671527405150
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
