src/main/java/com/alibaba/intl/voddemo/controllers/VideosController.java
@RequestMapping(value = "/videos/prepare-upload", method = RequestMethod.POST)
    public ResponseEntity<VideoUploadDestination> prepareVideoUpload(@RequestBody UploadableVideo uploadableVideo) {
        LOGGER.info("Prepare upload for the video: " + uploadableVideo.getTitle() +
                " (file name = " + uploadableVideo.getFileName() + ")...");

        var client = new DefaultAcsClient(clientProfile);
        var request = new CreateUploadVideoRequest();
        request.setTitle(uploadableVideo.getTitle());
        request.setFileName(uploadableVideo.getFileName());
        request.setFileSize(uploadableVideo.getFileSize());
        request.setDescription(uploadableVideo.getDescription());
        request.setTemplateGroupId(templateGroupId);

        try {
            var response = client.getAcsResponse(request);
            var destination = new VideoUploadDestination(
                    response.getVideoId(), response.getUploadAddress(), response.getUploadAuth());
            return ResponseEntity.ok(destination);
        } catch (ClientException e) {
            LOGGER.warn("Unable to prepare the video upload: " + e.getMessage(), e);
            return ResponseEntity.badRequest().body(null);
        }
    }
/**
     * Request an upload address for the given video.
     *
     * @param uploadableVideo Information about the video to upload.
     * @return Information about where to upload the video.
     */
Request an upload address for the given video.
@param uploadableVideo Information about the video to upload.
@return Information about where to upload the video.
Request an upload address for the given video . @param uploadableVideo Information about the video to upload . @return Information about where to upload the video .
@RequestMapping(value = "/videos/prepare-upload", method = RequestMethod.POST)
    public ResponseEntity<VideoUploadDestination> prepareVideoUpload(@RequestBody UploadableVideo uploadableVideo) {
        LOGGER.info("Prepare upload for the video: " + uploadableVideo.getTitle() +
                " (file name = " + uploadableVideo.getFileName() + ")...");
        var client = new DefaultAcsClient(clientProfile);
        var request = new CreateUploadVideoRequest();
        request.setTitle(uploadableVideo.getTitle());
        request.setFileName(uploadableVideo.getFileName());
        request.setFileSize(uploadableVideo.getFileSize());
        request.setDescription(uploadableVideo.getDescription());
        request.setTemplateGroupId(templateGroupId);
        try {
            var response = client.getAcsResponse(request);
            var destination = new VideoUploadDestination(
                    response.getVideoId(), response.getUploadAddress(), response.getUploadAuth());
            return ResponseEntity.ok(destination);
        } catch (ClientException e) {
            LOGGER.warn("Unable to prepare the video upload: " + e.getMessage(), e);
            return ResponseEntity.badRequest().body(null);
        }
    }
@ RequestMapping ( value = "/videos/prepare-upload" , method = RequestMethod . POST ) public ResponseEntity < VideoUploadDestination > prepareVideoUpload ( @ RequestBody UploadableVideo uploadableVideo ) { LOGGER . info ( "Prepare upload for the video: " + uploadableVideo . getTitle ( ) + " (file name = " + uploadableVideo . getFileName ( ) + ")..." ) ; var client = new DefaultAcsClient ( clientProfile ) ; var request = new CreateUploadVideoRequest ( ) ; request . setTitle ( uploadableVideo . getTitle ( ) ) ; request . setFileName ( uploadableVideo . getFileName ( ) ) ; request . setFileSize ( uploadableVideo . getFileSize ( ) ) ; request . setDescription ( uploadableVideo . getDescription ( ) ) ; request . setTemplateGroupId ( templateGroupId ) ; try { var response = client . getAcsResponse ( request ) ; var destination = new VideoUploadDestination ( response . getVideoId ( ) , response . getUploadAddress ( ) , response . getUploadAuth ( ) ) ; return ResponseEntity . ok ( destination ) ; } catch ( ClientException e ) { LOGGER . warn ( "Unable to prepare the video upload: " + e . getMessage ( ) , e ) ; return ResponseEntity . badRequest ( ) . body ( null ) ; } }
Request an upload address for the given video.
Request an upload address for the given video .