Example 3: Obtaining Media Asset Details
Scenario
You can call VOD APIs to query the basic information and information about transcoded files, snapshots, and review of one or more media assets.
This section describes how to call APIs to obtain details about media assets stored in VOD.
Prerequisites
- You have specified the region where the media asset to be queried is located. See Before You Start.
- You have obtained the project ID of the region where the media asset to be queried is located. For details, see Obtaining a Project ID.
Overall Process
Procedure
- Obtain a user token and use it to authenticate the calling of VOD APIs.
For details, see Making an API Request. CN North-Beijing4 is used as an example. If you need to call a VOD API in another region, replace the endpoint with the IAM endpoint of the corresponding region.
POST https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens Content-Type: application/json { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "password": "password", "domain": { "name": "domainname" } } } }, "scope": { "project": { "name": "projectname" } } } }
As shown in Figure 1, information in the red box indicates the user token. - Call the API for querying media assets.
- Select the GET request method and enter the request URI.
https://{endpoint}/v1.0/{project_id}/asset/details?asset_id=41cff636d5b12a51e7eb2838bbf45201&categories=base_info,transcode_info&thumbnail_info,review_info
categories indicates the type of media asset information to be queried. You can select one or more types for query. The options are as follows:- base_info: basic information about the media file, including the media file type, title, category, description, and original file URL
- transcode_info: information about the transcoded media file, including the used transcoding template
- thumbnail_info: information about snapshots, including the snapshot status and snapshot storage URL
- review_info: information about review, including whether the review is passed and the review results of text, cover, and video
You can query information about transcoded files, snapshots, or review only when the transcoding, snapshot capturing, or review is successful.
- In the request header, add X-Auth-Token and set its value to the token obtained in 1.
- If the request is successful, the media asset details are returned.
{ "asset_info_array" : [ { "asset_id" : "652c1e4085afeb22fdc256c6757d751b", "status" : "PUBLISHED", "description" : "Asset meta is published", "base_info" : { "title" : "okFLV.flv", "video_name" : "okFLV.flv", "description" : null, "category_id" : -1, "category_name": "Other", "create_time" : "20190704144303", "last_modified" : "20190704144303", "video_type" : "FLV", "tags" : null, "meta_data" : { "pack_type" : null, "codec" : "H.264", "duration" : 244, "video_size" : 13682041, "width" : 512, "hight" : 288, "bit_rate" : 448, "frame_rate" : 30, "quality" : null }, "video_url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/45c2493abe68de3dac7e98b0dadcf8ce.flv", "sign_url" : "", "cover_info_array" : [ { "cover_url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/cover/Cover0.jpg" } ], "subtitle_info" : [ ], "source_path" : { "bucket" : "obs-host", "location" : "cn-north-4", "object" : "1/okFLV.flv" }, "output_path" : { "bucket" : "obs-host", "location" : "cn-north-4", "object" : "output/652c1e4085afeb22fdc256c6757d751b/" } }, "play_info_array" : [ { "play_type" : "hls", "url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/play_video/index.m3u8", "encrypted" : 0, "meta_data" : { "pack_type" : null, "codec" : "H.264", "duration" : 0, "video_size" : 0, "width" : 0, "hight" : 0, "bit_rate" : 0, "frame_rate" : 0, "quality" : null } }, { "play_type" : "hls", "url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/play_video/b5d498082bbcff7a2055041d803ae2f9_1.m3u8", "encrypted" : 0, "meta_data" : { "pack_type" : null, "codec" : "H.264", "duration" : 205, "video_size" : 14669824, "width" : 512, "hight" : 288, "bit_rate" : 534, "frame_rate" : 0, "quality" : null } } ] } ], "is_truncated" : 0, "total" : 1 } { "asset_info_array" : [ { "asset_id" : "652c1e4085afeb22fdc256c6757d751b", "status" : "PUBLISHED", "description" : "Asset meta is published", "base_info" : { "title" : "okFLV.flv", "video_name" : "okFLV.flv", "description" : null, "category_id" : -1, "category_name": "Other", "create_time" : "20190704144303", "last_modified" : "20190704144303", "video_type" : "FLV", "tags" : null, "meta_data" : { "pack_type" : null, "codec" : "H.264", "duration" : 244, "video_size" : 13682041, "width" : 512, "hight" : 288, "bit_rate" : 448, "frame_rate" : 30, "quality" : null }, "video_url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/45c2493abe68de3dac7e98b0dadcf8ce.flv", "sign_url" : "", "cover_info_array" : [ { "cover_url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/cover/Cover0.jpg" } ], "subtitle_info" : [ ], "source_path" : { "bucket" : "obs-host", "location" : "cn-north-4", "object" : "1/okFLV.flv" }, "output_path" : { "bucket" : "obs-host", "location" : "cn-north-4", "object" : "output/652c1e4085afeb22fdc256c6757d751b/" } }, "play_info_array" : [ { "play_type" : "hls", "url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/play_video/index.m3u8", "encrypted" : 0, "meta_data" : { "pack_type" : null, "codec" : "H.264", "duration" : 0, "video_size" : 0, "width" : 0, "hight" : 0, "bit_rate" : 0, "frame_rate" : 0, "quality" : null } }, { "play_type" : "hls", "url" : "https://651.cdn-vod.huaweicloud.com/asset/652c1e4085afeb22fdc256c6757d751b/play_video/b5d498082bbcff7a2055041d803ae2f9_1.m3u8", "encrypted" : 0, "meta_data" : { "pack_type" : null, "codec" : "H.264", "duration" : 205, "video_size" : 14669824, "width" : 512, "hight" : 288, "bit_rate" : 534, "frame_rate" : 0, "quality" : null } } ] } ], "is_truncated" : 0, "total" : 1 }
- Select the GET request method and enter the request URI.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot