Polyv Help Center

Help Center

editService

Updated: 2023-09-22 17:47:34

1. Modify Single Video Information

Description

通过视频id等参数修改单个视频信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/video-info

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testUpdateVideoInfo() throws IOException, NoSuchAlgorithmException {
        VodUpdateVideoInfoRequest vodUpdateVideoInfoRequest = new VodUpdateVideoInfoRequest();
        VodUpdateVideoInfoResponse vodUpdateVideoInfoResponse = null;
        try {
            vodUpdateVideoInfoRequest
                    //可通过 new VodQueryServiceImpl().queryVideoList()获取
                    .setVideoId(super.getTestVideoId())
                    .setDesc("这是一个通过junit合并的视频")
                    .setTag("junit测试");
            vodUpdateVideoInfoResponse = new VodEditServiceImpl().updateVideoInfo(vodUpdateVideoInfoRequest);
            Assert.assertNotNull(vodUpdateVideoInfoResponse);
            if (vodUpdateVideoInfoResponse != null) {
                log.debug("测试修改单个视频信息成功,{}", JSON.toJSONString(vodUpdateVideoInfoResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a VodUpdateVideoInfoResponse object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
videoId true String Video ID [corresponds to the vid field in the API documentation]
desc false String Video description [corresponds to the describ field in the API documentation]
publishUrl false String Video premiere external link
tag false String Video tag
title false String Video title

Return Object Description

Parameter Name Type Description
imagesBig String[] Video screenshot large image URL [corresponds to the images_b field in the API documentation]
images String[] Video screenshot small image URL
tag String Video tag
title String Video title
df Integer Video bitrate
times String Play count
videoId String Video ID [corresponds to the vid field in the API documentation]
SDMp4 String Smooth bitrate mp4 video URL [corresponds to the mp4_1 field in the API documentation]
HDmp4 String High-definition bitrate mp4 video URL [corresponds to the mp4_2 field in the API documentation]
FHDmp4 String Ultra-high-definition bitrate mp4 video URL [corresponds to the mp4_3 field in the API documentation]
categoryId String Category ID, e.g., 1 for root directory [corresponds to the cataid field in the API documentation]
swfLink String Returns Flash link [corresponds to the swf_link field in the API documentation]
status String Video status: 60/61 published; 10 waiting for encoding; 20 encoding; 50 pending review; 51 review failed; -1 deleted;
seed Integer 1 for encrypted video, 0 for non-encrypted
SDFlv String Smooth bitrate flv video URL [corresponds to the flv1 field in the API documentation]
HDFlv String High-definition bitrate flv video URL [corresponds to the flv2 field in the API documentation]
FHDFlv String Ultra-high-definition bitrate flv video URL [corresponds to the flv3 field in the API documentation]
sourceFile String Source file [corresponds to the sourcefile field in the API documentation]
playerWidth String Video width [corresponds to the playerwidth field in the API documentation]
defaultVideo String User default playback video [corresponds to the default_video field in the API documentation]
duration String Video duration, e.g., 00:00:48
firstImage String Video first frame image [corresponds to the first_image field in the API documentation]
originalDefinition String Optimal resolution [corresponds to the original_definition field in the API documentation]
context String Video description
playerHeight String Video height [corresponds to the playerheight field in the API documentation]
uploadTime String Upload time [corresponds to the ptime field in the API documentation]
sourceFilesize String Source file size [corresponds to the source_filesize field in the API documentation]
filesize String[] File size for each encoded video clarity, type is array
md5Checksum String MD5 checksum [corresponds to the md5checksum field in the API documentation]
hls String[] M3U8 URL for each encoded video clarity, type is array
keepSource String Whether it is the source file: 0 for no, 1 for yes [corresponds to the keepsource field in the API documentation]
uploader Uploader Uploader information [see Uploader Parameter Description for details]
hlsLevel String Encryption level: open for non-authorized encryption, web for web authorization, app for app authorization, wxa_app for mini-program authorization
categoryName String Category name [corresponds to the cataname field in the API documentation]
Uploader Parameter Description
Parameter Name Type Description
email String Uploader email
name String Uploader name
role String Uploader role, e.g., admin, uploader, primary account






2. Modify Video Authorization Playback Switch

Description

通过视频id修改单个视频或多个视频的授权播放开关状态
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/authplay-status

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testUpdateVideoPlayStatus() throws IOException, NoSuchAlgorithmException {
        VodUpdateVideoPlayStatusRequest vodUpdateVideoPlayStatusRequest = new VodUpdateVideoPlayStatusRequest();
        Boolean vodUpdateVideoPlayStatusResponse = null;
        try {
            vodUpdateVideoPlayStatusRequest
                    //可通过 new VodQueryServiceImpl().queryVideoList()获取
                    .setVideoIds("1b448be3238618df117f9302327f28d6_1").setPlayAuth(1);
            vodUpdateVideoPlayStatusResponse = new VodEditServiceImpl().updateVideoPlayStatus(
                    vodUpdateVideoPlayStatusRequest);
            Assert.assertTrue(vodUpdateVideoPlayStatusResponse);
            if (vodUpdateVideoPlayStatusResponse) {
                log.debug("测试修改视频的授权播放开关成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
videoIds true String Multiple video IDs, separated by commas (half-width), e.g., 1b8be3,239c2e [corresponds to the vids field in the API documentation]
playAuth false Integer Whether to enable: 0 for disable, 1 for enable, default is enable [corresponds to the playauth field in the API documentation]

Return Object Description

true indicates successful modification, false indicates failed modification.




3. Batch Modify Video Authorization Method

Description

通过视频id与加密授权参数批量修改视频的授权方式
接口地址(仅做说明使用):https://api.polyv.net/v2/config/%s/hlslevel

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testUpdateVideoHlsLevelList() throws IOException, NoSuchAlgorithmException {
        VodUpdateVideoHlsLevelListRequest vodUpdateVideoHlsLevelListRequest = new VodUpdateVideoHlsLevelListRequest();
        Boolean vodUpdateVideoHlsLevelListResponse = null;
        try {
            vodUpdateVideoHlsLevelListRequest
                    //可通过 new VodQueryServiceImpl().queryVideoList()获取
                    .setVideoIds(super.getTestVideoId()).setHlsLevel("open");
            vodUpdateVideoHlsLevelListResponse = new VodEditServiceImpl().updateVideoHlsLevelList(
                    vodUpdateVideoHlsLevelListRequest);
            Assert.assertTrue(vodUpdateVideoHlsLevelListResponse);
            if (vodUpdateVideoHlsLevelListResponse) {
                log.debug("测试批量修改视频的授权方式成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
hlsLevel true String Encryption authorization parameter, value must be one of open/web/app/wxa_app. open for open authorization, web for WEB authorization, app for APP authorization, wxa_app for mini-program authorization [corresponds to the hlslevel field in the API documentation]
videoIds true String Multiple video vids, separated by commas [corresponds to the vids field in the API documentation]

Return Object Description

true indicates successful modification of the video authorization method, false indicates failed modification.




4. Modify Video Playback Preview Duration

Description

1、通过视频id修改视频的预览时长。
2、使用点播后台视频列表,选择视频,复制右侧预览代码即可播放预览视频
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/set-preview-duration

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testSetVideoPreviewDuration() throws IOException, NoSuchAlgorithmException {
        VodSetVideoPreviewDurationRequest vodSetVideoPreviewDurationRequest = new VodSetVideoPreviewDurationRequest();
        Boolean vodSetVideoPreviewDurationResponse = null;
        try {
            vodSetVideoPreviewDurationRequest
                    //可通过 new VodQueryServiceImpl().queryVideoList()获取
                    .setVideoId(super.getTestVideoId()).setDuration(60);
            vodSetVideoPreviewDurationResponse = new VodEditServiceImpl().setVideoPreviewDuration(
                    vodSetVideoPreviewDurationRequest);
            Assert.assertTrue(vodSetVideoPreviewDurationResponse);
            if (vodSetVideoPreviewDurationResponse) {
                log.debug("测试修改视频的播放预览时长成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
videoId true String Video ID [corresponds to the vid field in the API documentation]
duration true Integer Preview duration (in seconds), e.g., 20

Return Object Description

true indicates successful setting, false indicates failed setting.




5. Modify Video Ban/Unban Switch

Description

通过视频id修改视频禁播与解禁状态
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/forbidden

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

  2. After banning, the video status will be set to 53. A maximum of 500 vids can be operated at a time.

  3. Only videos with a "published" status can be banned, and only videos with a "banned" status can be set to published.

  4. If the request contains videos with multiple statuses, only videos meeting the conditions will have their status modified, and success will be returned. If no vid meets the conditions, an error will be returned.

Unit Test

    @Test
    public void testSetVideoForbidden() throws IOException, NoSuchAlgorithmException {
        VodSetVideoForbiddenRequest vodSetVideoForbiddenRequest = new VodSetVideoForbiddenRequest();
        Boolean vodSetVideoForbiddenResponse = null;
        try {
            vodSetVideoForbiddenRequest
                    //可通过 new VodQueryServiceImpl().queryVideoList()获取
                    .setVideoIds(super.getTestVideoId()).setForbidden(0);
            vodSetVideoForbiddenResponse = new VodEditServiceImpl().setVideoForbidden(vodSetVideoForbiddenRequest);
            Assert.assertTrue(vodSetVideoForbiddenResponse);
            if (vodSetVideoForbiddenResponse) {
                log.debug("测试修改视频禁播与解禁开关成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
videoIds true String Video vids, multiple videos separated by commas [corresponds to the vids field in the API documentation]
forbidden true Integer 1: Ban, 0: Unban

Return Object Description

true indicates successful setting, false indicates failed setting.




6. Modify Video Password

Description

通过视频id批量修改视频密码
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/video-setting-save

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testUpdateVideoSetting() throws IOException, NoSuchAlgorithmException {
        VodUpdateVideoSettingRequest vodUpdateVideoSettingRequest = new VodUpdateVideoSettingRequest();
        Boolean vodUpdateVideoSettingResponse = null;
        try {
            vodUpdateVideoSettingRequest
                    //可通过 new VodQueryServiceImpl().queryVideoList()获取
                    .setVideoIds("1b448be32355403dad586f7468e63e23_1,1b448be323a9076c9941604ac1c667f9_1")
                    .setPassword(super.getRandomString(10))
                    .setPublishUrl(null)
                    .setTag("junit")
                    .setTitle("junit测试");
            vodUpdateVideoSettingResponse = new VodEditServiceImpl().updateVideoSetting(vodUpdateVideoSettingRequest);
            Assert.assertTrue(vodUpdateVideoSettingResponse);
            if (vodUpdateVideoSettingResponse) {
                log.debug("测试修改视频密码成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
videoIds true String Video IDs, multiple separated by commas [corresponds to the vids field in the API documentation]
desc false String Video description [corresponds to the describ field in the API documentation]
password false String Video password
publishUrl false String Premiere external link
tag false String Video tag
title false String Video title

Return Object Description

true indicates successful modification, false indicates failed deletion.




7. Move Video to Specified Category

Description

通过视频id与分类id移动视频到指定分类
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/changeCata

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

Unit Test

    @Test
    public void testMoveVideo() throws IOException, NoSuchAlgorithmException {
        VodMoveVideoRequest vodMoveVideoRequest = new VodMoveVideoRequest();
        Boolean vodMoveVideoResponse = null;
        try {
            vodMoveVideoRequest.setCategoryId("1602671097888").setVideoIds(super.getTestVideoId());
            vodMoveVideoResponse = new VodCategoryServiceImpl().moveVideo(vodMoveVideoRequest);
            Assert.assertTrue(vodMoveVideoResponse);
            if (vodMoveVideoResponse) {
                log.debug("测试移动视频到指定分类成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
videoIds true String Video IDs, multiple videos can be selected, separated by commas, e.g., e2e85038_e,e2e85039_e [corresponds to the vids field in the API documentation]
categoryId true String The target category ID to which the video will be moved [corresponds to the cataid field in the API documentation]

Return Object Description

true indicates successful modification, false indicates failed modification.




8. Restore Videos from Recycle Bin

Description

通过视频id批量恢复回收站中的视频
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/recover-videos

Call Constraints

  1. API calls are rate-limited. Click here for details. For common call exceptions, click here.

  2. The interface supports batch restoration, with a maximum of 100 videos per operation.

Unit Test

    @Test
    public void testRecoverDelList() throws IOException, NoSuchAlgorithmException {
        VodRecoverDelListRequest vodRecoverDelListRequest = new VodRecoverDelListRequest();
        Boolean vodRecoverDelListResponse = null;
        try {
            vodRecoverDelListRequest
                    //可通过 new VodListServiceImpl().getDelList()获取
                    .setVideoIds("1b448be3232a3206fbbf59f58594d428_1,1b448be32302cab82e0189d115beedd8_1");
            vodRecoverDelListResponse = new VodEditServiceImpl().recoverDelList(vodRecoverDelListRequest);
            Assert.assertTrue(vodRecoverDelListResponse);
            if (vodRecoverDelListResponse) {
                log.debug("测试恢复回收站视频成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failure field [pic cannot be empty / msg cannot be empty]].
  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e
联系客服,在线咨询