Media playback
This topic provides API calling examples for you to obtain playback URLs and playback credentials. The API operations used in this topic are encapsulated in ApsaraVideo server operation SDK for Java.
Usage notes
-
For details on API parameters and response fields, visit Alibaba Cloud OpenAPI Explorer and view the Documentation tab for each API.
-
You can get SDK sample code from Alibaba Cloud OpenAPI Explorer. On the Parameters tab, configure the required parameters and make a call. Then, on the SDK Sample Code tab, select the SDK version and programming language to view and download the code. For more information, see Automatic generation of SDK examples. In Alibaba Cloud OpenAPI Explorer, in addition to the Documentation tab, each API provides the following tabs: SDK Sample Code, CLI Example, Call Result, Call History, and Error Code. On the SDK Sample Code tab, you can select an SDK version (V2.0 recommended/V1.0) and a programming language, such as Java, TypeScript, Go, PHP, Python, C#, C++, or Swift, to view and run the corresponding sample code. In the parameters section on the left, you can configure request parameters, such as
CoverURL.
Initialize the client
Before you use the SDK, initialize a client. For more information, see Initialization.
Obtain a playback URL
You can call the GetPlayInfo operation to obtain a playback URL.
For more information, visit OpenAPI Explorer.
After you obtain the playback URL, you can use the playback URL to play the video in a client. For more information, see Use playback URLs to play videos.
Obtain a playback credential
You can call the GetVideoPlayAuth operation to obtain a playback credential.
For more information, visit OpenAPI Explorer.
After you obtain the playback credential, you can use the playback credential to play the video in a client. For more information, see Use playback credentials to play videos.