Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Video On Demand/ API Reference/ Application Examples/ Example 3: Obtaining Media Asset Details

Example 3: Obtaining Media Asset Details

Updated on 2024-12-04 GMT+08:00

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.

Procedure

  1. 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.
    Figure 1 Obtaining the user token

  2. Call the API for querying media assets.

    1. 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
      NOTE:

      You can query information about transcoded files, snapshots, or review only when the transcoding, snapshot capturing, or review is successful.

    2. In the request header, add X-Auth-Token and set its value to the token obtained in 1.
    3. 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
      }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback