com.baidubce.services.vod
Class VodClient

java.lang.Object
  extended by com.baidubce.AbstractBceClient
      extended by com.baidubce.services.vod.VodClient

public class VodClient
extends AbstractBceClient

Provides the client for accessing the Baidu MediaResource-On-Demand Service.


Field Summary
 
Fields inherited from class com.baidubce.AbstractBceClient
config, DEFAULT_CONTENT_TYPE, DEFAULT_ENCODING, DEFAULT_SERVICE_DOMAIN, URL_PREFIX
 
Constructor Summary
VodClient(BceClientConfiguration vodConfig)
          Constructs a new client using the client configuration.
 
Method Summary
 CreateMediaResourceResponse createMediaResource(String title, String description, File file)
          Uploads the specified file to Bos under the specified bucket and key name.
 CreateMediaResourceResponse createMediaResource(String sourceBucket, String sourceKey, String title, String description)
          Load a media resource from BOS to VOD.
 DeleteMediaResourceResponse deleteMediaResource(DeleteMediaResourceRequest request)
          Delete the specific media resource managed by VOD service.
 DeleteMediaResourceResponse deleteMediaResource(String mediaId)
          Delete the specific media resource managed by VOD service.
 GetMediaResourceResponse getMediaResource(GetMediaResourceRequest request)
          Gets the properties of specific media resource managed by VOD service.
 GetMediaResourceResponse getMediaResource(String mediaId)
          Gets the properties of specific media resource managed by VOD service.
 GetPlayableUrlResponse getPlayableUrl(GetPlayableUrlRequest request)
          Get the playable URL address of specific media resource managed by VOD service.
 GetPlayableUrlResponse getPlayableUrl(String mediaId)
          Get the playable URL address of specific media resource managed by VOD service.
 GetPlayerCodeResponse getPlayerCode(GetPlayerCodeRequest request)
          Get the Flash and HTML5 codes snippet (encoded in Base64) to play the specific media resource.
 GetPlayerCodeResponse getPlayerCode(String mediaId, int width, int height, boolean autoStart)
          Get the Flash and HTML5 code snippet (encoded in Base64) to play the specific media resource.
 boolean isRegionSupported()
          Returns true if the target service supports regions.
 ListMediaResourceResponse listMediaResources()
          List the properties of all media resource managed by VOD service.
 PublishMediaResourceResponse publishMediaResource(PublishMediaResourceRequest request)
          Publish the specific media resource managed by VOD service, so that it can be access and played.
 PublishMediaResourceResponse publishMediaResource(String mediaId)
          Publish the specific media resource managed by VOD service, so that it can be access and played.
 StopMediaResourceResponse stopMediaResource(StopMediaResourceRequest request)
          Stop the specific media resource managed by VOD service, so that it can not be access and played.
 StopMediaResourceResponse stopMediaResource(String mediaId)
          Stop the specific media resource managed by VOD service, so that it can not be access and played.
 UpdateMediaResourceResponse updateMediaResource(String mediaId, String title, String description)
          Update the title and description for the specific media resource managed by VOD service.
 UpdateMediaResourceResponse updateMediaResource(UpdateMediaResourceRequest request)
          Update the title and description for the specific media resource managed by VOD service.
 
Methods inherited from class com.baidubce.AbstractBceClient
getClient, getEndpoint, getServiceId, invokeHttpClient, setClient, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VodClient

public VodClient(BceClientConfiguration vodConfig)
Constructs a new client using the client configuration.

Parameters:
clientConfiguration - The client configuration options controlling how this client connects to Vod services (e.g. proxy settings, retry counts, etc).
Method Detail

createMediaResource

public CreateMediaResourceResponse createMediaResource(String title,
                                                       String description,
                                                       File file)
                                                throws FileNotFoundException
Uploads the specified file to Bos under the specified bucket and key name.

Parameters:
file - The file containing the data to be uploaded to VOD
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.
Throws:
FileNotFoundException

createMediaResource

public CreateMediaResourceResponse createMediaResource(String sourceBucket,
                                                       String sourceKey,
                                                       String title,
                                                       String description)
Load a media resource from BOS to VOD.

Parameters:
sourceBucket - The bucket name of the media resource in BOS
sourceKey - The key name of the media resource in BOS
title - The title string of the media resource
description - The description string of the media resource
Returns:
A PutObjectResponse object containing the information returned by Bos for the newly created object.
Throws:
FileNotFoundException

getMediaResource

public GetMediaResourceResponse getMediaResource(String mediaId)
Gets the properties of specific media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
mediaId - The unique ID for each media resource
Returns:
The properties of the specific media resource

getMediaResource

public GetMediaResourceResponse getMediaResource(GetMediaResourceRequest request)
Gets the properties of specific media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
request - The request wrapper object containing all options.
Returns:
The properties of the specific media resource

listMediaResources

public ListMediaResourceResponse listMediaResources()
List the properties of all media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Returns:
The properties of all specific media resources

updateMediaResource

public UpdateMediaResourceResponse updateMediaResource(String mediaId,
                                                       String title,
                                                       String description)
Update the title and description for the specific media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
mediaId - The unique ID for each media resource
title - New title string
description - New description string
Returns:
empty response will be returned

updateMediaResource

public UpdateMediaResourceResponse updateMediaResource(UpdateMediaResourceRequest request)
Update the title and description for the specific media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
request - The request wrapper object containing all options.
Returns:
empty response will be returned

stopMediaResource

public StopMediaResourceResponse stopMediaResource(String mediaId)
Stop the specific media resource managed by VOD service, so that it can not be access and played. Disabled media resource can be recovered by method publishMediaResource() later.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
mediaId - The unique ID for each media resource
Returns:
empty response will be returned

stopMediaResource

public StopMediaResourceResponse stopMediaResource(StopMediaResourceRequest request)
Stop the specific media resource managed by VOD service, so that it can not be access and played. Disabled media resource can be recovered by method publishMediaResource() later.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
request - The request object containing all the options on how to
Returns:
empty response will be returned

publishMediaResource

public PublishMediaResourceResponse publishMediaResource(String mediaId)
Publish the specific media resource managed by VOD service, so that it can be access and played.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
mediaId - The unique ID for each media resource
Returns:
empty response will be returned

publishMediaResource

public PublishMediaResourceResponse publishMediaResource(PublishMediaResourceRequest request)
Publish the specific media resource managed by VOD service, so that it can be access and played.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
request - The request object containing all the options on how to
Returns:
empty response will be returned

deleteMediaResource

public DeleteMediaResourceResponse deleteMediaResource(String mediaId)
Delete the specific media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
mediaId - The unique ID for each media resource
Returns:
empty response will be returned

deleteMediaResource

public DeleteMediaResourceResponse deleteMediaResource(DeleteMediaResourceRequest request)
Delete the specific media resource managed by VOD service.

The caller must authenticate with a valid BCE Access Key / Private Key pair.

Parameters:
request - The request object containing all the options on how to
Returns:
empty response will be returned

getPlayableUrl

public GetPlayableUrlResponse getPlayableUrl(String mediaId)
Get the playable URL address of specific media resource managed by VOD service.

Parameters:
mediaId - The unique ID for each media resource
Returns:
the playable URL address

getPlayableUrl

public GetPlayableUrlResponse getPlayableUrl(GetPlayableUrlRequest request)
Get the playable URL address of specific media resource managed by VOD service.

Parameters:
request - The request object containing all the options on how to
Returns:
the playable URL address

getPlayerCode

public GetPlayerCodeResponse getPlayerCode(String mediaId,
                                           int width,
                                           int height,
                                           boolean autoStart)
Get the Flash and HTML5 code snippet (encoded in Base64) to play the specific media resource.

Parameters:
mediaId - The unique ID for each media resource
width - The width of player view
height - The height of player view
autoStart - Indicate whether or not play the media resource automatically when web page is loaded.
Returns:
The Flash and HTML5 code snippet

getPlayerCode

public GetPlayerCodeResponse getPlayerCode(GetPlayerCodeRequest request)
Get the Flash and HTML5 codes snippet (encoded in Base64) to play the specific media resource.

Parameters:
request - The request object containing all the options on how to
Returns:
The Flash and HTML5 code snippet

isRegionSupported

public boolean isRegionSupported()
Description copied from class: AbstractBceClient
Returns true if the target service supports regions.

The result will impact the construction of default service endpoint.

Overrides:
isRegionSupported in class AbstractBceClient
Returns:
true if the target service supports regions.


Copyright © 2016. All rights reserved.